Change in vdsm[ovirt-3.5]: vm: avoid race while setting guest cpu status

ybronhei at redhat.com ybronhei at redhat.com
Fri Sep 5 01:45:59 UTC 2014


Yaniv Bronhaim has submitted this change and it was merged.

Change subject: vm: avoid race while setting guest cpu status
......................................................................


vm: avoid race while setting guest cpu status

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.

To fix this, we make use of the guestCpuLock everywhere
we change the state of the guest CPU, in order to synchronize
access to the field with respect to pause() and cont() methods.

While good enough for the short term, more aggressive
refactoring is needed in this area.

Change-Id: I3aea96c7122d60e6cb888273678b565c3f3e537f
Bug-Url: https://bugzilla.redhat.com/1111938
Signed-off-by: Francesco Romani <fromani at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/29113
Reviewed-by: Michal Skrivanek <michal.skrivanek at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/32462
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vm.py
2 files changed, 67 insertions(+), 12 deletions(-)

Approvals:
  Yaniv Bronhaim: Looks good to me, approved
  Dan Kenigsberg: Looks good to me, but someone else must approve
  Francesco Romani: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3aea96c7122d60e6cb888273678b565c3f3e537f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list