Re: [Xen-devel] [PATCH v3 05/22] xl: introduce a domain type option

2017-09-27 Thread Ian Jackson
Roger Pau Monne writes ("[PATCH v3 05/22] xl: introduce a domain type option"):
> 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.

Acked-by: Ian Jackson 

Although,

> +#define CHECK_AND_SET_TYPE(type, new)  \
> +({ \

personally I would prefer the ({ on the previous line, and anyway, I
think you could probably avoid this macro by using a temporary here:

> +/* Deprecated since Xen 4.10. */
> +if (!xlu_cfg_get_string(config, "builder", , 0)) {
> +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)))
> +CHECK_AND_SET_TYPE(c_info->type, LIBXL_DOMAIN_TYPE_HVM);

  +type_from_builder = LIBXL_DOMAIN_TYPE_HVM;

> +else if (!strncmp(buf, "generic", strlen(buf)))
> +CHECK_AND_SET_TYPE(c_info->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 != type_from_builder) {

Up to you, though.  I won't insist on this change.  Hence my ack.

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 05/22] xl: introduce a domain type option

2017-09-25 Thread Roger Pau Monne
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é 
---
Cc: Ian Jackson 
Cc: Wei Liu 
---
Changes since v2:
 - Left shift error message.
 - Detect wrong combination of 'builder' and 'type' options.
 - Do not complain if both type and builder and set to the same value.
 - Drop Wei's Ack (patch changed substantially).
---
 docs/man/xl.cfg.pod.5.in | 23 +--
 tools/xl/xl_parse.c  | 45 +
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index 247ae99ca7..df889ea7e4 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -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
 
@@ -77,6 +77,25 @@ single host must be unique.
 
 =over 4
 
+=item