libvirt domain defined event is issued only on correspondent vz sdk event. But in case event delivered before domain is added to domain list we can mistakenly skip this event if prlsdkNewDomainByHandle return NULL in case of domain is discovered in the list under the driver lock. Let's return domain object in this case. Now prlsdkNewDomainByHandle returns NULL only in case of error which is more convinient.
Signed-off-by: Nikolay Shirokovskiy <nshirokovs...@virtuozzo.com> --- src/vz/vz_sdk.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 7eb78ca..e7e9638 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1255,12 +1255,8 @@ prlsdkNewDomainByHandle(vzDriverPtr driver, PRL_HANDLE sdkdom) goto cleanup; /* we should make sure that there is no such a VM exists */ - dom = virDomainObjListFindByUUID(driver->domains, uuid); - if (dom) { - virObjectUnlock(dom); - dom = NULL; + if ((dom = virDomainObjListFindByUUID(driver->domains, uuid))) goto cleanup; - } if (!(dom = vzNewDomain(driver, name, uuid))) goto cleanup; -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list