Skip to content

Commit

Permalink
xl: introduce a domain type option
Browse files Browse the repository at this point in the history
Introduce a new type option to xl configuration files in order to
specify the domain type. This supersedes the current builder option.

The new option is documented in the xl.cfg man page, and the previous
builder option is marked as deprecated.

Signed-off-by: Roger Pau Monné <[email protected]>
Acked-by: Ian Jackson <[email protected]>
  • Loading branch information
royger committed Sep 28, 2017
1 parent 3c44f8e commit c7dfe4a
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 6 deletions.
23 changes: 21 additions & 2 deletions docs/man/xl.cfg.pod.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Pairs may be separated either by a newline or a semicolon. Both
of the following are valid:

name="h0"
builder="hvm"
type="hvm"

name="h0"; builder="hvm"
name="h0"; type="hvm"

=head1 OPTIONS

Expand All @@ -77,6 +77,25 @@ single host must be unique.

=over 4

=item B<type="pv">

Specifies that this is to be a PV domain, suitable for hosting Xen-aware
guest operating systems. This is the default.

=item B<type="hvm">

Specifies that this is to be an HVM domain. That is, a fully virtualised
computer with emulated BIOS, disk and network peripherals, etc.

=back

=head3 Deprecated guest type selection

Note that the builder option is being deprecated in favor of the type
option.

=over 4

=item B<builder="generic">

Specifies that this is to be a PV domain, suitable for hosting Xen-aware guest
Expand Down
43 changes: 39 additions & 4 deletions tools/xl/xl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,45 @@ void parse_config_data(const char *config_source,
}

libxl_defbool_set(&c_info->run_hotplug_scripts, run_hotplug_scripts);
c_info->type = LIBXL_DOMAIN_TYPE_PV;
if (!xlu_cfg_get_string (config, "builder", &buf, 0) &&
!strncmp(buf, "hvm", strlen(buf)))
c_info->type = LIBXL_DOMAIN_TYPE_HVM;

if (!xlu_cfg_get_string(config, "type", &buf, 0)) {
if (!strncmp(buf, "hvm", strlen(buf)))
c_info->type = LIBXL_DOMAIN_TYPE_HVM;
else if (!strncmp(buf, "pv", strlen(buf)))
c_info->type = LIBXL_DOMAIN_TYPE_PV;
else {
fprintf(stderr, "Invalid domain type %s.\n", buf);
exit(1);
}
}

/* Deprecated since Xen 4.10. */
if (!xlu_cfg_get_string(config, "builder", &buf, 0)) {
libxl_domain_type builder_type;

if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
fprintf(stderr,
"The \"builder\" option is being deprecated, please use \"type\" instead.\n");
if (!strncmp(buf, "hvm", strlen(buf)))
builder_type = LIBXL_DOMAIN_TYPE_HVM;
else if (!strncmp(buf, "generic", strlen(buf)))
builder_type = LIBXL_DOMAIN_TYPE_PV;
else {
fprintf(stderr, "Invalid domain type %s.\n", buf);
exit(1);
}

if (c_info->type != LIBXL_DOMAIN_TYPE_INVALID &&
c_info->type != builder_type) {
fprintf(stderr,
"Contradicting \"builder\" and \"type\" options specified.\n");
exit(1);
}
c_info->type = builder_type;
}

if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
c_info->type = LIBXL_DOMAIN_TYPE_PV;

xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0);

Expand Down

0 comments on commit c7dfe4a

Please sign in to comment.