Copilot commented on code in PR #12665:
URL: https://github.com/apache/cloudstack/pull/12665#discussion_r2828003544


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java:
##########
@@ -2044,7 +2044,7 @@ private void waitForBackup(String vmName) throws 
CloudRuntimeException {
             try {
                 Thread.sleep(10000);
             } catch (InterruptedException e) {
-                throw new CloudRuntimeException(e);
+                logger.trace("Thread that was tracking the progress for backup 
of VM [{}] was interrupted. Ignoring.", vmName);

Review Comment:
   When catching InterruptedException, the thread's interrupted status should 
be restored by calling Thread.currentThread().interrupt() after logging. This 
is a Java best practice because the interrupted status is cleared when the 
exception is thrown, and other code higher in the call stack might need to know 
that the thread was interrupted. Without restoring the status, the interruption 
signal is silently swallowed.
   ```suggestion
                   logger.trace("Thread that was tracking the progress for 
backup of VM [{}] was interrupted. Ignoring.", vmName);
                   Thread.currentThread().interrupt();
   ```



##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java:
##########
@@ -2044,7 +2044,7 @@ private void waitForBackup(String vmName) throws 
CloudRuntimeException {
             try {
                 Thread.sleep(10000);
             } catch (InterruptedException e) {
-                throw new CloudRuntimeException(e);
+                logger.trace("Thread that was tracking the progress for backup 
of VM [{}] was interrupted. Ignoring.", vmName);

Review Comment:
   The logging level should be at least 'debug' or 'warn' instead of 'trace' 
for an InterruptedException. Interruptions are significant events that 
typically indicate cancellation or shutdown, and logging them at trace level 
makes them too easy to miss in production logs. Other InterruptedException 
handlers in the codebase use debug, warn, or error levels.
   ```suggestion
                   logger.debug("Thread that was tracking the progress for 
backup of VM [{}] was interrupted. Ignoring.", vmName);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to