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

Yotam Oron yoron at redhat.com
Thu Jul 28 08:04:09 UTC 2011


New patch submitted by Yotam Oron (yoron at redhat.com)

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

commit 39e23a8ed8978c1d77698ccb6492a02b28141e8b
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 21961c2..721390f 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -874,6 +874,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 941ea0a..64186e5 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