Re: [PATCH 19/40] Simplify the Xen domain save/restore driver methods

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

 



Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
>
> Unconditionally call the XenD APIs for save/restore, since that
> driver will always be open.
>
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/xen/xen_driver.c    | 21 ++++-----------------
>  src/xen/xend_internal.c |  2 ++
>  2 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> index 988dbce..a963e08 100644
> --- a/src/xen/xen_driver.c
> +++ b/src/xen/xen_driver.c
> @@ -876,8 +876,6 @@ static int
>  xenUnifiedDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
>                            unsigned int flags)
>  {
> -    xenUnifiedPrivatePtr priv = dom->conn->privateData;
> -
>      virCheckFlags(0, -1);
>      if (dxml) {
>          virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> @@ -885,9 +883,7 @@ xenUnifiedDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
>          return -1;
>      }
>  
> -    if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -        return xenDaemonDomainSave(dom, to);
> -    return -1;
> +    return xenDaemonDomainSave(dom, to);
>  }
>  
>  static int
> @@ -923,8 +919,7 @@ xenUnifiedDomainManagedSave(virDomainPtr dom, unsigned int flags)
>      if (!name)
>          goto cleanup;
>  
> -    if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -        ret = xenDaemonDomainSave(dom, name);
> +    ret = xenDaemonDomainSave(dom, name);
>  
>  cleanup:
>      VIR_FREE(name);
> @@ -971,8 +966,6 @@ static int
>  xenUnifiedDomainRestoreFlags(virConnectPtr conn, const char *from,
>                               const char *dxml, unsigned int flags)
>  {
> -    xenUnifiedPrivatePtr priv = conn->privateData;
> -
>      virCheckFlags(0, -1);
>      if (dxml) {
>          virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> @@ -980,9 +973,7 @@ xenUnifiedDomainRestoreFlags(virConnectPtr conn, const char *from,
>          return -1;
>      }
>  
> -    if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -        return xenDaemonDomainRestore(conn, from);
> -    return -1;
> +    return xenDaemonDomainRestore(conn, from);
>  }
>  
>  static int
> @@ -994,11 +985,7 @@ xenUnifiedDomainRestore(virConnectPtr conn, const char *from)
>  static int
>  xenUnifiedDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
>  {
> -    xenUnifiedPrivatePtr priv = dom->conn->privateData;
> -
> -    if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -        return xenDaemonDomainCoreDump(dom, to, flags);
> -    return -1;
> +    return xenDaemonDomainCoreDump(dom, to, flags);
>  }
>  
>  static int
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index d6a3698..ccbbf66 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -1422,6 +1422,8 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename)
>  
>      /* We can't save the state of Domain-0, that would mean stopping it too */
>      if (domain->id == 0) {
> +        virReportError(VIR_ERR_INVALID_ARG, "%s",
> +                       _("Cannot save host domain"));
>   

I'm surprised there have never been complaints about the lack of error
message here.

ACK.

Regards,
Jim

>          return -1;
>      }
>  
>   

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