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.

Signed-off-by: Juergen Gross <jgr...@suse.com>
---
 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);
-- 
2.6.2


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

Reply via email to