[libvirt] [PATCH 22/40] Simplify the Xen domain migration driver methods

Jim Fehlig jfehlig at suse.com
Wed May 8 22:22:31 UTC 2013


Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> All the migration code is done by the XenD subdriver which
> can be assumed to always be present
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/xen/xen_driver.c | 32 +++++++++-----------------------
>  1 file changed, 9 insertions(+), 23 deletions(-)
>
> diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> index f11e5bf..cfdc940 100644
> --- a/src/xen/xen_driver.c
> +++ b/src/xen/xen_driver.c
> @@ -1233,17 +1233,11 @@ xenUnifiedDomainMigratePrepare(virConnectPtr dconn,
>                                 const char *dname,
>                                 unsigned long resource)
>  {
> -    xenUnifiedPrivatePtr priv = dconn->privateData;
> -
>      virCheckFlags(XEN_MIGRATION_FLAGS, -1);
>  
> -    if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -        return xenDaemonDomainMigratePrepare(dconn, cookie, cookielen,
> -                                             uri_in, uri_out,
> -                                             flags, dname, resource);
> -
> -    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> -    return -1;
> +    return xenDaemonDomainMigratePrepare(dconn, cookie, cookielen,
> +                                         uri_in, uri_out,
> +                                         flags, dname, resource);
>  }
>  
>  static int
> @@ -1255,16 +1249,10 @@ xenUnifiedDomainMigratePerform(virDomainPtr dom,
>                                 const char *dname,
>                                 unsigned long resource)
>  {
> -    xenUnifiedPrivatePtr priv = dom->conn->privateData;
> -
>      virCheckFlags(XEN_MIGRATION_FLAGS, -1);
>  
> -    if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -        return xenDaemonDomainMigratePerform(dom, cookie, cookielen, uri,
> -                                             flags, dname, resource);
> -
> -    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> -    return -1;
> +    return xenDaemonDomainMigratePerform(dom, cookie, cookielen, uri,
> +                                         flags, dname, resource);
>  }
>  
>  static virDomainPtr
> @@ -1281,24 +1269,22 @@ xenUnifiedDomainMigrateFinish(virConnectPtr dconn,
>  
>      virCheckFlags(XEN_MIGRATION_FLAGS, NULL);
>  
> -    dom = xenUnifiedDomainLookupByName(dconn, dname);
> -    if (! dom) {
> +    if (!(dom = xenUnifiedDomainLookupByName(dconn, dname)))
>          return NULL;
> -    }
>  
>      if (flags & VIR_MIGRATE_PERSIST_DEST) {
>          domain_xml = xenDaemonDomainGetXMLDesc(dom, 0, NULL);
>   

Ah, my comment in the previous patch referred to the call to
xenDaemonDomainGetXMLDesc here. dom should be inactive at this point
right? In which case xenDaemonDomainGetXMLDesc will return NULL if
xendConfigVersion < 3_0_4. But again, not sure if the migration
functions are meant to be supported in that environment.

Patch looks good otherwise and weak ACK assuming the migration functions
are for xendConfigVersion >= 3_0_4.

Regards,
Jim

>          if (! domain_xml) {
>              virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
>                             "%s", _("failed to get XML representation of migrated domain"));
> -            goto failure;
> +            goto error;
>          }
>  
>          dom_new = xenDaemonDomainDefineXML(dconn, domain_xml);
>          if (! dom_new) {
>              virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
>                             "%s", _("failed to define domain on destination host"));
> -            goto failure;
> +            goto error;
>          }
>  
>          /* Free additional reference added by Define */
> @@ -1310,7 +1296,7 @@ xenUnifiedDomainMigrateFinish(virConnectPtr dconn,
>      return dom;
>  
>  
> -failure:
> +error:
>      virDomainFree(dom);
>  
>      VIR_FREE(domain_xml);
>   




More information about the libvir-list mailing list