mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4665: Check if a snapshot is protected before trying to unprotect
Otherwise a RBDException will be thrown with the message that the snapshot isn't protected. Conflicts: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
This commit is contained in:
parent
4e9810dd51
commit
75792bf08e
|
|
@ -764,7 +764,13 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
|||
RbdImage image = rbd.open(uuid);
|
||||
List<RbdSnapInfo> snaps = image.snapList();
|
||||
for (RbdSnapInfo snap : snaps) {
|
||||
image.snapUnprotect(snap.name);
|
||||
if (image.snapIsProtected(snap.name)) {
|
||||
s_logger.debug("Unprotecting snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
|
||||
image.snapUnprotect(snap.name);
|
||||
} else {
|
||||
s_logger.debug("Snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name + " is not protected.");
|
||||
}
|
||||
s_logger.debug("Removing snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
|
||||
image.snapRemove(snap.name);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue