sureshanaparti commented on code in PR #11258:
URL: https://github.com/apache/cloudstack/pull/11258#discussion_r2222139315
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java:
##########
@@ -126,15 +127,13 @@ private void restoreVolume(String backupPath, String
backupRepoType, String back
Pair<String, String> bkpPathAndVolUuid;
try {
bkpPathAndVolUuid = getBackupPath(mountDirectory, volumePath,
backupPath, diskType, volumeUUID);
- try {
- replaceVolumeWithBackup(volumePath, bkpPathAndVolUuid.first());
- if
(VirtualMachine.State.Running.equals(vmNameAndState.second())) {
- if (!attachVolumeToVm(vmNameAndState.first(), volumePath))
{
- throw new CloudRuntimeException(String.format("Failed
to attach volume to VM: %s", vmNameAndState.first()));
- }
+ if (!replaceVolumeWithBackup(volumePath,
bkpPathAndVolUuid.first())) {
+ throw new CloudRuntimeException(String.format("Unable to
restore backup for volume [%s].", bkpPathAndVolUuid.second()));
+ }
+ if (VirtualMachine.State.Running.equals(vmNameAndState.second())) {
Review Comment:
```suggestion
if (VirtualMachine.State.Running.equals(vmNameAndState.second())
&& !attachVolumeToVm(vmNameAndState.first(), volumePath)) {
```
--
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]