]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: create a local xenstore libxl and device-model dir for guests
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 18 Sep 2013 10:42:47 +0000 (12:42 +0200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 18 Nov 2013 17:08:42 +0000 (17:08 +0000)
If libxl is executed inside a guest domain it needs write access to
the local libxl xenstore dir (/local/<domid>/libxl) to store internal
data. This also applies to Qemu which needs a
/local/<domid>/device-model xenstore directory.

This patch creates the mentioned directories for each guest launched
from libxl.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
docs/man/xl.cfg.pod.5
docs/misc/xenstore-paths.markdown
tools/libxl/libxl.h
tools/libxl/libxl_create.c
tools/libxl/libxl_types.idl
tools/libxl/xl_cmdimpl.c

index e6fc83f548bfe9ac6b2af6d17ff94355cf861645..3b227b7f136bf89172e102d043de68cc8d4dd641 100644 (file)
@@ -307,6 +307,11 @@ which are incompatible with migration. Currently this is limited to
 enabling the invariant TSC feature flag in cpuid results when TSC is
 not emulated.
 
+=item B<driver_domain=BOOLEAN>
+
+Specify that this domain is a driver domain. This enables certain
+features needed in order to run a driver domain.
+
 =back
 
 =head2 Devices
index 1c634b529fca5fe49d8d3c1f864914a28dbc5fe5..a0fc003a646d806873379f40b4b3b31eddd99409 100644 (file)
@@ -318,6 +318,16 @@ protocol definition.
 
 A domain writable path. Available for arbitrary domain use.
 
+### Paths private to the toolstack
+
+#### ~/device-model/$DOMID/state [w]
+
+Contains the status of the device models running on the domain.
+
+#### ~/libxl/$DOMID/qdisk-backend-pid [w]
+
+Contains the PIDs of the device models running on the domain.
+
 ## Virtual Machine Paths
 
 The /vm/$UUID namespace is used by toolstacks to store various
index c7dceda1b2efb77bed55966ecb9214a8424cfcb8..18dd42016937e2c0e8d227024595aa5ac9039682 100644 (file)
  */
 #define LIBXL_HAVE_CREATEINFO_PVH 1
 
+/*
+ * LIBXL_HAVE_DRIVER_DOMAIN_CREATION 1
+ *
+ * If this is defined, libxl_domain_create_info contains a driver_domain
+ * field that can be used to tell libxl that the domain that is going
+ * to be created is a driver domain, so the necessary actions are taken.
+ */
+#define LIBXL_HAVE_DRIVER_DOMAIN_CREATION 1
+
 /* Functions annotated with LIBXL_EXTERNAL_CALLERS_ONLY may not be
  * called from within libxl itself. Callers outside libxl, who
  * do not #include libxl_internal.h, are fine. */
index 5e9cdcc9a801a7815cf34036233dc10c4462d49b..fe7ba0d44cb17fc5129fcabd40972e591163b2ad 100644 (file)
@@ -39,6 +39,7 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
     }
 
     libxl_defbool_setdefault(&c_info->run_hotplug_scripts, true);
+    libxl_defbool_setdefault(&c_info->driver_domain, false);
 
     return 0;
 }
@@ -546,6 +547,22 @@ retry_transaction:
     libxl__xs_mkdir(gc, t,
                     libxl__sprintf(gc, "%s/data", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
+
+    if (libxl_defbool_val(info->driver_domain)) {
+        /*
+         * Create a local "libxl" directory for each guest, since we might want
+         * to use libxl from inside the guest
+         */
+        libxl__xs_mkdir(gc, t, GCSPRINTF("%s/libxl", dom_path), rwperm,
+                        ARRAY_SIZE(rwperm));
+        /*
+         * Create a local "device-model" directory for each guest, since we
+         * might want to use Qemu from inside the guest
+         */
+        libxl__xs_mkdir(gc, t, GCSPRINTF("%s/device-model", dom_path), rwperm,
+                        ARRAY_SIZE(rwperm));
+    }
+
     if (info->type == LIBXL_DOMAIN_TYPE_HVM)
         libxl__xs_mkdir(gc, t,
             libxl__sprintf(gc, "%s/hvmloader/generation-id-address", dom_path),
index de5bac32cc7b021679fb38a50b7f96cefd315374..cba8eff094d88a01c0124ada24cefc76f86d6d43 100644 (file)
@@ -275,6 +275,7 @@ libxl_domain_create_info = Struct("domain_create_info",[
     ("poolid",       uint32),
     ("run_hotplug_scripts",libxl_defbool),
     ("pvh",          libxl_defbool),
+    ("driver_domain",libxl_defbool),
     ], dir=DIR_IN)
 
 libxl_domain_restore_params = Struct("domain_restore_params", [
index 8690ec7126fd47c8fb5f57ab2bfcfd09a9010023..19284249a2cbe68a7435bf8cfd2ff5f5a4738d6b 100644 (file)
@@ -849,6 +849,8 @@ static void parse_config_data(const char *config_source,
     if (!xlu_cfg_get_long(config, "max_event_channels", &l, 0))
         b_info->event_channels = l;
 
+    xlu_cfg_get_defbool(config, "driver_domain", &c_info->driver_domain, 0);
+
     switch(b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!xlu_cfg_get_string (config, "kernel", &buf, 0))