weizhouapache commented on a change in pull request #5297:
URL: https://github.com/apache/cloudstack/pull/5297#discussion_r818451112
##########
File path:
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
##########
@@ -1500,8 +1480,44 @@ public Answer createVolume(final CreateObjectCommand
cmd) {
}
}
- protected static final MessageFormat SnapshotXML = new MessageFormat("
<domainsnapshot>" + " <name>{0}</name>" + " <domain>"
- + " <uuid>{1}</uuid>" + " </domain>" + "
</domainsnapshot>");
+ /**
+ * XML to take disk-only snapshot of the VM.<br><br>
+ * 1st parameter: snapshot's name;<br>
+ * 2nd parameter: disk's label (target.dev tag from VM's XML);<br>
+ * 3rd parameter: absolute path to create the snapshot;<br>
+ * 4th parameter: list of disks to avoid on snapshot {@link
#TAG_AVOID_DISK_FROM_SNAPSHOT};
+ */
+ private static final String XML_CREATE_SNAPSHOT =
"<domainsnapshot><name>%s</name><disks><disk name='%s'
snapshot='external'><source file='%s'/></disk>%s</disks>"
+ + "</domainsnapshot>";
+
+ /**
+ * Tag to avoid disk from snapshot.<br><br>
+ * 1st parameter: disk's label (target.dev tag from VM's XML);
+ */
+ private static final String TAG_AVOID_DISK_FROM_SNAPSHOT = "<disk
name='%s' snapshot='no' />";
+
+ /**
+ * Virsh command to merge (blockcommit) snapshot into the base
file.<br><br>
+ * 1st parameter: VM's name;<br>
+ * 2nd parameter: disk's label (target.dev tag from VM's XML);<br>
+ * 3rd parameter: the absolute path of the base file;
+ * 4th parameter: the flag '--delete', if Libvirt supports it. Libvirt
started to support it on version <b>6.0.0</b>;
+ */
+ private static final String COMMAND_MERGE_SNAPSHOT = "virsh blockcommit %s
%s --base %s --active --wait %s --pivot";
Review comment:
@rohityadavcloud
yes, Ideally libvirt-java is used here.
But if there is no corresponding method in libvirt-java, this is also
acceptable I think, we can improve it afterwards, so this PR will not be
blocked by a third party project (libvirt-java)
--
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]