[PATCH] vz: fix active domain listing

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

 



Since commit 9c14a9ab we have broken active domain listing
because reworked prlsdkLoadDomain doesn't set dom->def->id
propely. It just looses it when a new def structure is set.
Now we make prlsdkConvertDomainState function return void
and move calling it after an old dom->def is replaces with
a new one within prlsdkLoadDomain function.

Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
---
 src/vz/vz_sdk.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index de73c31..f7d769b 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1051,7 +1051,7 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def)
     return -1;
 }
 
-static int
+static void
 prlsdkConvertDomainState(VIRTUAL_MACHINE_STATE domainState,
                          PRL_UINT32 envId,
                          virDomainObjPtr dom)
@@ -1121,17 +1121,12 @@ prlsdkConvertDomainState(VIRTUAL_MACHINE_STATE domainState,
         dom->def->id = envId;
         break;
     case VMS_UNKNOWN:
+    default:
         virDomainObjSetState(dom, VIR_DOMAIN_NOSTATE,
                              VIR_DOMAIN_NOSTATE_UNKNOWN);
-        break;
-    default:
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unknown domain state: %X"), domainState);
-        return -1;
+        dom->def->id = -1;
         break;
     }
-
-    return 0;
 }
 
 static int
@@ -1374,9 +1369,6 @@ prlsdkLoadDomain(vzConnPtr privconn, virDomainObjPtr dom)
             goto error;
     }
 
-    if (prlsdkConvertDomainState(domainState, envId, dom) < 0)
-        goto error;
-
     /* assign new virDomainDef without any checks
      * we can't use virDomainObjAssignDef, because it checks
      * for state and domain name */
@@ -1386,6 +1378,8 @@ prlsdkLoadDomain(vzConnPtr privconn, virDomainObjPtr dom)
     VIR_FREE(pdom->home);
     pdom->home = home;
 
+    prlsdkConvertDomainState(domainState, envId, dom);
+
     if (!pdom->sdkdom) {
         PrlHandle_AddRef(sdkdom);
         pdom->sdkdom = sdkdom;
@@ -1532,8 +1526,8 @@ prlsdkHandleVmStateEvent(vzConnPtr privconn,
     prlsdkCheckRetGoto(pret, cleanup);
 
     pdom = dom->privateData;
-    if (prlsdkConvertDomainState(domainState, pdom->id, dom) < 0)
-        goto cleanup;
+
+    prlsdkConvertDomainState(domainState, pdom->id, dom);
 
     prlsdkNewStateToEvent(domainState,
                           &lvEventType,
-- 
2.4.3

--
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]