From: Ian Jackson Subject: Re: [PATCH v1 01/10] libxl: libxl-json format and internal functions to get / set it Date: Thu, 24 Jul 2014 19:29:58 +0100 Message-ID: <21457.20646.331945.575724@mariner.uk.xensource.com> References: <1405002745-5034-1-git-send-email-wei.liu2@citrix.com> <1405002745-5034-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1405002745-5034-2-git-send-email-wei.liu2@citrix.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: Wei Liu Cc: ian.campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("[PATCH v1 01/10] libxl: libxl-json format and internal functions to get / set it"): > Introduce a new format in libxl userdata store called "libxl-json". This > file format contains JSON version of libxl_domain_config, generated by > libxl. ... > +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 (len == 0) { > + LOGE(ERROR, "configuration data stream empty for domain %d", domid); > + rc = ERROR_FAIL; Reading 03/10 I notice the following issue with this: During domain setup there is a moment where the domid exists, but the configuration data doesn't. Therefore this is a possible situation, and does not reflect an internal error. So, you need to treat this case differently. It shouldn't log an error and it should probably return a custom error code, which all callers would have to handle specially. Ultimately if an application asks for the configuration of a domain in this state, it is not possible to tell whether it is in the process being created, or is left in an anomalous (crashed) state. So I think this possible but anomalous state needs to be exposed all the way up the stack. Ian.