[PATCH 4/4] vz: fix notification subscription

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]