[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] fix list_domain_details: check config data length=0
commit ef8cf0d4902c90595a0b0766e2a9a6ecbcbc4581 Author: Chunyan Liu <cyliu@xxxxxxxx> AuthorDate: Wed Jul 23 17:42:09 2014 +0800 Commit: Ian Campbell <ian.campbell@xxxxxxxxxx> CommitDate: Thu Jul 24 16:23:19 2014 +0100 fix list_domain_details: check config data length=0 If domain is created through virsh, then in xl, one could see it with 'xl list', but with 'xl list --long domU', it reports: "Domain name must be specified." The reason is xl config data does not exist but it still tries to parse_config_data in current code. Improve list_domain_details: If len of config data is 0, just pass, do not go forward to parse_config_data, otherwise, it will meet error like "Domain name not specified" and exit. This error is not expected, since if code enters list_domain_details, domain name validness is already checked and domain does exist. Length of config data is 0 may means: config data does not exist due to some reason, like: domain is created by libvirt, or in destroying domain process config data is cleared but domain fails to clean up. No matter in which case, list_domain_details could just show empty info, but not error like "Domain name not specified". Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 68df548..01bce2f 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3100,6 +3100,8 @@ static void list_domains_details(const libxl_dominfo *info, int nb_domain) rc = libxl_userdata_retrieve(ctx, info[i].domid, "xl", &data, &len); if (rc) continue; + if (len == 0) + continue; CHK_SYSCALL(asprintf(&config_source, "<domid %d data>", info[i].domid)); libxl_domain_config_init(&d_config); parse_config_data(config_source, (char *)data, len, &d_config); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |