Patch 1 and 2:
Fix 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.
This fix splits logic of prlsdkAddDomain() into two new functions.
1. prlsdkNewDomain() creates new empty domain in domains list with the specific uuid.
2. prlsdkSetDomainInstance() add data from VM to domain object.
Patch 3 fixes notification subscription.
To get domain info we should receive and handle notification from hypervisor.
Mikhail Feoktistov (4):
vz: Split logic of prlsdkAddDomain() into two functions
vz: Remove prlsdkAddDomain() and use new functions
vz: remove code duplication from LoadDomain()
vz: fix notification subscription
src/vz/vz_driver.c | 14 ++++-
src/vz/vz_sdk.c | 156 ++++++++++++++++++++++++++++++-----------------------
src/vz/vz_sdk.h | 8 ++-
3 files changed, 107 insertions(+), 71 deletions(-)
--
1.8.3.1