Xen: xenconfig: remove xendConfigVersion from public functions

Remove use of xendConfigVersion in the xm and xl config formatter/parsers
in src/xenconfig/. Adjust callers in the xen and libxl drivers accordingly.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Jim Fehlig 2015-12-04 19:11:39 -07:00
parent 0f58db3092
commit 7d7c08be1c
11 changed files with 35 additions and 53 deletions

View File

@ -2595,15 +2595,13 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
goto cleanup; goto cleanup;
if (!(def = xenParseXL(conf, if (!(def = xenParseXL(conf,
cfg->caps, cfg->caps,
driver->xmlopt, driver->xmlopt)))
cfg->verInfo->xen_version_major)))
goto cleanup; goto cleanup;
} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) { } else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0))) if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0)))
goto cleanup; goto cleanup;
if (!(def = xenParseXM(conf, if (!(def = xenParseXM(conf,
cfg->verInfo->xen_version_major,
cfg->caps, cfg->caps,
driver->xmlopt))) driver->xmlopt)))
goto cleanup; goto cleanup;
@ -2659,10 +2657,10 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
goto cleanup; goto cleanup;
if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XL)) { if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XL)) {
if (!(conf = xenFormatXL(def, conn, cfg->verInfo->xen_version_major))) if (!(conf = xenFormatXL(def, conn)))
goto cleanup; goto cleanup;
} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) { } else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
if (!(conf = xenFormatXM(conn, def, cfg->verInfo->xen_version_major))) if (!(conf = xenFormatXM(conn, def)))
goto cleanup; goto cleanup;
} else { } else {

View File

@ -1645,8 +1645,7 @@ xenUnifiedConnectDomainXMLFromNative(virConnectPtr conn,
if (!conf) if (!conf)
goto cleanup; goto cleanup;
def = xenParseXM(conf, priv->xendConfigVersion, def = xenParseXM(conf, priv->caps, priv->xmlopt);
priv->caps, priv->xmlopt);
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) { } else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
if (xenGetDomIdFromSxprString(config, priv->xendConfigVersion, &id) < 0) if (xenGetDomIdFromSxprString(config, priv->xendConfigVersion, &id) < 0)
goto cleanup; goto cleanup;
@ -1700,7 +1699,7 @@ xenUnifiedConnectDomainXMLToNative(virConnectPtr conn,
if (STREQ(format, XEN_CONFIG_FORMAT_XM)) { if (STREQ(format, XEN_CONFIG_FORMAT_XM)) {
int len = MAX_CONFIG_SIZE; int len = MAX_CONFIG_SIZE;
conf = xenFormatXM(conn, def, priv->xendConfigVersion); conf = xenFormatXM(conn, def);
if (!conf) if (!conf)
goto cleanup; goto cleanup;

View File

@ -139,7 +139,7 @@ xenXMConfigReadFile(virConnectPtr conn, const char *filename)
if (!(conf = virConfReadFile(filename, 0))) if (!(conf = virConfReadFile(filename, 0)))
return NULL; return NULL;
def = xenParseXM(conf, priv->xendConfigVersion, priv->caps, priv->xmlopt); def = xenParseXM(conf, priv->caps, priv->xmlopt);
virConfFree(conf); virConfFree(conf);
return def; return def;
@ -151,10 +151,9 @@ xenXMConfigSaveFile(virConnectPtr conn,
virDomainDefPtr def) virDomainDefPtr def)
{ {
virConfPtr conf; virConfPtr conf;
xenUnifiedPrivatePtr priv = conn->privateData;
int ret; int ret;
if (!(conf = xenFormatXM(conn, def, priv->xendConfigVersion))) if (!(conf = xenFormatXM(conn, def)))
return -1; return -1;
ret = virConfWriteFile(filename, conf); ret = virConfWriteFile(filename, conf);
@ -972,7 +971,7 @@ xenXMDomainDefineXML(virConnectPtr conn, virDomainDefPtr def)
return -1; return -1;
} }
if (!(conf = xenFormatXM(conn, def, priv->xendConfigVersion))) if (!(conf = xenFormatXM(conn, def)))
goto error; goto error;
/* /*

View File

@ -1017,8 +1017,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
int int
xenParseConfigCommon(virConfPtr conf, xenParseConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,
virCapsPtr caps, virCapsPtr caps)
int xendConfigVersion ATTRIBUTE_UNUSED)
{ {
if (xenParseGeneralMeta(conf, def, caps) < 0) if (xenParseGeneralMeta(conf, def, caps) < 0)
return -1; return -1;
@ -1761,8 +1760,7 @@ xenFormatVif(virConfPtr conf,
int int
xenFormatConfigCommon(virConfPtr conf, xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,
virConnectPtr conn, virConnectPtr conn)
int xendConfigVersion ATTRIBUTE_UNUSED)
{ {
if (xenFormatGeneralMeta(conf, def) < 0) if (xenFormatGeneralMeta(conf, def) < 0)
return -1; return -1;

View File

@ -54,12 +54,11 @@ int xenConfigCopyStringOpt(virConfPtr conf,
int xenParseConfigCommon(virConfPtr conf, int xenParseConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,
virCapsPtr caps, virCapsPtr caps);
int xendConfigVersion);
int xenFormatConfigCommon(virConfPtr conf, int xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,
virConnectPtr conn, virConnectPtr conn);
int xendConfigVersion);
#endif /* __VIR_XEN_COMMON_H__ */ #endif /* __VIR_XEN_COMMON_H__ */

View File

@ -446,8 +446,7 @@ xenParseXLInputDevs(virConfPtr conf, virDomainDefPtr def)
virDomainDefPtr virDomainDefPtr
xenParseXL(virConfPtr conf, xenParseXL(virConfPtr conf,
virCapsPtr caps, virCapsPtr caps,
virDomainXMLOptionPtr xmlopt, virDomainXMLOptionPtr xmlopt)
int xendConfigVersion)
{ {
virDomainDefPtr def = NULL; virDomainDefPtr def = NULL;
@ -457,7 +456,7 @@ xenParseXL(virConfPtr conf,
def->virtType = VIR_DOMAIN_VIRT_XEN; def->virtType = VIR_DOMAIN_VIRT_XEN;
def->id = -1; def->id = -1;
if (xenParseConfigCommon(conf, def, caps, xendConfigVersion) < 0) if (xenParseConfigCommon(conf, def, caps) < 0)
goto cleanup; goto cleanup;
if (xenParseXLOS(conf, def, caps) < 0) if (xenParseXLOS(conf, def, caps) < 0)
@ -828,14 +827,14 @@ xenFormatXLInputDevs(virConfPtr conf, virDomainDefPtr def)
virConfPtr virConfPtr
xenFormatXL(virDomainDefPtr def, virConnectPtr conn, int xendConfigVersion) xenFormatXL(virDomainDefPtr def, virConnectPtr conn)
{ {
virConfPtr conf = NULL; virConfPtr conf = NULL;
if (!(conf = virConfNew())) if (!(conf = virConfNew()))
goto cleanup; goto cleanup;
if (xenFormatConfigCommon(conf, def, conn, xendConfigVersion) < 0) if (xenFormatConfigCommon(conf, def, conn) < 0)
goto cleanup; goto cleanup;
if (xenFormatXLOS(conf, def) < 0) if (xenFormatXLOS(conf, def) < 0)

View File

@ -29,9 +29,8 @@
virDomainDefPtr xenParseXL(virConfPtr conn, virDomainDefPtr xenParseXL(virConfPtr conn,
virCapsPtr caps, virCapsPtr caps,
virDomainXMLOptionPtr xmlopt, virDomainXMLOptionPtr xmlopt);
int xendConfigVersion);
virConfPtr xenFormatXL(virDomainDefPtr def, virConfPtr xenFormatXL(virDomainDefPtr def, virConnectPtr);
virConnectPtr, int xendConfigVersion);
#endif /* __VIR_XEN_XL_H__ */ #endif /* __VIR_XEN_XL_H__ */

View File

@ -104,8 +104,7 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
static int static int
xenParseXMDisk(virConfPtr conf, virDomainDefPtr def, xenParseXMDisk(virConfPtr conf, virDomainDefPtr def)
int xendConfigVersion ATTRIBUTE_UNUSED)
{ {
virDomainDiskDefPtr disk = NULL; virDomainDiskDefPtr disk = NULL;
int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM; int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM;
@ -281,9 +280,7 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def,
static int static int
xenFormatXMDisk(virConfValuePtr list, xenFormatXMDisk(virConfValuePtr list,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk)
int hvm ATTRIBUTE_UNUSED,
int xendConfigVersion ATTRIBUTE_UNUSED)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
virConfValuePtr val, tmp; virConfValuePtr val, tmp;
@ -362,11 +359,10 @@ xenFormatXMDisk(virConfValuePtr list,
static int static int
xenFormatXMDisks(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion) xenFormatXMDisks(virConfPtr conf, virDomainDefPtr def)
{ {
virConfValuePtr diskVal = NULL; virConfValuePtr diskVal = NULL;
size_t i = 0; size_t i = 0;
int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM;
if (VIR_ALLOC(diskVal) < 0) if (VIR_ALLOC(diskVal) < 0)
goto cleanup; goto cleanup;
@ -378,8 +374,7 @@ xenFormatXMDisks(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion)
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
continue; continue;
if (xenFormatXMDisk(diskVal, def->disks[i], if (xenFormatXMDisk(diskVal, def->disks[i]) < 0)
hvm, xendConfigVersion) < 0)
goto cleanup; goto cleanup;
} }
@ -436,7 +431,6 @@ xenParseXMInputDevs(virConfPtr conf, virDomainDefPtr def)
*/ */
virDomainDefPtr virDomainDefPtr
xenParseXM(virConfPtr conf, xenParseXM(virConfPtr conf,
int xendConfigVersion,
virCapsPtr caps, virCapsPtr caps,
virDomainXMLOptionPtr xmlopt) virDomainXMLOptionPtr xmlopt)
{ {
@ -448,13 +442,13 @@ xenParseXM(virConfPtr conf,
def->virtType = VIR_DOMAIN_VIRT_XEN; def->virtType = VIR_DOMAIN_VIRT_XEN;
def->id = -1; def->id = -1;
if (xenParseConfigCommon(conf, def, caps, xendConfigVersion) < 0) if (xenParseConfigCommon(conf, def, caps) < 0)
goto cleanup; goto cleanup;
if (xenParseXMOS(conf, def) < 0) if (xenParseXMOS(conf, def) < 0)
goto cleanup; goto cleanup;
if (xenParseXMDisk(conf, def, xendConfigVersion) < 0) if (xenParseXMDisk(conf, def) < 0)
goto cleanup; goto cleanup;
if (xenParseXMInputDevs(conf, def) < 0) if (xenParseXMInputDevs(conf, def) < 0)
@ -584,21 +578,20 @@ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
*/ */
virConfPtr virConfPtr
xenFormatXM(virConnectPtr conn, xenFormatXM(virConnectPtr conn,
virDomainDefPtr def, virDomainDefPtr def)
int xendConfigVersion)
{ {
virConfPtr conf = NULL; virConfPtr conf = NULL;
if (!(conf = virConfNew())) if (!(conf = virConfNew()))
goto cleanup; goto cleanup;
if (xenFormatConfigCommon(conf, def, conn, xendConfigVersion) < 0) if (xenFormatConfigCommon(conf, def, conn) < 0)
goto cleanup; goto cleanup;
if (xenFormatXMOS(conf, def) < 0) if (xenFormatXMOS(conf, def) < 0)
goto cleanup; goto cleanup;
if (xenFormatXMDisks(conf, def, xendConfigVersion) < 0) if (xenFormatXMDisks(conf, def) < 0)
goto cleanup; goto cleanup;
if (xenFormatXMInputDevs(conf, def) < 0) if (xenFormatXMInputDevs(conf, def) < 0)

View File

@ -30,10 +30,9 @@
# include "virconf.h" # include "virconf.h"
# include "domain_conf.h" # include "domain_conf.h"
virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def, virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def);
int xendConfigVersion);
virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion, virDomainDefPtr xenParseXM(virConfPtr conf,
virCapsPtr caps, virDomainXMLOptionPtr xmlopt); virCapsPtr caps, virDomainXMLOptionPtr xmlopt);
#endif /* __VIR_XEN_XM_H__ */ #endif /* __VIR_XEN_XM_H__ */

View File

@ -70,7 +70,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
goto fail; goto fail;
} }
if (!(conf = xenFormatXL(def, conn, 4))) if (!(conf = xenFormatXL(def, conn)))
goto fail; goto fail;
if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0) if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0)
@ -113,7 +113,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
if (!(conf = virConfReadMem(xmcfgData, strlen(xmcfgData), 0))) if (!(conf = virConfReadMem(xmcfgData, strlen(xmcfgData), 0)))
goto fail; goto fail;
if (!(def = xenParseXL(conf, caps, xmlopt, 4))) if (!(def = xenParseXL(conf, caps, xmlopt)))
goto fail; goto fail;
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE | if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE |

View File

@ -73,7 +73,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
goto fail; goto fail;
} }
if (!(conf = xenFormatXM(conn, def, 4))) if (!(conf = xenFormatXM(conn, def)))
goto fail; goto fail;
if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0) if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0)
@ -120,8 +120,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
if (!(conf = virConfReadMem(xmcfgData, strlen(xmcfgData), 0))) if (!(conf = virConfReadMem(xmcfgData, strlen(xmcfgData), 0)))
goto fail; goto fail;
if (!(def = xenParseXM(conf, priv.xendConfigVersion, if (!(def = xenParseXM(conf, caps, xmlopt)))
caps, xmlopt)))
goto fail; goto fail;
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE))) if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))