]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vz: fix missed defined domain event
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Wed, 8 Jun 2016 07:17:20 +0000 (10:17 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Mon, 18 Jul 2016 19:20:24 +0000 (22:20 +0300)
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 <nshirokovskiy@virtuozzo.com>
src/vz/vz_sdk.c

index 787123094d15794abf2eb006a3233d0cad26303f..41895cddba7823a5af4c678410576c947dcb8117 100644 (file)
@@ -1421,12 +1421,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;