Francesco Romani has uploaded a new change for review.

Change subject: mom: add API to ask hypervisor to do monitoring
......................................................................

mom: add API to ask hypervisor to do monitoring

Demand the actual invocation of the monitoring code to the hypervisor,
so we can optionally get rid of the constraint of one thread per VM,
which scales poorly.

Change-Id: I751dfd977340ffa3df095d80b76f08b3c202ca81
Signed-off-by: Francesco Romani <[email protected]>
---
M mom/HypervisorInterfaces/HypervisorInterface.py
M mom/HypervisorInterfaces/libvirtInterface.py
M mom/HypervisorInterfaces/vdsmInterface.py
3 files changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/mom refs/changes/92/31592/1

diff --git a/mom/HypervisorInterfaces/HypervisorInterface.py 
b/mom/HypervisorInterfaces/HypervisorInterface.py
index 430dba8..fa3855a 100644
--- a/mom/HypervisorInterfaces/HypervisorInterface.py
+++ b/mom/HypervisorInterfaces/HypervisorInterface.py
@@ -71,6 +71,16 @@
         """
         pass
 
+    def attachMonitor(self, uuid, monitorCallback, interval):
+        """
+        Requests the hypervisor to handle a Guest Monitor for the specified
+        uuid. The Hypervisor should keep the `monitorCallback' reference
+        until the Vm is alive, and call it each `interval' seconds.
+        Returns a boolean: True if the hypervisor can and want take care
+        of monitoring, False otherwise.
+        """
+        pass
+
 
 class HypervisorInterfaceError(Exception):
     pass
diff --git a/mom/HypervisorInterfaces/libvirtInterface.py 
b/mom/HypervisorInterfaces/libvirtInterface.py
index a44fdd1..88e6f19 100644
--- a/mom/HypervisorInterfaces/libvirtInterface.py
+++ b/mom/HypervisorInterfaces/libvirtInterface.py
@@ -320,5 +320,12 @@
             return None
         return libvirt_qemu.qemuAgentCommand(dom, command, timeout, 0)
 
+    def attachMonitor(self, uuid, monitorCallback, interval):
+        """
+        libvirt cannot take care of monitoring.
+        """
+        return False
+
+
 def instance(config):
     return libvirtInterface(config)
diff --git a/mom/HypervisorInterfaces/vdsmInterface.py 
b/mom/HypervisorInterfaces/vdsmInterface.py
index 1193785..6015d31 100644
--- a/mom/HypervisorInterfaces/vdsmInterface.py
+++ b/mom/HypervisorInterfaces/vdsmInterface.py
@@ -217,6 +217,14 @@
         superVdsm = supervdsm.getProxy()
         superVdsm.ksmTune(tuningParams)
 
+    def attachMonitor(self, uuid, monitorCallback, interval):
+        vm = API.VM(uuid)
+        try:
+            return vm.attachMonitor(monitorCallback, interval)
+        except AttributeError:
+            # outdated VDSM
+            return False
+
 
 class vdsmException(Exception):
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I751dfd977340ffa3df095d80b76f08b3c202ca81
Gerrit-PatchSet: 1
Gerrit-Project: mom
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to