Skip to contentSkip to conversation

libxl: do not attempt to write "shutdown" dm-command

PATCH In review Ian Jackson 2 participants 3 messages Jan 19, 2011 – Jan 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: do not attempt to write "shutdown" dm-command

libxl_domain_destroy writes the command "shutdown" to the xenstore node with which it communicates with qemu. However:
- qemu does not understand this command and ignores it (printing a message)
- libxl doesn't wait for the answer and immediately pauses the domain anyway
- destroy is the ungraceful (force) operation and should not negotiate with qemu anyway
- even in the graceful shutdown case, there would actually be nothing that qemu needs to do.

Under some circumstances, this entry in xenstore will survive the domain's death, ie be leaked.

So remove the erroneous code.

tools/libxl/libxl.c +0 -5
index 7ffb985..2cc2d21 100644
@@ -682,11 +672,6 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
 
     if (libxl_device_pci_shutdown(ctx, domid) < 0)
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "pci shutdown failed for domid %d", domid);
-    if (dm_present) {
-        xs_write(ctx->xsh, XBT_NULL,
-                 libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
-                 "shutdown", strlen("shutdown"));
-    }
     rc = xc_domain_pause(ctx->xch, domid);
     if (rc < 0) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
#1 lore raw
Quoted 11 lines · Ian Jackson

libxl_domain_destroy writes the command "shutdown" to the xenstore node with which it communicates with qemu. However:
- qemu does not understand this command and ignores it (printing a message)
- libxl doesn't wait for the answer and immediately pauses the domain anyway
- destroy is the ungraceful (force) operation and should not negotiate with qemu anyway
- even in the graceful shutdown case, there would actually be nothing that qemu needs to do.

Quoted 6 lines

Under some circumstances, this entry in xenstore will survive the domain's death, ie be leaked.

So remove the erroneous code.

Makes sense to me:

Acked/Reviewed-by: Ian Campbell <[email protected]>

Quoted 22 lines
tools/libxl/libxl.c +0 -5
index 7ffb985..2cc2d21 100644
@@ -682,11 +672,6 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
 
     if (libxl_device_pci_shutdown(ctx, domid) < 0)
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "pci shutdown failed for domid %d", domid);
-    if (dm_present) {
-        xs_write(ctx->xsh, XBT_NULL,
-                 libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
-                 "shutdown", strlen("shutdown"));
-    }
     rc = xc_domain_pause(ctx->xch, domid);
     if (rc < 0) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Ian Campbell writes ("Re: [Xen-devel] [PATCH] libxl: do not attempt to write "shutdown" dm-command"):

Quoted 3 lines · Ian Jackson
Quoted 2 lines

libxl_domain_destroy writes the command "shutdown" to the xenstore node with which it communicates with qemu. However:

...

Quoted 2 lines

Makes sense to me:
Acked/Reviewed-by: Ian Campbell <[email protected]>

Thanks, I have applied that patch.

Ian.