extract XEN_CONFIG_FORMAT_XM/XL to xen_common.h

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>
This commit is contained in:
Chunyan Liu 2016-05-17 17:34:44 +08:00 committed by Jim Fehlig
parent ef45eb9bc7
commit f1066d0d46
3 changed files with 9 additions and 12 deletions

View File

@ -70,10 +70,6 @@ VIR_LOG_INIT("libxl.libxl_driver");
#define LIBXL_DOM_REQ_CRASH 3 #define LIBXL_DOM_REQ_CRASH 3
#define LIBXL_DOM_REQ_HALT 4 #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 LIBXL_NB_TOTAL_CPU_STAT_PARAM 1
#define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities" #define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities"
@ -2534,14 +2530,14 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0) if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0)
goto cleanup; goto cleanup;
if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XL)) { if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0))) if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0)))
goto cleanup; goto cleanup;
if (!(def = xenParseXL(conf, if (!(def = xenParseXL(conf,
cfg->caps, cfg->caps,
driver->xmlopt))) driver->xmlopt)))
goto cleanup; 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))) if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0)))
goto cleanup; goto cleanup;
@ -2549,7 +2545,7 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
cfg->caps, cfg->caps,
driver->xmlopt))) driver->xmlopt)))
goto cleanup; goto cleanup;
} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_SEXPR)) { } else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_SEXPR)) {
/* only support latest xend config format */ /* only support latest xend config format */
if (!(def = xenParseSxprString(nativeConfig, if (!(def = xenParseSxprString(nativeConfig,
NULL, NULL,
@ -2599,10 +2595,10 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
VIR_DOMAIN_DEF_PARSE_INACTIVE))) VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup; goto cleanup;
if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XL)) { if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
if (!(conf = xenFormatXL(def, conn))) if (!(conf = xenFormatXL(def, conn)))
goto cleanup; goto cleanup;
} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) { } else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
if (!(conf = xenFormatXM(conn, def))) if (!(conf = xenFormatXM(conn, def)))
goto cleanup; goto cleanup;
} else { } else {

View File

@ -67,9 +67,6 @@ int xenRegister (void);
# define MIN_XEN_GUEST_SIZE 64 /* 64 megabytes */ # 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 XEND_DOMAINS_DIR "/var/lib/xend/domains"
# define XEN_SCHED_SEDF_NPARAM 6 # define XEN_SCHED_SEDF_NPARAM 6

View File

@ -27,6 +27,10 @@
# include "virconf.h" # include "virconf.h"
# include "domain_conf.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"
int xenConfigGetString(virConfPtr conf, int xenConfigGetString(virConfPtr conf,
const char *name, const char *name,
const char **value, const char **value,