[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxl: a domain can be dying but not shutdown



The shutdown code is only present if the domain is shutdown.
If we attempt to extract it from the flags from a dying but not
shutdown domain then we get values like '255' which is not a
valid LIBXL_SHUTDOWN_REASON_. We should use LIBXL_SHUTDOWN_UNKNOWN
in this case.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxx>

---

This can be tested by running 2 domUs, and having one map pages from
the other. I used a vchan connection, so I had a vchan_server granting
pages and a vchan_client mapping them. I made sure the client is
never going to unmap the pages (I used 'sleep' in a Mirage kernel but
'xl pause' from outside would probably also work) and then I
'xl destroyed' the server. The server domain ends up stuck in the dying
state because the client still has a page mapped. The server domain
is not shutdown.

According to 'xl list':

djs@st20:~/djs55/list$ sudo xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  5278     6     r-----   10971.2
fedora                                      12  2048     1     -b----    5470.0
(null)                                      21     0     1     -bp--d      25.1
vchan_client                                22   256     1     -b----       0.0

and according to my test program which calls libxl_list_domain:

domain 0 shutdown = 0 dying = 0 shutdown_reason = -1
domain 12 shutdown = 0 dying = 0 shutdown_reason = -1
domain 21 shutdown = 0 dying = 1 shutdown_reason = 255
domain 22 shutdown = 0 dying = 0 shutdown_reason = -1

I believe this also manifests transiently during a normal 'xl destroy'.

Cheers,
Dave
---
 tools/libxl/libxl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 9c72df2..a2a29b1 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -600,7 +600,7 @@ static void xcinfo2xlinfo(libxl_ctx *ctx,
     xlinfo->blocked  = !!(xcinfo->flags&XEN_DOMINF_blocked);
     xlinfo->running  = !!(xcinfo->flags&XEN_DOMINF_running);
 
-    if (xlinfo->shutdown || xlinfo->dying)
+    if (xlinfo->shutdown)
         xlinfo->shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & 
XEN_DOMINF_shutdownmask;
     else
         xlinfo->shutdown_reason = LIBXL_SHUTDOWN_REASON_UNKNOWN;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.