Skip to content

Commit 8dda699

Browse files
committed
CLOUDSTACK-5857: for some reasons, delete secondary pool failed during copy template from secondary storage to primary storage, but the volume is already copied to primary storage, we didn't clean up the volume on primary storage, then all the following copy the same template to primary storage failed, as we are always using the same uuid when creating a new volume, libvirt complaining that the volume already exists.
Current fix is ignoring "the delete secondary storage error".
1 parent b6698f3 commit 8dda699

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,12 @@ else if (primaryVol.getFormat() == PhysicalDiskFormat.QCOW2) {
237237
} catch (CloudRuntimeException e) {
238238
return new CopyCmdAnswer(e.toString());
239239
} finally {
240-
if (secondaryPool != null) {
241-
secondaryPool.delete();
240+
try {
241+
if (secondaryPool != null) {
242+
secondaryPool.delete();
243+
}
244+
} catch(Exception e) {
245+
s_logger.debug("Failed to clean up secondary storage", e);
242246
}
243247
}
244248
}

‎plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public boolean deleteStoragePool(String uuid) {
617617
}
618618
s_logger.error("failed in umount retry");
619619
}
620-
throw new CloudRuntimeException(e.toString());
620+
throw new CloudRuntimeException(e.toString(), e);
621621
}
622622
}
623623

‎plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ public StoragePool getPool() {
252252

253253
@Override
254254
public boolean delete() {
255-
return this._storageAdaptor.deleteStoragePool(this);
255+
try {
256+
return this._storageAdaptor.deleteStoragePool(this);
257+
} catch (Exception e) {
258+
s_logger.debug("Failed to delete storage pool", e);
259+
}
260+
return false;
256261
}
257262

258263
@Override

0 commit comments

Comments
 (0)