[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.5 1/2] libxl: continue when encounter ERROR_JSON_CONFIG_EMPTY



On Fri, 2014-11-14 at 10:52 +0000, Ian Campbell wrote:
> 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 <wei.liu2@xxxxxxxxxx>
> > Cc: Zhigang Wang <zhigang.x.wang@xxxxxxxxxx>
> 
> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

On second thoughts, I think this really needs an update to libxl.h to
describe the semantics of this function, i.e. to what extent the output
is valid for various error codes, especially ERROR_JSON_CONFIG_EMPTY.

> 
> > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > ---
> >  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;
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.