* [PATCH] libxl/xl: correctly report domain state
@ 2010-07-23 10:43 Ian Campbell
2010-07-23 11:02 ` Vincent Hanquez
2010-07-23 12:18 ` Stefano Stabellini
0 siblings, 2 replies; 7+ messages in thread
From: Ian Campbell @ 2010-07-23 10:43 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# 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@citrix.com>
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->max_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
xlinfo->cpu_time = xcinfo->cpu_time;
xlinfo->vcpu_max_id = xcinfo->max_vcpu_id;
diff -r b880a9fc98d1 -r 006ec67363ab tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Thu Jul 22 17:32:08 2010 +0100
+++ b/tools/libxl/libxl.h Fri Jul 23 11:42:16 2010 +0100
@@ -25,9 +25,12 @@ struct libxl_dominfo {
struct libxl_dominfo {
uint8_t uuid[16];
uint32_t domid;
+ uint8_t running:1;
+ uint8_t blocked:1;
+ uint8_t paused:1;
+ uint8_t shutdown:1;
+ uint8_t crashed:1;
uint8_t dying:1;
- uint8_t paused:1;
- uint8_t running:1;
uint64_t max_memkb;
uint64_t cpu_time;
uint32_t vcpu_max_id;
diff -r b880a9fc98d1 -r 006ec67363ab tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Thu Jul 22 17:32:08 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c Fri Jul 23 11:42:16 2010 +0100
@@ -1872,13 +1872,16 @@ void list_domains(int verbose)
}
printf("Name ID Mem VCPUs\tState\tTime(s)\n");
for (i = 0; i < nb_domain; i++) {
- printf("%-40s %5d %5lu %5d %c%c%c %8.1f",
+ printf("%-40s %5d %5lu %5d %c%c%c%c%c%c %8.1f",
libxl_domid_to_name(&ctx, info[i].domid),
info[i].domid,
(unsigned long) (info[i].max_memkb / 1024),
info[i].vcpu_online,
info[i].running ? 'r' : '-',
+ info[i].blocked ? 'b' : '-',
info[i].paused ? 'p' : '-',
+ info[i].shutdown ? 's' : '-',
+ info[i].crashed ? 'c' : '-',
info[i].dying ? 'd' : '-',
((float)info[i].cpu_time / 1e9));
if (verbose) {
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] libxl/xl: correctly report domain state
2010-07-23 10:43 [PATCH] libxl/xl: correctly report domain state Ian Campbell
@ 2010-07-23 11:02 ` Vincent Hanquez
2010-07-23 11:43 ` Ian Campbell
2010-07-23 12:18 ` Stefano Stabellini
1 sibling, 1 reply; 7+ messages in thread
From: Vincent Hanquez @ 2010-07-23 11:02 UTC (permalink / raw)
To: Ian Campbell; +Cc: Ian Campbell, xen-devel@lists.xensource.com
On 23/07/10 11:43, Ian Campbell wrote:
> # HG changeset patch
> # User Ian Campbell<ian.campbell@citrix.com>
> # 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.
>
From a toolstack and user point of view, a blocked state doesn't make
sense.
it's only a debugging field for developer.
--
Vincent
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] libxl/xl: correctly report domain state
2010-07-23 11:02 ` Vincent Hanquez
@ 2010-07-23 11:43 ` Ian Campbell
0 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2010-07-23 11:43 UTC (permalink / raw)
To: Vincent Hanquez; +Cc: xen-devel
On Fri, 2010-07-23 at 12:02 +0100, Vincent Hanquez wrote:
> On 23/07/10 11:43, Ian Campbell wrote:
> > # HG changeset patch
> > # User Ian Campbell<ian.campbell@citrix.com>
> > # 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.
> >
> From a toolstack and user point of view, a blocked state doesn't make
> sense.
> it's only a debugging field for developer.
Which is why it is useful to have it in xl list.
Ian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] libxl/xl: correctly report domain state
2010-07-23 10:43 [PATCH] libxl/xl: correctly report domain state Ian Campbell
2010-07-23 11:02 ` Vincent Hanquez
@ 2010-07-23 12:18 ` Stefano Stabellini
2010-07-23 12:21 ` Ian Campbell
1 sibling, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2010-07-23 12:18 UTC (permalink / raw)
To: Ian Campbell; +Cc: Ian, Campbell, xen-devel@lists.xensource.com
On Fri, 23 Jul 2010, Ian Campbell wrote:
> # HG changeset patch
> # User Ian Campbell <ian.campbell@citrix.com>
> # 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@citrix.com>
>
> 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.
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).
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] libxl/xl: correctly report domain state
2010-07-23 12:18 ` Stefano Stabellini
@ 2010-07-23 12:21 ` Ian Campbell
0 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2010-07-23 12:21 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: xen-devel
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@citrix.com>
> > # 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@citrix.com>
> >
> > 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] libxl/xl: correctly report domain state
@ 2010-07-23 12:27 Ian Campbell
2010-07-23 12:34 ` Stefano Stabellini
0 siblings, 1 reply; 7+ messages in thread
From: Ian Campbell @ 2010-07-23 12:27 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1279888063 -3600
# Node ID 0b66e68f4e580a3ad60d1173c73cd343a90f536f
# 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@citrix.com>
diff -r b880a9fc98d1 -r 0b66e68f4e58 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 13:27:43 2010 +0100
@@ -403,17 +403,27 @@ 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);
+ xlinfo->crashed = 0;
+
+ shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
+
+ if ( xlinfo->shutdown && (shutdown_reason == SHUTDOWN_crash) ) {
+ xlinfo->shutdown = 0;
+ xlinfo->crashed = 1;
+ }
+
xlinfo->max_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
xlinfo->cpu_time = xcinfo->cpu_time;
xlinfo->vcpu_max_id = xcinfo->max_vcpu_id;
diff -r b880a9fc98d1 -r 0b66e68f4e58 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Thu Jul 22 17:32:08 2010 +0100
+++ b/tools/libxl/libxl.h Fri Jul 23 13:27:43 2010 +0100
@@ -25,9 +25,12 @@ struct libxl_dominfo {
struct libxl_dominfo {
uint8_t uuid[16];
uint32_t domid;
+ uint8_t running:1;
+ uint8_t blocked:1;
+ uint8_t paused:1;
+ uint8_t shutdown:1;
+ uint8_t crashed:1;
uint8_t dying:1;
- uint8_t paused:1;
- uint8_t running:1;
uint64_t max_memkb;
uint64_t cpu_time;
uint32_t vcpu_max_id;
diff -r b880a9fc98d1 -r 0b66e68f4e58 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Thu Jul 22 17:32:08 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c Fri Jul 23 13:27:43 2010 +0100
@@ -1872,13 +1872,16 @@ void list_domains(int verbose)
}
printf("Name ID Mem VCPUs\tState\tTime(s)\n");
for (i = 0; i < nb_domain; i++) {
- printf("%-40s %5d %5lu %5d %c%c%c %8.1f",
+ printf("%-40s %5d %5lu %5d %c%c%c%c%c%c %8.1f",
libxl_domid_to_name(&ctx, info[i].domid),
info[i].domid,
(unsigned long) (info[i].max_memkb / 1024),
info[i].vcpu_online,
info[i].running ? 'r' : '-',
+ info[i].blocked ? 'b' : '-',
info[i].paused ? 'p' : '-',
+ info[i].shutdown ? 's' : '-',
+ info[i].crashed ? 'c' : '-',
info[i].dying ? 'd' : '-',
((float)info[i].cpu_time / 1e9));
if (verbose) {
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] libxl/xl: correctly report domain state
2010-07-23 12:27 Ian Campbell
@ 2010-07-23 12:34 ` Stefano Stabellini
0 siblings, 0 replies; 7+ messages in thread
From: Stefano Stabellini @ 2010-07-23 12:34 UTC (permalink / raw)
To: Ian Campbell; +Cc: Ian, Campbell, xen-devel@lists.xensource.com
On Fri, 23 Jul 2010, Ian Campbell wrote:
> # HG changeset patch
> # User Ian Campbell <ian.campbell@citrix.com>
> # Date 1279888063 -3600
> # Node ID 0b66e68f4e580a3ad60d1173c73cd343a90f536f
> # 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@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-07-23 12:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23 10:43 [PATCH] libxl/xl: correctly report domain state Ian Campbell
2010-07-23 11:02 ` Vincent Hanquez
2010-07-23 11:43 ` Ian Campbell
2010-07-23 12:18 ` Stefano Stabellini
2010-07-23 12:21 ` Ian Campbell
-- strict thread matches above, loose matches on Subject: below --
2010-07-23 12:27 Ian Campbell
2010-07-23 12:34 ` Stefano Stabellini
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.