@@ -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
@@ -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.
@@ -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);
}
@@ -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,
@@ -899,6 +899,8 @@ start:
autoconnect_console_how = 0;
}
+ d_config.c_info.domid = domid_policy;
+
if ( restoring ) {
libxl_domain_restore_params params;
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> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Wei Liu <wl@xen.org> v2: - New in v2 --- docs/man/xl.conf.5.pod | 10 ++++++++++ tools/examples/xl.conf | 4 ++++ tools/xl/xl.c | 10 ++++++++++ tools/xl/xl.h | 1 + tools/xl/xl_vmcontrol.c | 2 ++ 5 files changed, 27 insertions(+)