[libvirt] [PATCH 21/40] Simplify the Xen domain get XML driver method
Daniel P. Berrange
berrange at redhat.com
Thu May 9 08:17:14 UTC 2013
On Wed, May 08, 2013 at 03:56:14PM -0600, Jim Fehlig wrote:
> Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> >
> > The xenUnifiedDomainGetXMLDesc driver can assume that
> > the XM and XenD drivers are always present
> >
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> > src/xen/xen_driver.c | 24 +++++++++---------------
> > src/xen/xend_internal.c | 6 ------
> > 2 files changed, 9 insertions(+), 21 deletions(-)
> >
> > diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> > index 1db831d..f11e5bf 100644
> > --- a/src/xen/xen_driver.c
> > +++ b/src/xen/xen_driver.c
> > @@ -1106,23 +1106,17 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
> > {
> > xenUnifiedPrivatePtr priv = dom->conn->privateData;
> >
> > - if (dom->id == -1 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> > - if (priv->opened[XEN_UNIFIED_XM_OFFSET])
> > - return xenXMDomainGetXMLDesc(dom, flags);
> > + if (dom->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> > + return xenXMDomainGetXMLDesc(dom, flags);
> > } else {
> > - if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
> > - char *cpus, *res;
> > - xenUnifiedLock(priv);
> > - cpus = xenDomainUsedCpus(dom);
> > - xenUnifiedUnlock(priv);
> > - res = xenDaemonDomainGetXMLDesc(dom, flags, cpus);
> > - VIR_FREE(cpus);
> > - return res;
> > - }
> > + char *cpus, *res;
> > + xenUnifiedLock(priv);
> > + cpus = xenDomainUsedCpus(dom);
> > + xenUnifiedUnlock(priv);
> > + res = xenDaemonDomainGetXMLDesc(dom, flags, cpus);
> > + VIR_FREE(cpus);
> > + return res;
> > }
> > -
> > - virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> > - return NULL;
> > }
> >
> >
> > diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> > index dbad83f..930b882 100644
> > --- a/src/xen/xend_internal.c
> > +++ b/src/xen/xend_internal.c
> > @@ -1610,17 +1610,11 @@ xenDaemonDomainGetXMLDesc(virDomainPtr domain,
> > unsigned int flags,
> > const char *cpus)
> > {
> > - xenUnifiedPrivatePtr priv = domain->conn->privateData;
> > virDomainDefPtr def;
> > char *xml;
> >
> > /* Flags checked by virDomainDefFormat */
> >
> > - if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> > - /* fall-through to the next driver to handle */
> > - return NULL;
> > - }
> > -
> >
>
> This function has another caller, xenUnifiedDomainMigrateFinish, which
> appears to only support xendConfigVersion > 3_0_4 anyhow. ACK to the
> changes in this patch.
The MigrateFinish API will always have a virDomainDefPtr which refers
to a running domain, so this if() block would never be run when called
from migration context. Hence it is safe to remove it.
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 :|
More information about the libvir-list
mailing list