From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH v1 01/10] libxl: libxl-json format and internal functions to get / set it Date: Wed, 16 Jul 2014 17:44:02 +0100 Message-ID: <20140716164401.GA4913@zion.uk.xensource.com> References: <1405002745-5034-1-git-send-email-wei.liu2@citrix.com> <1405002745-5034-2-git-send-email-wei.liu2@citrix.com> <1405527082.1087.54.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1405527082.1087.54.camel@kazak.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 Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Jul 16, 2014 at 05:11:22PM +0100, Ian Campbell wrote: > On Thu, 2014-07-10 at 15:32 +0100, Wei Liu wrote: > > > diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c > > index 81f8985..dc47177 100644 > > --- a/tools/libxl/libxl_internal.c > > +++ b/tools/libxl/libxl_internal.c > > @@ -381,6 +381,62 @@ out: > > return rc; > > } > > > > +int libxl__get_domain_configuration(libxl__gc *gc, uint32_t domid, > > + libxl_domain_config *d_config) > > +{ > > + uint8_t *data = NULL; > > + int rc, len; > > + > > + rc = libxl_userdata_retrieve(CTX, domid, "libxl-json", &data, &len); > > + if (rc) { > > + LOGEV(ERROR, rc, > > + "failed to retrieve domain configuration for domain %d", domid); > > + rc = ERROR_FAIL; > > rc here is already a valid libxl ERROR_* here, isn't it? No need to > override in that case. You have this several times in this series.. > OK. > > + goto out; > > + } > > + > > + if (len == 0) { > > + LOGE(ERROR, "configuration data stream empty for domain %d", domid); > > + rc = ERROR_FAIL; > > This one on the other hand does need setting explicitly. > > How could this happen though? Ian J is in favour of adding more error The file is accidently overwritten, failure on last write etc. Bad things happen. > codes instead of constantly reusing ERROR_FAIL. Here it would seem that > depending on whether/how this is supposed to happen either a > ERROR_INTERNAL_MELTDOWN (i.e. everythig has gone wrong) ish thing or > ERROR_NO_DOMAIN_CONFIG would be appropriate. > OK. Will figure out a new error code. Wei. > Ian.