From: Nikolay Shirokovskiy Date: Wed, 8 Jun 2016 07:17:20 +0000 (+0300) Subject: vz: fix missed defined domain event X-Git-Tag: v2.1.0-rc1~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e08e8c7e89161becd2e18c2849f14a637015b0;p=thirdparty%2Flibvirt.git vz: fix missed defined domain event 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 --- diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 787123094d..41895cddba 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -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;