mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixes issue #3590 by using the last element on the array from the snapshot "path" String for retrieving the snapshot id. Additionally, it uses the volumePath as the volume id which should always be the correct value. The error raised on issue #3590 was related to the wrong use of variable "path" where in some cases had a different set of substrings. The proposed change has been tested and evaluated. The values used for openning the RBD connection and executing the rollback were stable on the tests. Runned rollback on multiple snapshots and could start the VM with the content matching the ROOT reverted snapshot.
This commit is contained in:
parent
ae61bfee76
commit
8ac25019d3
@ -86,14 +86,16 @@ public final class LibvirtRevertSnapshotCommandWrapper extends CommandWrapper<Re
|
||||
rados.connect();
|
||||
|
||||
String[] rbdPoolAndVolumeAndSnapshot = snapshotRelPath.split("/");
|
||||
int snapshotIndex = rbdPoolAndVolumeAndSnapshot.length - 1;
|
||||
String rbdSnapshotId = rbdPoolAndVolumeAndSnapshot[snapshotIndex];
|
||||
|
||||
IoCTX io = rados.ioCtxCreate(primaryPool.getSourceDir());
|
||||
Rbd rbd = new Rbd(io);
|
||||
RbdImage image = rbd.open(rbdPoolAndVolumeAndSnapshot[1]);
|
||||
|
||||
s_logger.debug(String.format("Attempting to rollback RBD snapshot [name:%s], [pool:%s], [volumeid:%s], [snapshotid:%s]", snapshot.getName(),
|
||||
rbdPoolAndVolumeAndSnapshot[0], rbdPoolAndVolumeAndSnapshot[1], rbdPoolAndVolumeAndSnapshot[2]));
|
||||
image.snapRollBack(rbdPoolAndVolumeAndSnapshot[2]);
|
||||
s_logger.debug(String.format("Attempting to rollback RBD snapshot [name:%s], [volumeid:%s], [snapshotid:%s]", snapshot.getName(), volumePath, rbdSnapshotId));
|
||||
|
||||
RbdImage image = rbd.open(volumePath);
|
||||
image.snapRollBack(rbdSnapshotId);
|
||||
|
||||
rbd.close(image);
|
||||
rados.ioCtxDestroy(io);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user