[libvirt] [PATCH 19/40] Simplify the Xen domain save/restore driver methods
Jim Fehlig
jfehlig at suse.com
Tue May 7 20:58:48 UTC 2013
Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> Unconditionally call the XenD APIs for save/restore, since that
> driver will always be open.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
> 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;
> }
>
>
More information about the libvir-list
mailing list