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

Re: [Xen-devel] [PATCH 6/9] xenstore: don't start xenstore domain if already one is active



On Fri, 2015-12-11 at 16:47 +0100, Juergen Gross wrote:
> Don't start a new xenstore domain in case one is already detected to
> be running.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
> Âtools/xenstore/init-xenstore-domain.c | 25 +++++++++++++++++++++++--
> Â1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/xenstore/init-xenstore-domain.c b/tools/xenstore/init-
> xenstore-domain.c
> index 068887c..0ca7eed 100644
> --- a/tools/xenstore/init-xenstore-domain.c
> +++ b/tools/xenstore/init-xenstore-domain.c
> @@ -66,7 +66,8 @@ static int build(xc_interface *xch)
> Â     } else {
> Â             ssid = SECINITSID_DOMU;
> Â     }
> -     rv = xc_domain_create(xch, ssid, handle, 0, &domid, NULL);
> +     rv = xc_domain_create(xch, ssid, handle, XEN_DOMCTL_CDF_xs_domain,
> +                     ÂÂÂÂÂÂ&domid, NULL);

Doesn't this bit belong earlier on in the series?

> Â     if (rv) {
> Â             fprintf(stderr, "xc_domain_create failed\n");
> Â             goto err;
> @@ -165,6 +166,21 @@ err:
> Â     return rv;
> Â}
> Â
> +static int check_domain(xc_interface *xch)
> +{
> +     xc_dominfo_t info;
> +     uint32_t dom;
> +
> +     dom = 0;
> +     while (xc_domain_getinfo(xch, dom, 1, &info) == 1) {
> +             if (info.xs_domain)
> +                     return 1;
> +             dom = info.domid + 1;
> +     }
> +
> +     return 0;
> +}
> +
> Âint main(int argc, char** argv)
> Â{
> Â     int opt;
> @@ -201,7 +217,12 @@ int main(int argc, char** argv)
> Â             return 1;
> Â     }
> Â
> -     rv = build(xch);
> +     rv = check_domain(xch);
> +
> +     if (!rv)
> +             rv = build(xch);
> +     else
> +             fprintf(stderr, "xenstore domain already present.\n");
> Â
> Â     xc_interface_close(xch);
> Â

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