From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH RFC] improve the error message in "xl list --long" Date: Thu, 17 Oct 2013 17:25:50 +0100 Message-ID: <52600F8E.10400@citrix.com> References: <1382026918-19683-1-git-send-email-bjzhang@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1382026918-19683-1-git-send-email-bjzhang@suse.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: Bamvor Jian Zhang Cc: jfehlig@suse.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 17/10/13 17:21, Bamvor Jian Zhang wrote: > with this patch, xl will raise a proper error when execute "xl list --long" > for existed domain but no domain configuration found. it would encounter > if other toolstack(like libvirt) create the vm, xl could saw the domain > name but could not get the domain configuration. > > there is a commit a76377f1 check the return value of > libxl_read_file_contents in libxl_userdata_retrieve. but skip the ENOENT. > it is almost three years before. i do not know the senario about that > commit. it seems that it is not safe to simplely remove the ENOENT. > > Signed-off-by: Bamvor Jian Zhang > --- > tools/libxl/libxl_dom.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c > index 356f920..8daf51a 100644 > --- a/tools/libxl/libxl_dom.c > +++ b/tools/libxl/libxl_dom.c > @@ -1655,6 +1655,12 @@ int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid, > goto out; > } > > + if (access(filename, F_OK) != 0) { > + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unknown domain configuration. Is domain id '%u' owned by another libxl toolstack?", domid); This line is too long, perhaps putting the start of the string on a new line, and splitting again at the %u so the grepable parts of the string stay contiguous. Finally, "another libxl toolstack" is too specific (XAPI domains being a prime example which would fall over here). I would suggest just "another toolstack". ~Andrew > + rc = ERROR_INVAL; > + goto out; > + } > + > e = libxl_read_file_contents(ctx, filename, data_r ? &data : 0, &datalen); > if (e && errno != ENOENT) { > rc = ERROR_FAIL;