|
[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 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?
> ---
> 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.
At some point, I need to progress my plans to have stats information
like this exposed via shared memory rather than hypercall.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |