[libvirt] [PATCH 4/4] vz: fix notification subscription

Mikhail Feoktistov mfeoktistov at virtuozzo.com
Sat Jan 23 08:42:17 UTC 2016


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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index d9f2127..ef319b7 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1288,13 +1288,6 @@ prlsdkLoadDomain(vzConnPtr privconn,
      * to NULL temporarily */
     pdom->uuid = NULL;
 
-    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;
-    }
-
     def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
     def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
     def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
@@ -1495,6 +1488,13 @@ prlsdkNewDomain(vzConnPtr privconn, char *name, const unsigned char *uuid)
     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;
+    }
+
     if (STREQ(privconn->drivername, "vz"))
         def->virtType = VIR_DOMAIN_VIRT_VZ;
     else
@@ -1512,7 +1512,7 @@ prlsdkNewDomain(vzConnPtr privconn, char *name, const unsigned char *uuid)
 
  error:
     virDomainDefFree(def);
-    VIR_FREE(pdom);
+    prlsdkDomObjFreePrivate(pdom);
     return NULL;
 }
 
-- 
1.8.3.1




More information about the libvir-list mailing list