From: Martin Kletzander <mkletzan@redhat.com>
To: Jim Fehlig <jfehlig@suse.com>
Cc: libvir-list@redhat.com, xen-devel@lists.xen.org
Subject: Re: [libvirt] [PATCH 1/3] libxl: Move job acquisition in libxlDomainStart to callers
Date: Wed, 1 Apr 2015 11:55:01 +0200 [thread overview]
Message-ID: <20150401095501.GB30610@wheatley> (raw)
In-Reply-To: <1427314116-14451-2-git-send-email-jfehlig@suse.com>
[-- Attachment #1.1: Type: text/plain, Size: 3006 bytes --]
On Wed, Mar 25, 2015 at 02:08:34PM -0600, Jim Fehlig wrote:
>Let callers of libxlDomainStart decide when it is appropriate to
>acquire a job on the associated virDomainObj.
>
This makes sense, I see many bugs this fixes, but how come
libxlDomainShutdownThread(), libxlDomainRestoreFlags() and
libxlDoMigrateReceive() don't need to start the job when they all call
libxlDomainStart()?
>Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>---
> src/libxl/libxl_domain.c | 24 ++++++++--------------
> src/libxl/libxl_driver.c | 53 +++++++++++++++++++++++++++++++++++++++---------
> 2 files changed, 52 insertions(+), 25 deletions(-)
>
>diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>index 05f6eb1..da4c1c7 100644
>--- a/src/libxl/libxl_driver.c
>+++ b/src/libxl/libxl_driver.c
>@@ -885,17 +893,26 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
> goto cleanup;
> def = NULL;
>
>+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) {
>+ virDomainObjListRemove(driver->domains, vm);
>+ vm = NULL;
>+ goto cleanup;
>+ }
>+
This should be acquired before virDomainObjListAdd() since you need to
check whether it's active after creating the job. If I'm wrong, then
virDomainObjListRemove() should be only called if the vm is not
persistent (as CreateXML can be called on persistent ones as well),
shouldn't it?
[...]
>@@ -1695,11 +1712,20 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
>
> def = NULL;
>
>+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) {
>+ if (!vm->persistent) {
>+ virDomainObjListRemove(driver->domains, vm);
>+ vm = NULL;
>+ }
>+ goto cleanup;
>+ }
>+
Same here, I guess.
> ret = libxlDomainStart(driver, vm, (flags & VIR_DOMAIN_SAVE_PAUSED) != 0, fd);
>- if (ret < 0 && !vm->persistent) {
>+ if (ret < 0 && !vm->persistent)
> virDomainObjListRemove(driver->domains, vm);
>+
>+ if (!libxlDomainObjEndJob(driver, vm))
> vm = NULL;
>- }
>
> cleanup:
> if (VIR_CLOSE(fd) < 0)
>@@ -2567,17 +2593,24 @@ libxlDomainCreateWithFlags(virDomainPtr dom,
> if (virDomainCreateWithFlagsEnsureACL(dom->conn, vm->def) < 0)
> goto cleanup;
>
>+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
>+ goto cleanup;
>+
> if (virDomainObjIsActive(vm)) {
> virReportError(VIR_ERR_OPERATION_INVALID,
> "%s", _("Domain is already running"));
>- goto cleanup;
>+ goto endjob;
> }
>
> ret = libxlDomainStart(driver, vm, (flags & VIR_DOMAIN_START_PAUSED) != 0, -1);
> if (ret < 0)
>- goto cleanup;
>+ goto endjob;
> dom->id = vm->def->id;
>
>+ endjob:
>+ if (!libxlDomainObjEndJob(driver, vm))
>+ vm = NULL;
>+
> cleanup:
> if (vm)
> virObjectUnlock(vm);
>--
>1.8.4.5
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-04-01 9:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1427314116-14451-1-git-send-email-jfehlig@suse.com>
2015-03-25 20:08 ` [PATCH 1/3] libxl: Move job acquisition in libxlDomainStart to callers Jim Fehlig
2015-04-01 9:55 ` Martin Kletzander [this message]
2015-04-01 17:29 ` [libvirt] " Jim Fehlig
2015-03-25 20:08 ` [PATCH 2/3] libxl: acquire a job when destroying a domain Jim Fehlig
2015-03-25 20:08 ` [PATCH 3/3] libxl: drop virDomainObj lock " Jim Fehlig
2015-03-26 15:14 ` Ian Campbell
[not found] ` <1427382869.13935.61.camel@citrix.com>
2015-03-26 23:16 ` Jim Fehlig
[not found] ` <1427314116-14451-3-git-send-email-jfehlig@suse.com>
2015-03-26 1:32 ` [PATCH 2/3] libxl: acquire a job " Konrad Rzeszutek Wilk
[not found] ` <20150326013242.GA8605@konrad-lan.dumpdata.com>
2015-03-26 21:29 ` Jim Fehlig
[not found] ` <55147A4F.2000903@suse.com>
2015-04-01 10:12 ` [libvirt] " Martin Kletzander
[not found] ` <20150401101205.GC30610@wheatley>
2015-04-01 21:37 ` Jim Fehlig
2015-03-27 18:16 ` [PATCH 0/3] libxl: domain destroy fixes Konrad Rzeszutek Wilk
2015-03-27 18:34 ` Jim Fehlig
[not found] ` <5515A29C.5040802@suse.com>
2015-03-30 19:13 ` Jim Fehlig
2015-03-30 14:00 ` Anthony PERARD
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=20150401095501.GB30610@wheatley \
--to=mkletzan@redhat.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.