[NEW PATCH] BZ#716919 - Update guest cpu running state after underlying VM is continued (via gerrit-bot)

Dan Kenigsberg danken at redhat.com
Thu Aug 4 12:01:36 UTC 2011


New patch submitted by Dan Kenigsberg (danken at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/695

commit 32e75e057b3bd9f8657c681a26e93c4602dac5a9
Author: Yotam Oron <yoron at redhat.com>
Date:   Mon Jul 25 10:53:36 2011 +0300

    BZ#716919 - Update guest cpu running state after underlying VM is continued
    
    The guest CPU state should be updated after the underlying machine is
    resumed, so that the right value is read from libvirt.
    
    Change-Id: Ie3bb3bd2ec985b42bdaea19ce334f53234df4f11

diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 455d6a2..7dccafb 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -890,6 +890,9 @@ class LibvirtVm(vm.Vm):
         self._vmStats.start()
         self._guestEventTime = self._startTime
 
+    def updateGuestCpuRunning(self):
+        self._guestCpuRunning = self._dom.info()[0] == libvirt.VIR_DOMAIN_RUNNING
+
     def _domDependentInit(self):
         if self.destroyed:
             # reaching here means that Vm.destroy() was called before we could
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 12aeb02..b947b19 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -634,7 +634,8 @@ class Vm(object):
                  self.log.error('cannot cont while %s', self.lastStatus)
                  return errCode['unexpected']
             self._underlyingCont()
-            self._guestCpuRunning = True
+            if hasattr(self, 'updateGuestCpuRunning'):
+                self.updateGuestCpuRunning()
             self._lastStatus = afterState
             try:
                 del self.conf['pauseCode']
@@ -651,7 +652,8 @@ class Vm(object):
         try:
             self.conf['pauseCode'] = 'NOERR'
             self._underlyingPause()
-            self._guestCpuRunning = False
+            if hasattr(self, 'updateGuestCpuRunning'):
+                self.updateGuestCpuRunning()
             self._lastStatus = afterState
             return {'status': doneCode, 'output': ['']}
         finally:




More information about the vdsm-patches mailing list