slavkap commented on code in PR #14203:
URL: https://github.com/apache/cloudstack/pull/14203#discussion_r4312983414


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java:
##########
@@ -173,23 +179,30 @@ private void 
restoreVolumesOfDestroyedVMs(KVMStoragePoolManager storagePoolMgr,
         }
     }
 
-    private void restoreVolume(KVMStoragePoolManager storagePoolMgr, String 
backupPath, PrimaryDataStoreTO volumePool, String volumePath, String diskType, 
String backupFile,
+    /**
+     * @return the volume path the backup was actually written to. Equal to 
{@code volumePath}
+     * except when the pool assigns the created volume's identity itself 
(StorPool), in which
+     * case it reflects the real device path.
+     */
+    private String restoreVolume(KVMStoragePoolManager storagePoolMgr, String 
backupPath, PrimaryDataStoreTO volumePool, String volumePath, String diskType, 
String backupFile,
                                Long size, Pair<String, VirtualMachine.State> 
vmNameAndState, String mountDirectory, int timeout, Integer mountTimeout) {
         String bkpPath;
         String volumeUuid;
         try {
             bkpPath = getBackupPath(mountDirectory, backupPath, backupFile, 
diskType);
             volumeUuid = getVolumeUuidFromPath(volumePath, volumePool);
             verifyBackupFile(bkpPath, volumeUuid);
-            if (!replaceVolumeWithBackup(storagePoolMgr, volumePool, 
volumePath, bkpPath, timeout, true, size)) {
+            Pair<Boolean, String> restoreResult = 
replaceVolumeWithBackup(storagePoolMgr, volumePool, volumePath, bkpPath, 
timeout, true, size);
+            if (!restoreResult.first()) {
                 throw new CloudRuntimeException(String.format("Unable to 
restore contents from the backup volume [%s].", volumeUuid));

Review Comment:
   thank you @Damans227, good catch here! I've added to delete the StorPool's 
volume on fail, but I think the rest of the supported storage pools will have 
the same issue that you pointed



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