mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
rbd: 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. modified: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
This commit is contained in:
parent
cbb31675a0
commit
0615d4e6a5
@ -762,8 +762,12 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
||||
s_logger.debug("Fetching list of snapshots of RBD image " + pool.getSourceDir() + "/" + uuid);
|
||||
List<RbdSnapInfo> snaps = image.snapList();
|
||||
for (RbdSnapInfo snap : snaps) {
|
||||
s_logger.debug("Unprotecting snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
|
||||
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…
x
Reference in New Issue
Block a user