From: Ian Campbell Subject: Re: [PATCH v2] fix rename: xenstore not fully updated Date: Tue, 18 Nov 2014 15:00:01 +0000 Message-ID: <1416322801.17982.19.camel@citrix.com> References: <1416285270-14768-1-git-send-email-cyliu@suse.com> <21611.23652.147967.731409@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21611.23652.147967.731409@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: wei.liu2@citrix.com, Chunyan Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2014-11-18 at 14:49 +0000, Ian Jackson wrote: > Chunyan Liu writes ("[PATCH v2] fix rename: xenstore not fully updated"): > > Currently libxl__domain_rename only update /local/domain//name, > > still some places in xenstore are not updated, including: > > /vm//name and /local/domain/0/backend///.../domain. > > Thanks. The principle is correct now and so is the broad approach. > > > This patch updates /vm//name in xenstore, and removes the unusual > > 'domain' field under backend directory (the affected are backend/console, > > backend/vfb, backend/vkb). > > I think this should be a separate patch. > > > Signed-off-by: Chunyan Liu > > --- > > 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, > > + /* update /vm//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; > > + } > > I don't think you need to log here since libxl_domain_info already > does so. Likewise libxl__xs_write_checked. But before deleting this, > please let's wait and see whether Wei and Ian C agree. I'm all for removing redundant logging. Ian > > If you do want to add logging here, it's probably better to use use > LOG rather than LIBXL__LOG. > > > + 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; > > I don't think it is necessary to LIBXL__LOG here, since > libxl__xs_write_checked does so. (See the doc comment in > libxl_internal.h.) > > Thanks, > Ian.