From: Wei Liu Subject: [PATCH for-4.5 1/2] libxl: continue when encounter ERROR_JSON_CONFIG_EMPTY Date: Wed, 12 Nov 2014 17:04:24 +0000 Message-ID: <1415811865-19981-2-git-send-email-wei.liu2@citrix.com> References: <1415811865-19981-1-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-1-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: xen-devel@lists.xen.org Cc: Wei Liu , zhigang.x.wang@oracle.com, ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org 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 Cc: 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; -- 1.7.10.4