libxl: fix dm destruction when there is no pid
PATCH 1/1 libxl: fix dm destruction when there is no pid
Fix qemu dm model destruction if the pid in xenstore is 0 (or is not present).
--- tools/libxl/libxl_dm.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +7 -2
@@ -1081,6 +1081,11 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) pid =libxl__xs_read (gc,XBT_NULL ,libxl__sprintf (gc,"/local/domain/%d/image/device-model-pid" , domid));if (!pid) { +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Couldn't find device model's pid" ); + ret =ERROR_INVAL ; + goto out; + } +if (!atoi (pid)) {int stubdomid =libxl_get_stubdom_id (ctx, domid);const char *savefile;
@@ -1122,10 +1127,10 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) goto out; } } -xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/0/device-model/%d" , domid)); -xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/%d/hvmloader" , domid)); out: +xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/0/device-model/%d" , domid)); +xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/%d/hvmloader" , domid));return ret; }
Signature · 1 line
1.7.7.5 (Apple Git-26)
Roger Pau Monne writes ("[Xen-devel] [PATCH] libxl: fix dm destruction when there is no pid"):
Quoted 2 lines
Fix qemu dm model destruction if the pid in xenstore is 0 (or is not present).
Firstly, this needs rewrapping.
Secondly,
tools/libxl/libxl_dm.c int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) · line 1089
Quoted 8 lines
pid = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/%d/image/device-model-pid", domid)); if (!pid) {tools/libxl/libxl_dm.c +5
-0+LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Couldn't find device model's pid" ); + ret =ERROR_INVAL ; + goto out; + } +if (!atoi (pid)) {int stubdomid =libxl_get_stubdom_id (ctx, domid);
This seems to change the logic regarding stubdoms. Are you sure this is correct ? Previously if the entry didn't exist, we took the stubdom path.
tools/libxl/libxl_dm.c int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) · line 1133
Quoted 6 lines
tools/libxl/libxl_dm.c +2
-2-xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/0/device-model/%d" , domid)); -xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/%d/hvmloader" , domid)); out: +xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/0/device-model/%d" , domid)); +xs_rm (ctx->xsh,XBT_NULL ,libxl__sprintf (gc,"/local/domain/%d/hvmloader" , domid));
While moving this, you might as well rewrap it (or use GCSPRINTF).
Ian.