wido commented on a change in pull request #3724: Storage-based Snapshots for 
KVM VMs
URL: https://github.com/apache/cloudstack/pull/3724#discussion_r366306045
 
 

 ##########
 File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
 ##########
 @@ -1456,22 +1496,65 @@ public Answer createSnapshot(final CreateObjectCommand 
cmd) {
             final KVMPhysicalDisk disk = 
storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), 
primaryStore.getUuid(), volume.getPath());
             if (state == DomainInfo.DomainState.VIR_DOMAIN_RUNNING && 
!primaryPool.isExternalSnapshot()) {
                 final String vmUuid = vm.getUUIDString();
-                final Object[] args = new Object[] {snapshotName, vmUuid};
-                final String snapshot = SnapshotXML.format(args);
+                boolean isKVMEnabled = cmd.getContextParam("kvmsnapshot") != 
null ? Boolean.parseBoolean(cmd.getContextParam("kvmsnapshot")) : false;
+                s_logger.debug(String.format("Snapshots on KVM is enabled %s", 
isKVMEnabled));
+                if (isKVMEnabled) {
+                    long size = 0;
+                    OutputInterpreter.OneLineParser parser = new 
OutputInterpreter.OneLineParser();
+                    Script sc = new Script("virsh");
+                    sc.add(String.format("qemu-monitor-command %s '{ 
\"execute\" : \"query-block\" }'", vmName));
 
 Review comment:
   Yes, but then we fix that. It's a matter of sending a patch to the libvirt 
project and they are happy to accept it.
   
   I think cloudstack is the only project really using those bindings. But they 
are not so difficult, so we can send patches when we need something.
   
   We should not just work around it by not using them. Executing commands is 
just not reliable enough.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to