Ian Campbell
2010-Jul-22 16:10 UTC
[Xen-devel] [PATCH] libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1279814977 -3600 # Node ID 469eca1ced73d737ef76de6293c2cedaa3ed5b3b # Parent 4514d5890692989aa78c54a1a283d1b3bcc6fe46 libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths On domain destroy libxl currently tries to find the /vm/<uuid> and /vss/<uuid> paths by reading /local/domain/<domid>/{vm,vss} but does so after removing /local/domain/<domid> which isn''t much use. Also construct the xenstore path in destroy the same way as in create. It''s not wrong but I had to look twice to check they were doing the same thing. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 4514d5890692 -r 469eca1ced73 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Fri Jul 16 17:44:04 2010 +0100 +++ b/tools/libxl/libxl.c Thu Jul 22 17:09:37 2010 +0100 @@ -767,18 +767,19 @@ int libxl_domain_destroy(struct libxl_ct } if (libxl_devices_destroy(ctx, domid, force) < 0) XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid); - if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); - vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vm", domid)); + vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vss", dom_path)); if (vm_path) if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path); - vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vss", domid)); + vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vss", dom_path)); if (vss_path) if (!xs_rm(ctx->xsh, XBT_NULL, vss_path)) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path); + + if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); xapi_path = libxl_sprintf(ctx, "/xapi/%u", domid); if (xapi_path) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2010-Jul-22 16:16 UTC
[Xen-devel] Re: [PATCH] libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths
On Thu, 2010-07-22 at 17:10 +0100, Ian Campbell wrote:> # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1279814977 -3600 > # Node ID 469eca1ced73d737ef76de6293c2cedaa3ed5b3b > # Parent 4514d5890692989aa78c54a1a283d1b3bcc6fe46 > libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths > > On domain destroy libxl currently tries to find the /vm/<uuid> and > /vss/<uuid> paths by reading /local/domain/<domid>/{vm,vss} but does > so after removing /local/domain/<domid> which isn''t much use. > > Also construct the xenstore path in destroy the same way as in create. It''s not > wrong but I had to look twice to check they were doing the same thing. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > > diff -r 4514d5890692 -r 469eca1ced73 tools/libxl/libxl.c > --- a/tools/libxl/libxl.c Fri Jul 16 17:44:04 2010 +0100 > +++ b/tools/libxl/libxl.c Thu Jul 22 17:09:37 2010 +0100 > @@ -767,18 +767,19 @@ int libxl_domain_destroy(struct libxl_ct > } > if (libxl_devices_destroy(ctx, domid, force) < 0) > XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid); > - if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) > - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); > > - vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vm", domid)); > + vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vss", dom_path));^^^ typo, will resend Ian.> if (vm_path) > if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) > XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path); > > - vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vss", domid)); > + vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vss", dom_path)); > if (vss_path) > if (!xs_rm(ctx->xsh, XBT_NULL, vss_path)) > XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path); > + > + if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) > + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); > > xapi_path = libxl_sprintf(ctx, "/xapi/%u", domid); > if (xapi_path)_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2010-Jul-22 16:18 UTC
[Xen-devel] [PATCH] libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1279815420 -3600 # Node ID d2f2da6ca3ed462db6f5040854c6cc50d571bfc4 # Parent 4514d5890692989aa78c54a1a283d1b3bcc6fe46 libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths On domain destroy libxl currently tries to find the /vm/<uuid> and /vss/<uuid> paths by reading /local/domain/<domid>/{vm,vss} but does so after removing /local/domain/<domid> which isn''t much use. Also construct the xenstore path in destroy the same way as in create. It''s not wrong but I had to look twice to check they were doing the same thing. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 4514d5890692 -r d2f2da6ca3ed tools/libxl/libxl.c --- a/tools/libxl/libxl.c Fri Jul 16 17:44:04 2010 +0100 +++ b/tools/libxl/libxl.c Thu Jul 22 17:17:00 2010 +0100 @@ -767,18 +767,19 @@ int libxl_domain_destroy(struct libxl_ct } if (libxl_devices_destroy(ctx, domid, force) < 0) XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid); - if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); - vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vm", domid)); + vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vm", dom_path)); if (vm_path) if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path); - vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vss", domid)); + vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vss", dom_path)); if (vss_path) if (!xs_rm(ctx->xsh, XBT_NULL, vss_path)) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path); + + if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); xapi_path = libxl_sprintf(ctx, "/xapi/%u", domid); if (xapi_path) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2010-Jul-23 12:21 UTC
Re: [Xen-devel] [PATCH] libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths
On Thu, 22 Jul 2010, Ian Campbell wrote:> # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1279815420 -3600 > # Node ID d2f2da6ca3ed462db6f5040854c6cc50d571bfc4 > # Parent 4514d5890692989aa78c54a1a283d1b3bcc6fe46 > libxl: remove xenstore /local/domain/<domid> after reading /vm and /vss paths > > On domain destroy libxl currently tries to find the /vm/<uuid> and > /vss/<uuid> paths by reading /local/domain/<domid>/{vm,vss} but does > so after removing /local/domain/<domid> which isn''t much use. > > Also construct the xenstore path in destroy the same way as in create. It''s not > wrong but I had to look twice to check they were doing the same thing. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> >Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel