From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH for-4.5 1/2] libxl: continue when encounter ERROR_JSON_CONFIG_EMPTY Date: Fri, 14 Nov 2014 10:52:52 +0000 Message-ID: <1415962372.7113.2.camel@citrix.com> References: <1415811865-19981-1-git-send-email-wei.liu2@citrix.com> <1415811865-19981-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: <1415811865-19981-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: zhigang.x.wang@oracle.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2014-11-12 at 17:04 +0000, Wei Liu wrote: > Continue when libxl_retrieve_domain_configuration encounters > ERROR_JSON_CONFIG_EMPTY, as caller might be interested in the partial > configuration pulled from xenstore. In this case > ERROR_JSON_CONFIG_EMPTY is used as return value as before, if no other > error happens along the way. > > Signed-off-by: Wei Liu > Cc: Zhigang Wang Acked-by: Ian Campbell > Cc: Ian Jackson > --- > tools/libxl/libxl.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index f7961f6..f54e0ea 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -6521,6 +6521,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, > GC_INIT(ctx); > int rc; > libxl__domain_userdata_lock *lock = NULL; > + bool json_empty = false; > > CTX_LOCK; > > @@ -6531,11 +6532,12 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, > } > > rc = libxl__get_domain_configuration(gc, domid, d_config); > - if (rc) { > + if (rc && rc != ERROR_JSON_CONFIG_EMPTY) { > LOG(ERROR, "fail to get domain configuration for domain %d", domid); > rc = ERROR_FAIL; > goto out; > } > + if (rc == ERROR_JSON_CONFIG_EMPTY) json_empty = true; > > /* Domain name */ > { > @@ -6692,6 +6694,8 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, > > #undef MERGE > > + rc = json_empty ? ERROR_JSON_CONFIG_EMPTY : 0; > + > out: > if (lock) libxl__unlock_domain_userdata(lock); > CTX_UNLOCK;