[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH V2 1/3] extract XEN_CONFIG_FORMAT_XM/XL to xen_common.h




On 05/17/2016 10:34 AM, Chunyan Liu wrote:
> Unify XEN_CONFIG_FORMAT_x and LIBXL_CONFIG_FORMAT_x to
> XEN_CONFIG_FORMAT_x, and move to xen_common.h.
> 
> Signed-off-by: Chunyan Liu <cyliu suse com>
LGTM with the minor nitpick fixed, and we're able to consolidate existent abstraction
in libxl with xenconfig.

Reviewed-by: Joao Martins <joao m martins oracle com>

> ---
>  src/libxl/libxl_driver.c   | 14 +++++---------
>  src/xen/xen_driver.h       |  3 ---
>  src/xenconfig/xen_common.h |  4 ++++
>  3 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 062d6f8..2c19ddb 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -70,10 +70,6 @@ VIR_LOG_INIT("libxl.libxl_driver");
>  #define LIBXL_DOM_REQ_CRASH    3
>  #define LIBXL_DOM_REQ_HALT     4
>  
> -#define LIBXL_CONFIG_FORMAT_XL "xen-xl"
> -#define LIBXL_CONFIG_FORMAT_XM "xen-xm"
> -#define LIBXL_CONFIG_FORMAT_SEXPR "xen-sxpr"
> -
>  #define LIBXL_NB_TOTAL_CPU_STAT_PARAM 1
>  
>  #define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities"
> @@ -2534,14 +2530,14 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
>      if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0)
>          goto cleanup;
>  
> -    if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XL)) {
> +    if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
>          if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0)))
>              goto cleanup;
>          if (!(def = xenParseXL(conf,
>                                 cfg->caps,
>                                 driver->xmlopt)))
>              goto cleanup;
> -    } else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
> +    } else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
>          if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0)))
>              goto cleanup;
>  
> @@ -2549,7 +2545,7 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
>                                 cfg->caps,
>                                 driver->xmlopt)))
>              goto cleanup;
> -    } else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_SEXPR)) {
> +    } else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_SEXPR)) {
>          /* only support latest xend config format */
>          if (!(def = xenParseSxprString(nativeConfig,
>                                         NULL,
> @@ -2599,10 +2595,10 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
>                                          VIR_DOMAIN_DEF_PARSE_INACTIVE)))
>          goto cleanup;
>  
> -    if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XL)) {
> +    if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
>          if (!(conf = xenFormatXL(def, conn)))
>              goto cleanup;
> -    } else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
> +    } else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
>          if (!(conf = xenFormatXM(conn, def)))
>              goto cleanup;
>      } else {
> diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
> index 8578324..5015b31 100644
> --- a/src/xen/xen_driver.h
> +++ b/src/xen/xen_driver.h
> @@ -67,9 +67,6 @@ int xenRegister (void);
>  
>  # define MIN_XEN_GUEST_SIZE 64  /* 64 megabytes */
>  
> -# define XEN_CONFIG_FORMAT_XM    "xen-xm"
> -# define XEN_CONFIG_FORMAT_SEXPR "xen-sxpr"
> -
>  # define XEND_DOMAINS_DIR "/var/lib/xend/domains"
>  
>  # define XEN_SCHED_SEDF_NPARAM   6
> diff --git a/src/xenconfig/xen_common.h b/src/xenconfig/xen_common.h
> index 9ddf210..d96063c 100644
> --- a/src/xenconfig/xen_common.h
> +++ b/src/xenconfig/xen_common.h
> @@ -27,6 +27,10 @@
>  # include "virconf.h"
>  # include "domain_conf.h"
>  
> +#define XEN_CONFIG_FORMAT_XL "xen-xl"
> +#define XEN_CONFIG_FORMAT_XM "xen-xm"
> +#define XEN_CONFIG_FORMAT_SEXPR "xen-sxpr"
Code style requires here to be "# define" instead of "#define", otherwise "make
syntax-check" fails.

> +
>  int xenConfigGetString(virConfPtr conf,
>                         const char *name,
>                         const char **value,
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]