]> xenbits.xensource.com Git - libvirt.git/commitdiff
vz: fix notification subscription
authorMikhail Feoktistov <mfeoktistov@virtuozzo.com>
Wed, 10 Feb 2016 09:39:13 +0000 (12:39 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Fri, 12 Feb 2016 10:32:01 +0000 (13:32 +0300)
Bug cause:
Update the domain that is subscribed to hypervisor notification.
LoadDomain() rewrites notifications fields in vzDomObj structure and makes domain as "unsubscribed".
Fix:
Initialize notification fields in vzDomObj only if we create a new domain.
And do not reinitialize these fields if we update domain (by calling LoadDomain with olddom argument)

src/vz/vz_sdk.c

index 3b7d7b3ad2b5ec7f0e5d80289fd2b322f66a4972..4423788eee33b7965d55219527f5f583a84d5661 100644 (file)
@@ -1275,6 +1275,12 @@ prlsdkLoadDomain(vzConnPtr privconn,
     if (!olddom) {
         if (VIR_ALLOC(pdom) < 0)
             goto error;
+        pdom->cache.stats = PRL_INVALID_HANDLE;
+        pdom->cache.count = -1;
+        if (virCondInit(&pdom->cache.cond) < 0) {
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize condition"));
+            goto error;
+        }
     } else {
         pdom = olddom->privateData;
     }
@@ -1286,13 +1292,6 @@ prlsdkLoadDomain(vzConnPtr privconn,
 
     def->id = -1;
 
-    pdom->cache.stats = PRL_INVALID_HANDLE;
-    pdom->cache.count = -1;
-    if (virCondInit(&pdom->cache.cond) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize condition"));
-        goto error;
-    }
-
     if (prlsdkGetDomainIds(sdkdom, &def->name, def->uuid) < 0)
         goto error;