From: Jim Fehlig <jfehlig@suse.com>
To: libvir-list@redhat.com
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH] libxl: support domainReset
Date: Wed, 06 Aug 2014 10:05:01 -0600 [thread overview]
Message-ID: <53E2522D.8010407@suse.com> (raw)
In-Reply-To: <1407204567-4131-1-git-send-email-jfehlig@suse.com>
Jim Fehlig wrote:
> Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
> option, but domainReset can be implemented in the libxl driver by
> forcibly destroying the domain and starting it again.
>
Any other comments on this from a libvirt perspective?
Regards,
Jim
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
> src/libxl/libxl_driver.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 57 insertions(+)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 67fd7bc6..08018d4 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -979,6 +979,62 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
> }
>
> static int
> +libxlDomainReset(virDomainPtr dom, unsigned int flags)
> +{
> + libxlDriverPrivatePtr driver = dom->conn->privateData;
> + virDomainObjPtr vm;
> + int ret = -1;
> + libxlDomainObjPrivatePtr priv;
> +
> + virCheckFlags(0, -1);
> +
> + if (!(vm = libxlDomObjFromDomain(dom)))
> + goto cleanup;
> +
> + if (virDomainResetEnsureACL(dom->conn, vm->def) < 0)
> + goto cleanup;
> +
> + if (!virDomainObjIsActive(vm)) {
> + virReportError(VIR_ERR_OPERATION_INVALID,
> + "%s", _("Domain is not running"));
> + goto cleanup;
> + }
> +
> + /*
> + * The semantics of reset can be achieved by forcibly destroying
> + * the domain and starting it again.
> + */
> + priv = vm->privateData;
> + if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("Failed to reset domain '%d'"), vm->def->id);
> + goto cleanup;
> + }
> +
> + if (!libxlDomainCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED)) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("Failed to cleanup domain '%d' after reset"),
> + vm->def->id);
> + vm = NULL;
> + goto cleanup;
> + }
> +
> + if (libxlDomainStart(driver, vm, false, -1) < 0) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("Failed to start domain '%d' after reset"),
> + vm->def->id);
> + goto cleanup;
> + }
> +
> + ret = 0;
> +
> + cleanup:
> + if (vm)
> + virObjectUnlock(vm);
> + return ret;
> +}
> +
> +static int
> libxlDomainDestroyFlags(virDomainPtr dom,
> unsigned int flags)
> {
> @@ -4758,6 +4814,7 @@ static virDriver libxlDriver = {
> .domainShutdown = libxlDomainShutdown, /* 0.9.0 */
> .domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
> .domainReboot = libxlDomainReboot, /* 0.9.0 */
> + .domainReset = libxlDomainReset, /* 1.2.8 */
> .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
> .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
> .domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */
>
next prev parent reply other threads:[~2014-08-06 16:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1407204567-4131-1-git-send-email-jfehlig@suse.com>
2014-08-05 8:33 ` [PATCH] libxl: support domainReset Ian Campbell
[not found] ` <1407227582.2120.3.camel@kazak.uk.xensource.com>
2014-08-05 8:41 ` Olaf Hering
[not found] ` <20140805084151.GA27835@aepfle.de>
2014-08-05 8:45 ` Ian Campbell
[not found] ` <1407228326.2120.15.camel@kazak.uk.xensource.com>
2014-08-05 8:55 ` Olaf Hering
[not found] ` <20140805085520.GA30208@aepfle.de>
2014-08-05 8:59 ` Ian Campbell
[not found] ` <1407229149.2120.26.camel@kazak.uk.xensource.com>
2014-08-05 14:06 ` Jim Fehlig
[not found] ` <53E0E4DE.30506@suse.com>
2014-08-05 14:12 ` Ian Campbell
[not found] ` <1407247933.2120.37.camel@kazak.uk.xensource.com>
2014-08-05 15:10 ` Jim Fehlig
2014-08-05 15:30 ` Ian Campbell
[not found] ` <1407252647.2120.45.camel@kazak.uk.xensource.com>
2014-08-05 16:12 ` Wei Liu
2014-08-05 18:45 ` Ian Campbell
[not found] ` <1407264348.23472.44.camel@dagon.hellion.org.uk>
2014-08-05 19:30 ` Wei Liu
[not found] ` <20140805193006.GA5899@zion.uk.xensource.com>
2014-08-21 20:43 ` Ian Campbell
2014-08-06 16:05 ` Jim Fehlig [this message]
2014-09-10 19:48 ` Jim Fehlig
2014-08-05 2:09 Jim Fehlig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E2522D.8010407@suse.com \
--to=jfehlig@suse.com \
--cc=libvir-list@redhat.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).