Francesco Romani has uploaded a new change for review.

Change subject: vm: set status before to invoke suspend
......................................................................

vm: set status before to invoke suspend

Inside the Vm class, the state swapping is not atomic.
This is because the reported state is function of two internal fields,
lastStatus and guestCpuRunning, which may be updated concurrently
and not atomically.

One clear example for this is BZ1111938, on which we see a
race between pause(), onLibvirtLifeCycle() and getStats(),
which makes a Vm incorrectly reported as 'Paused'
(instead of 'Saving State'), which confuses Engine.

The definitive fix is of course make sure the state changes inside the
Vm are atomic ad well handled, but this will require an overhaul
of the Vm class internals.

This patch provides a short term quick fix by swapping the order
of operations, in order to handle this specific case.

Change-Id: I3aea96c7122d60e6cb888273678b565c3f3e537f
Bug-Url: https://bugzilla.redhat.com/1111938
Signed-off-by: Francesco Romani <[email protected]>
---
M vdsm/virt/vm.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/29113/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d145122..181a18e 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2636,9 +2636,9 @@
         try:
             with self._confLock:
                 self.conf['pauseCode'] = pauseCode
+            self._lastStatus = afterState
             self._underlyingPause()
             self.updateGuestCpuRunning()
-            self._lastStatus = afterState
             return {'status': doneCode, 'output': ['']}
         finally:
             if not guestCpuLocked:


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

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

Reply via email to