]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
xl.conf: introduce 'domid_policy'
authorPaul Durrant <pdurrant@amazon.com>
Wed, 8 Jan 2020 12:32:14 +0000 (12:32 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 24 Feb 2020 17:17:35 +0000 (17:17 +0000)
This patch adds a new global 'domid_policy' configuration option to decide
how domain id values are allocated for new domains. It may be set to one of
two values:

"xen", the default value, will cause an invalid domid value to be passed
to do_domain_create() preserving the existing behaviour of having Xen
choose the domid value during domain_create().

"random" will cause the special RANDOM_DOMID value to be passed to
do_domain_create() such that libxl__domain_make() will select a random
domid value.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
docs/man/xl.conf.5.pod
tools/examples/xl.conf
tools/xl/xl.c
tools/xl/xl.h
tools/xl/xl_vmcontrol.c

index 207ab3e77a7b0c26288ce8af2b75b7896c65a253..41ee4287446b2c8d5d55bc7d5a2d72f43731d651 100644 (file)
@@ -45,6 +45,16 @@ The semantics of each C<KEY> defines which form of C<VALUE> is required.
 
 =over 4
 
+=item B<domid_policy="xen"|"random">
+
+Determines how domain-id is set when creating a new domain.
+
+If set to "xen" then the hypervisor will allocate new domain-id values on a sequential basis.
+
+If set to "random" then a random domain-id value will be chosen.
+
+Default: "xen"
+
 =item B<autoballoon="off"|"on"|"auto">
 
 If set to "on" then C<xl> will automatically reduce the amount of
index 0446deb30425ca9fd80e3c5ea40b8621d3eeb3a9..95f2f442d37671a25d83c9b1fae3cb9715006045 100644 (file)
@@ -1,5 +1,9 @@
 ## Global XL config file ##
 
+# Set domain-id policy. "xen" means that the hypervisor will choose the
+# id of a new domain. "random" means that a random value will be chosen.
+#domid_policy="xen"
+
 # Control whether dom0 is ballooned down when xen doesn't have enough
 # free memory to create a domain.  "auto" means only balloon if dom0
 # starts with all the host's memory.
index 3d4390a46dcb554475f7d34bcb91c671db47f2cc..2a5ddd43904745bf5f3f026f0dc50f0eb70b5c7b 100644 (file)
@@ -54,6 +54,7 @@ int claim_mode = 1;
 bool progress_use_cr = 0;
 int max_grant_frames = -1;
 int max_maptrack_frames = -1;
+libxl_domid domid_policy = INVALID_DOMID;
 
 xentoollog_level minmsglevel = minmsglevel_default;
 
@@ -228,6 +229,15 @@ static void parse_global_config(const char *configfile,
     else
         libxl_bitmap_set_any(&global_pv_affinity_mask);
 
+    if (!xlu_cfg_get_string (config, "domid_policy", &buf, 0)) {
+        if (!strcmp(buf, "xen"))
+            domid_policy = INVALID_DOMID;
+        else if (!strcmp(buf, "random"))
+            domid_policy = RANDOM_DOMID;
+        else
+            fprintf(stderr, "invalid domid_policy option");
+    }
+
     xlu_cfg_destroy(config);
 }
 
index 60bdad8ffb4d24be86e306831ea9e539d3ce9a37..2b4709efb2cfd1f4696a014ff91cce8b80046d6f 100644 (file)
@@ -283,6 +283,7 @@ extern int max_maptrack_frames;
 extern libxl_bitmap global_vm_affinity_mask;
 extern libxl_bitmap global_hvm_affinity_mask;
 extern libxl_bitmap global_pv_affinity_mask;
+extern libxl_domid domid_policy;
 
 enum output_format {
     OUTPUT_FORMAT_JSON,
index e520b1da79d3a8b92cdddafe6ec660c9b816e259..39292acfe66ed11fc55dc2fb1ac36ab357177383 100644 (file)
@@ -899,6 +899,8 @@ start:
         autoconnect_console_how = 0;
     }
 
+    d_config.c_info.domid = domid_policy;
+
     if ( restoring ) {
         libxl_domain_restore_params params;