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


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -1764,10 +1764,6 @@ public boolean restoreBackupVolumeAndAttachToVM(final 
String backedUpVolumeUuid,
             throw new CloudRuntimeException("Failed to find Instance Backup 
Offering");
         }
 
-        if (!StringUtils.equals(KBOSS_BACKUP_PROVIDER, offering.getProvider()) 
&& !VirtualMachine.PowerState.PowerOff.equals(vm.getPowerState())) {
-            throw new CloudRuntimeException(String.format("VM [%s] needs to be 
powered off to restore the volume [%s].", vm.getUuid(), backedUpVolumeUuid));
-        }
-
         BackupProvider backupProvider = 
getBackupProvider(offering.getProvider());
         VolumeVO backedUpVolume = 
volumeDao.findByUuidIncludingRemoved(backedUpVolumeUuid);

Review Comment:
   Removing the PowerOff precondition without replacing it with a 
provider-/volume-aware capability check can allow restores while the VM is 
running for providers (or volume types) that don’t support online restore, 
risking restore failure or disk/data inconsistency. Consider reinstating 
validation based on provider capabilities (e.g., `backupProvider` declares 
whether online restore is supported) and/or volume type (root vs data disk) + 
attach/hot-plug constraints, and fail early with a clear message when online 
restore isn’t supported.



-- 
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