Adam Litke has uploaded a new change for review.

Change subject: virt: Add a function to execute a qemu monitor command
......................................................................

virt: Add a function to execute a qemu monitor command

Sometimes it is necessary to execute a monitor command directly (eg. if
libvirt does not yet support a certain qemu feature).  Libvirt will mark
the VM as 'tainted' once this is done for the first time.  The reason is
that making modifications to a VM using this facility could cause a
split-brain situation.  It is generally harmless to execute monitor
commands which act in a read-only fashion.  This function is also useful
as a utility for developers who are working on new features.

Change-Id: I3e9e07ba0c236c0938b129ae90af825f18f0e644
Signed-off-by: Adam Litke <[email protected]>
---
M vdsm/virt/vm.py
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/27950/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9cc9958..de27a53 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -30,9 +30,11 @@
 import threading
 import time
 import xml.dom.minidom
+import json
 
 # 3rd party libs imports
 import libvirt
+import libvirt_qemu
 
 # vdsm imports
 from vdsm import constants
@@ -4948,6 +4950,15 @@
         if 'tlsPort' in dev:
             self.conf['displaySecurePort'] = dev['tlsPort']
 
+    def _internalQMPMonitorCommand(self, cmdDict):
+        """
+        Execute a qemu monitor command directly.
+        WARNING: This will cause libvirt to mark the VM as tainted.
+        """
+        jsonCmd = json.dumps(cmdDict)
+        ret = libvirt_qemu.qemuMonitorCommand(self._dom, jsonCmd, 0)
+        return json.loads(ret)
+
 
 def _getNetworkIp(network):
     try:


-- 
To view, visit http://gerrit.ovirt.org/27950
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e9e07ba0c236c0938b129ae90af825f18f0e644
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to