ia64/xen-unstable

changeset 17733:57923ddaacb9

Fix domain names that xentop shows

When I changed the name of a domain by using xm rename command, the
name of the domain that xentop shows did not change. This patch
reflects new domain name to the name of domains that xentop shows.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon May 26 08:37:43 2008 +0100 (2008-05-26)
parents 3544f12d22b2
children 14f03101b61c
files tools/xenstat/libxenstat/src/xenstat.c
line diff
     1.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Mon May 26 08:27:19 2008 +0100
     1.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Mon May 26 08:37:43 2008 +0100
     1.3 @@ -655,12 +655,20 @@ unsigned long long xenstat_vbd_wr_reqs(x
     1.4  
     1.5  static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int domain_id)
     1.6  {
     1.7 -	char path[80];
     1.8 +	char path[80], *vmpath;
     1.9 +
    1.10 +	snprintf(path, sizeof(path),"/local/domain/%i/vm", domain_id);
    1.11 +
    1.12 +	vmpath = xs_read(handle->xshandle, XBT_NULL, path, NULL);
    1.13  
    1.14 -	snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id);
    1.15 -	
    1.16 +	if (vmpath == NULL)
    1.17 +		return NULL;
    1.18 +
    1.19 +	snprintf(path, sizeof(path),"%s/name", vmpath);
    1.20 +	free(vmpath);
    1.21 +
    1.22  	return xs_read(handle->xshandle, XBT_NULL, path, NULL);
    1.23 -}	
    1.24 +}
    1.25  
    1.26  /* Remove specified entry from list of domains */
    1.27  static void xenstat_prune_domain(xenstat_node *node, unsigned int entry)