Change in vdsm[master]: vm: avoid race while setting guest cpu status

danken at redhat.com danken at redhat.com
Thu Sep 4 11:07:25 UTC 2014


Dan Kenigsberg 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>
---
M tests/vmTests.py
M vdsm/virt/vm.py
2 files changed, 62 insertions(+), 10 deletions(-)

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



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3aea96c7122d60e6cb888273678b565c3f3e537f
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
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: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list