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

Re: [Xen-devel] [PATCH v2 03/13] libxl: provide a function to retrieve the xenstore domain id



On 18/12/15 14:53, Andrew Cooper wrote:
> On 18/12/15 13:14, Juergen Gross wrote:
>> Add libxl_xenstore_domid() to obtain the domain id of the xenstore
>> domain.
>>
>> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> 
> What are the expected semantics here? Would you expect it to return
> domid 0 for a traditional setup, or are you wanting to use it as a "does
> a xenstored domain exist" test?

The latter. It will be used in patch 13 to decide which domain to
stop via "xl shutdown --all".

> 
>> ---
>>  tools/libxl/libxl.c | 24 ++++++++++++++++++++++++
>>  tools/libxl/libxl.h | 11 +++++++++++
>>  2 files changed, 35 insertions(+)
>>
>> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
>> index 9207621..3bcff59 100644
>> --- a/tools/libxl/libxl.c
>> +++ b/tools/libxl/libxl.c
>> @@ -701,6 +701,30 @@ int libxl_domain_info(libxl_ctx *ctx, libxl_dominfo 
>> *info_r,
>>      return 0;
>>  }
>>  
>> +int libxl_xenstore_domid(libxl_ctx *ctx, uint32_t *domid)
>> +{
>> +    xc_dominfo_t info;
>> +    uint32_t last_domid;
>> +    int ret;
>> +    GC_INIT(ctx);
>> +
>> +    for (last_domid = 0;
>> +         (ret = xc_domain_getinfo(ctx->xch, last_domid, 1, &info)) == 1;
>> +         last_domid = info.domid + 1)
> 
> Just as a note, this will scale badly with large numbers of domains.  A
> lot of other actions in libxl will as well, so I don't think it warrants
> changing at this point.

I know. I think it won't really matter, as there are very few scenarios
where this information is needed.

I even noticed that libxl won't work very well with more than 1024
domains, as libxl_list_domain() has 1024 as fixed upper bound of
number of domains (just testing a patch to repair that).


Juergen


_______________________________________________
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®.