[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2] fix rename: xenstore not fully updated
Currently libxl__domain_rename only update /local/domain/<domid>/name, still some places in xenstore are not updated, including: /vm/<uuid>/name and /local/domain/0/backend/<device>/<domid>/.../domain. This patch updates /vm/<uuid>/name in xenstore, and removes the unusual 'domain' field under backend directory (the affected are backend/console, backend/vfb, backend/vkb). Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> --- Changes: * remove unusual 'domain' field from backend dir * get uuid from hypervisor rather then from xenstore tools/libxl/libxl.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index f7961f6..197433c 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -359,6 +359,9 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, uint32_t stub_dm_domid; const char *stub_dm_old_name = NULL, *stub_dm_new_name = NULL; int rc; + libxl_dominfo info; + char *uuid; + const char *vm_name_path; dom_path = libxl__xs_get_dompath(gc, domid); if (!dom_path) goto x_nomem; @@ -429,6 +432,21 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, goto x_fail; } + /* update /vm/<uuid>/name */ + rc = libxl_domain_info(ctx, &info, domid); + if (rc) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "fail to get domain info for domain %d", domid); + goto x_fail; + } + uuid = GCSPRINTF(LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid)); + vm_name_path = GCSPRINTF("/vm/%s/name", uuid); + if (libxl__xs_write_checked(gc, trans, vm_name_path, new_name)) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "failed to write new name `%s'" + " to %s", new_name, vm_name_path); + goto x_fail; + } + if (stub_dm_domid) { rc = libxl__domain_rename(gc, stub_dm_domid, stub_dm_old_name, @@ -3605,8 +3623,6 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, flexarray_append(back, "1"); flexarray_append(back, "state"); flexarray_append(back, libxl__sprintf(gc, "%d", 1)); - flexarray_append(back, "domain"); - flexarray_append(back, libxl__domid_to_name(gc, domid)); flexarray_append(back, "protocol"); flexarray_append(back, LIBXL_XENCONSOLE_PROTOCOL); @@ -3943,8 +3959,6 @@ int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid, flexarray_append(back, "1"); flexarray_append(back, "state"); flexarray_append(back, libxl__sprintf(gc, "%d", 1)); - flexarray_append(back, "domain"); - flexarray_append(back, libxl__domid_to_name(gc, domid)); flexarray_append(front, "backend-id"); flexarray_append(front, libxl__sprintf(gc, "%d", vkb->backend_domid)); @@ -4041,7 +4055,6 @@ int libxl__device_vfb_add(libxl__gc *gc, uint32_t domid, libxl_device_vfb *vfb) flexarray_append_pair(back, "frontend-id", libxl__sprintf(gc, "%d", domid)); flexarray_append_pair(back, "online", "1"); flexarray_append_pair(back, "state", libxl__sprintf(gc, "%d", 1)); - flexarray_append_pair(back, "domain", libxl__domid_to_name(gc, domid)); flexarray_append_pair(back, "vnc", libxl_defbool_val(vfb->vnc.enable) ? "1" : "0"); flexarray_append_pair(back, "vnclisten", vfb->vnc.listen); -- 1.8.4.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |