From: Ian Campbell Subject: Re: [PATCH 24/24] libxl: aborting bootloader invocation when domain dioes Date: Tue, 24 Apr 2012 15:18:20 +0100 Message-ID: <1335277100.4347.159.camel@zakaz.uk.xensource.com> References: <1334596686-8479-1-git-send-email-ian.jackson@eu.citrix.com> <1334596686-8479-25-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1334596686-8479-25-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org > diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c > index 991f16e..e43aedc 100644 > --- a/tools/libxl/libxl_event.c > +++ b/tools/libxl/libxl_event.c > @@ -585,6 +585,37 @@ int libxl__ev_devstate_wait(libxl__gc *gc, libxl__ev_devstate *ds, > } > > /* > + * domain death/destruction > + */ > + > +static void domaindeathcheck_callback(libxl__egc *egc, libxl__ev_xswatch *w, > + const char *watch_path, const char *event_path) > +{ > + libxl__domaindeathcheck *dc = CONTAINER_OF(w, *dc, watch); > + EGC_GC; > + const char *p = libxl__xs_read(gc, XBT_NULL, watch_path); > + if (p) return; > + > + if (errno!=ENOENT) { > + LIBXL__EVENT_DISASTER(egc,"failed to read xenstore" > + " for domain deatch check", errno, 0); detach > + return; > + } > + > + LOG(ERROR,"%s: domain %"PRIu32" removed (%s no longer in xenstore)", > + dc->what, dc->domid, watch_path); > + dc->callback(egc, dc); > +} > + > +int libxl__domaindeathcheck_start(libxl__gc *gc, > + libxl__domaindeathcheck *dc) > +{ > + const char *path = GCSPRINTF("/local/domain/%"PRIu32, dc->domid); > + return libxl__ev_xswatch_register(gc, &dc->watch, > + domaindeathcheck_callback, path); So we are watching for the toolstack (possibly the same one as we are running in) to destroy the domain and therefore nuke the xs directory -- does that actually work? Specifically in the case of xl running the bootloader -- is xl in any position to handle a domain death during domain build? Isn't it doing the create synchronously? (note, I'm not actually 100% sure what might be wrong with this, it just strikes me as odd...) Wouldn't using the @releaseDomain watch be more reliable? Ian.