[libvirt] [PATCH 0/4] vz: rework domain creation

Mikhail Feoktistov mfeoktistov at virtuozzo.com
Wed Feb 10 09:39:10 UTC 2016

Patches 1 and 2 make preparation for patch 4

Patch 3 fixes notification subscription
To get domain info we should receive and handle notification from hypervisor

Patch 4 fixes race condition when adding domain to domains list
Race condition:
User calls defineXML to create new instance.
The main thread from vzDomainDefineXMLFlags() creates new instance by prlsdkCreateVm.
Then this thread calls prlsdkAddDomain to add new domain to domains list.
The second thread receives notification from hypervisor that new VM was created.
It calls prlsdkHandleVmAddedEvent() and also tries to add new domain to domains list.
These two threads call virDomainObjListFindByUUID() from prlsdkAddDomain() and don't find new domain.
So they add two domains with the same uuid to domains list.

Mikhail Feoktistov (4):
  vz: make output arguments in prlsdkGetDomainIds as optional
  vz: remove unused struct field
  vz: fix notification subscription
  vz: fix race condition when adding domain to domains list

 src/vz/vz_driver.c |  13 ++-
 src/vz/vz_sdk.c    | 261 ++++++++++++++++++++++-------------------------------
 src/vz/vz_sdk.h    |   7 +-
 src/vz/vz_utils.c  |  44 +++++++++
 src/vz/vz_utils.h  |   5 +-
 5 files changed, 174 insertions(+), 156 deletions(-)


More information about the libvir-list mailing list