[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl/xl: correctly report domain state
On Fri, 2010-07-23 at 13:18 +0100, Stefano Stabellini wrote: > On Fri, 23 Jul 2010, Ian Campbell wrote: > > # HG changeset patch > > # User Ian Campbell <ian.campbell@xxxxxxxxxx> > > # Date 1279881736 -3600 > > # Node ID 006ec67363ab2651d712f9e3f0f48bf1d408396a > > # Parent b880a9fc98d14aad8464fb1a5c690f6b4bc14e03 > > libxl/xl: correctly report domain state. > > > > In particular distinguish between domain shutdown and crash and the > > blocked and running states. > > > > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> > > > > diff -r b880a9fc98d1 -r 006ec67363ab tools/libxl/libxl.c > > --- a/tools/libxl/libxl.c Thu Jul 22 17:32:08 2010 +0100 > > +++ b/tools/libxl/libxl.c Fri Jul 23 11:42:16 2010 +0100 > > @@ -403,17 +403,26 @@ int libxl_domain_resume(struct libxl_ctx > > } > > > > static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo, > > - struct libxl_dominfo *xlinfo) { > > + struct libxl_dominfo *xlinfo) > > +{ > > + unsigned int shutdown_reason; > > + > > memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t)); > > xlinfo->domid = xcinfo->domain; > > > > - if (xcinfo->flags & XEN_DOMINF_dying) > > - xlinfo->dying = 1; > > - else if (xcinfo->flags & XEN_DOMINF_paused) > > - xlinfo->paused = 1; > > - else if (xcinfo->flags & XEN_DOMINF_blocked || > > - xcinfo->flags & XEN_DOMINF_running) > > - xlinfo->running = 1; > > + xlinfo->dying = !!(xcinfo->flags&XEN_DOMINF_dying); > > + xlinfo->shutdown = !!(xcinfo->flags&XEN_DOMINF_shutdown); > > + xlinfo->paused = !!(xcinfo->flags&XEN_DOMINF_paused); > > + xlinfo->blocked = !!(xcinfo->flags&XEN_DOMINF_blocked); > > + xlinfo->running = !!(xcinfo->flags&XEN_DOMINF_running); > > + > > + shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & > > XEN_DOMINF_shutdownmask; > > + > > + if ( xlinfo->shutdown && (shutdown_reason == SHUTDOWN_crash) ) { > > + xlinfo->shutdown = 0; > > + xlinfo->crashed = 1; > > + } > > + > > xlinfo->crashed should be set to 0 in the other cases. Oh yes, missed that. Will resend. > I also think that it might be worth having an enum in xlinfo to specify > the shutdown reason (that might be other than crash, for example > SHUTDOWN_suspend). > This way we would be able to use an xlinfo in > libxl_event_get_domain_death_info (see xl_cmdimpl.c:1346). I'm adding support for on_{poweroff,reboot,crash} in xl configuration files so I'll look into this possibility at the same time. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |