[libvirt] [PATCH] Fix ID field in virDomainPtr after starting Xen guest

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

 



* src/xend_internal.c: Lookup guest after starting persistent
  config in order to refresh the domain ID field
---
 src/xend_internal.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/xend_internal.c b/src/xend_internal.c
index 7bcee7d..459b6bc 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -4537,6 +4537,8 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
 int xenDaemonDomainCreate(virDomainPtr domain)
 {
     xenUnifiedPrivatePtr priv;
+    int ret;
+    virDomainPtr tmp;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
         virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
@@ -4549,7 +4551,17 @@ int xenDaemonDomainCreate(virDomainPtr domain)
     if (priv->xendConfigVersion < 3)
         return(-1);
 
-    return xend_op(domain->conn, domain->name, "op", "start", NULL);
+    ret = xend_op(domain->conn, domain->name, "op", "start", NULL);
+
+    if (ret != -1) {
+        /* Need to force a refresh of this object's ID */
+        tmp = virDomainLookupByName(domain->conn, domain->name);
+        if (tmp) {
+	    domain->id = tmp->id;
+            virDomainFree(tmp);
+        }
+    }
+    return ret;
 }
 
 int xenDaemonDomainUndefine(virDomainPtr domain)
-- 
1.6.4

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