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

Re: [Xen-devel] [PATCH 8/9] xenstore: write xenstore domain data to xenstore



On Fri, 2015-12-11 at 16:47 +0100, Juergen Gross wrote:
> After starting the xenstore domain write the basic data (domid and
> name) to the xenstore.
> 
> Add a new option to init-xenstore-domain to be able to specify the
> domain's name.

Is all this enough to keep "xl list" etc happy?

Do we need to also create a dummy json object like we do for dom0 (init-
xen-dom0)?

> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
> Âtools/xenstore/init-xenstore-domain.c | 13 ++++++++++++-
> Â1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/xenstore/init-xenstore-domain.c b/tools/xenstore/init-
> xenstore-domain.c
> index eedcf32..2a8a417 100644
> --- a/tools/xenstore/init-xenstore-domain.c
> +++ b/tools/xenstore/init-xenstore-domain.c
> @@ -18,6 +18,7 @@ static char *kernel;
> Âstatic char *ramdisk;
> Âstatic char *flask;
> Âstatic char *param;
> +static char *name = "Xenstore";
> Âstatic int memory;
> Â
> Âstatic struct option options[] = {
> @@ -26,6 +27,7 @@ static struct option options[] = {
> Â     { "flask", 1, NULL, 'f' },
> Â     { "ramdisk", 1, NULL, 'r' },
> Â     { "param", 1, NULL, 'p' },
> +     { "name", 1, NULL, 'n' },
> Â     { NULL, 0, NULL, 0 }
> Â};
> Â
> @@ -42,7 +44,8 @@ static void usage(void)
> Â"ÂÂ--memory <memory size>ÂÂÂÂÂsize of the domain in MB, mandatory\n"
> Â"ÂÂ--flask <flask-label>ÂÂÂÂÂÂoptional flask label of the domain\n"
> Â"ÂÂ--ramdisk <ramdisk-file>ÂÂÂoptional ramdisk file for the domain\n"
> -"ÂÂ--param <cmdline>ÂÂÂÂÂÂÂÂÂÂoptional additional parameters for the
> domain\n");
> +"ÂÂ--param <cmdline>ÂÂÂÂÂÂÂÂÂÂoptional additional parameters for the
> domain\n"
> +"ÂÂ--name <name>ÂÂÂÂÂÂÂÂÂÂÂÂÂÂname of the domain (default:
> Xenstore)\n");
> Â}
> Â
> Âstatic int build(xc_interface *xch)
> @@ -195,6 +198,7 @@ int main(int argc, char** argv)
> Â     xc_interface *xch;
> Â     struct xs_handle *xsh;
> Â     char buf[16];
> +     char path[64];
> Â     int rv, fd;
> Â
> Â     while ((opt = getopt_long(argc, argv, "", options, NULL)) != -1)
> {
> @@ -214,6 +218,9 @@ int main(int argc, char** argv)
> Â             case 'p':
> Â                     param = optarg;
> Â                     break;
> +             case 'n':
> +                     name = optarg;
> +                     break;
> Â             }
> Â     }
> Â
> @@ -243,6 +250,10 @@ int main(int argc, char** argv)
> Â     xsh = xs_open(0);
> Â     rv = snprintf(buf, 16, "%d", domid);
> Â     xs_write(xsh, XBT_NULL, "/tool/xenstored/domid", buf, rv);
> +     snprintf(path, 64, "/local/domain/%d/domid", domid);
> +     xs_write(xsh, XBT_NULL, path, buf, rv);
> +     snprintf(path, 64, "/local/domain/%d/name", domid);
> +     xs_write(xsh, XBT_NULL, path, name, strlen(name));
> Â     xs_daemon_close(xsh);
> Â
> Â     fd = creat("/var/run/xenstored.pid", 0666);

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