Re: [PATCH 24/40] Simplify the Xen domain start driver method

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

 



On Wed, May 08, 2013 at 04:40:04PM -0600, Jim Fehlig wrote:
> Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> >
> > Directly call either the XenD or XM driver when starting
> > a persistent domain
> >
> > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> > ---
> >  src/xen/xen_driver.c    | 20 +++++++-------------
> >  src/xen/xen_driver.h    |  1 -
> >  src/xen/xend_internal.c | 20 +-------------------
> >  src/xen/xm_internal.c   |  4 ----
> >  4 files changed, 8 insertions(+), 37 deletions(-)

> > diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> > index addc547..dcd31de 100644
> > --- a/src/xen/xend_internal.c
> > +++ b/src/xen/xend_internal.c
> > @@ -2899,24 +2899,7 @@ xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc)
> >  int
> >  xenDaemonDomainCreate(virDomainPtr domain)
> >  {
> > -    xenUnifiedPrivatePtr priv = domain->conn->privateData;
> > -    int ret;
> > -    virDomainPtr tmp;
> > -
> > -    if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
> > -        return -1;
> > -
> > -    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);
> > -        }
> > -    }
> >   
> 
> Should this bit about updating the domain id be removed? Will the dom id
> remain at -1? If the id needs updated, it should probably be retrieved
> directly from xend.

Doh, I thought it was obsolete, but I was smoking crack. I'm
squashing in the following


@@ -2899,7 +2899,18 @@ xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc)
 int
 xenDaemonDomainCreate(virDomainPtr domain)
 {
-    return xend_op(domain->conn, domain->name, "op", "start", NULL);
+    int ret;
+
+    ret = xend_op(domain->conn, domain->name, "op", "start", NULL);
+
+    if (ret == 0) {
+        int id = xenDaemonDomainLookupByName_ids(domain->conn, domain->name,
+                                                 domain->uuid);
+        if (id > 0)
+            domain->id = id;
+    }
+
+    return ret;
 }
 
 int


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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