mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
Xen: xenconfig: remove xendConfigVersion from public sexpr functions
Remove use of xendConfigVersion in the s-expresion config formatter/parser 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:
parent
b6fa951897
commit
60ac2aa821
@ -2608,7 +2608,6 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
|
|||||||
} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_SEXPR)) {
|
} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_SEXPR)) {
|
||||||
/* only support latest xend config format */
|
/* only support latest xend config format */
|
||||||
if (!(def = xenParseSxprString(nativeConfig,
|
if (!(def = xenParseSxprString(nativeConfig,
|
||||||
XEND_CONFIG_VERSION_3_1_0,
|
|
||||||
NULL,
|
NULL,
|
||||||
-1,
|
-1,
|
||||||
cfg->caps,
|
cfg->caps,
|
||||||
|
@ -1568,13 +1568,13 @@ xenUnifiedConnectDomainXMLFromNative(virConnectPtr conn,
|
|||||||
|
|
||||||
def = xenParseXM(conf, priv->caps, priv->xmlopt);
|
def = xenParseXM(conf, 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, &id) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
tty = xenStoreDomainGetConsolePath(conn, id);
|
tty = xenStoreDomainGetConsolePath(conn, id);
|
||||||
vncport = xenStoreDomainGetVNCPort(conn, id);
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
def = xenParseSxprString(config, priv->xendConfigVersion, tty,
|
def = xenParseSxprString(config, tty,
|
||||||
vncport, priv->caps, priv->xmlopt);
|
vncport, priv->caps, priv->xmlopt);
|
||||||
}
|
}
|
||||||
if (!def)
|
if (!def)
|
||||||
@ -1632,7 +1632,7 @@ xenUnifiedConnectDomainXMLToNative(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
|
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
|
||||||
ret = xenFormatSxpr(conn, def, priv->xendConfigVersion);
|
ret = xenFormatSxpr(conn, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -1569,7 +1569,7 @@ xenDaemonDomainFetch(virConnectPtr conn, int domid, const char *name,
|
|||||||
if (root == NULL)
|
if (root == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (xenGetDomIdFromSxpr(root, priv->xendConfigVersion, &id) < 0)
|
if (xenGetDomIdFromSxpr(root, &id) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
if (sexpr_lookup(root, "domain/image/hvm"))
|
if (sexpr_lookup(root, "domain/image/hvm"))
|
||||||
@ -1579,7 +1579,6 @@ xenDaemonDomainFetch(virConnectPtr conn, int domid, const char *name,
|
|||||||
vncport = xenStoreDomainGetVNCPort(conn, id);
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
if (!(def = xenParseSxpr(root,
|
if (!(def = xenParseSxpr(root,
|
||||||
priv->xendConfigVersion,
|
|
||||||
cpus,
|
cpus,
|
||||||
tty,
|
tty,
|
||||||
vncport)))
|
vncport)))
|
||||||
@ -2056,7 +2055,6 @@ xenDaemonCreateXML(virConnectPtr conn, virDomainDefPtr def)
|
|||||||
char *sexpr;
|
char *sexpr;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
struct sexpr *root;
|
struct sexpr *root;
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
|
||||||
|
|
||||||
if (def->id != -1) {
|
if (def->id != -1) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
@ -2065,7 +2063,7 @@ xenDaemonCreateXML(virConnectPtr conn, virDomainDefPtr def)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion)))
|
if (!(sexpr = xenFormatSxpr(conn, def)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = xenDaemonDomainCreateXML(conn, sexpr);
|
ret = xenDaemonDomainCreateXML(conn, sexpr);
|
||||||
@ -2167,7 +2165,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr conn,
|
|||||||
if (xenFormatSxprDisk(dev->data.disk,
|
if (xenFormatSxprDisk(dev->data.disk,
|
||||||
&buf,
|
&buf,
|
||||||
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
|
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
|
||||||
priv->xendConfigVersion, 1) < 0)
|
1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||||
@ -2180,7 +2178,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr conn,
|
|||||||
dev->data.net,
|
dev->data.net,
|
||||||
&buf,
|
&buf,
|
||||||
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
|
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
|
||||||
priv->xendConfigVersion, 1) < 0)
|
1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
char macStr[VIR_MAC_STRING_BUFLEN];
|
char macStr[VIR_MAC_STRING_BUFLEN];
|
||||||
@ -2303,7 +2301,7 @@ xenDaemonUpdateDeviceFlags(virConnectPtr conn,
|
|||||||
if (xenFormatSxprDisk(dev->data.disk,
|
if (xenFormatSxprDisk(dev->data.disk,
|
||||||
&buf,
|
&buf,
|
||||||
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
|
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
|
||||||
priv->xendConfigVersion, 1) < 0)
|
1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2691,9 +2689,8 @@ xenDaemonDomainDefineXML(virConnectPtr conn, virDomainDefPtr def)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *sexpr;
|
char *sexpr;
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
|
||||||
|
|
||||||
if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
|
if (!(sexpr = xenFormatSxpr(conn, def))) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("failed to build sexpr"));
|
"%s", _("failed to build sexpr"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3107,15 +3104,14 @@ xenDaemonDomainBlockPeek(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xenGetDomIdFromSxpr(root, priv->xendConfigVersion, &id) < 0)
|
if (xenGetDomIdFromSxpr(root, &id) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
tty = xenStoreDomainGetConsolePath(conn, id);
|
tty = xenStoreDomainGetConsolePath(conn, id);
|
||||||
vncport = xenStoreDomainGetVNCPort(conn, id);
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
|
|
||||||
if (!(def = xenParseSxpr(root, priv->xendConfigVersion, NULL, tty,
|
if (!(def = xenParseSxpr(root, NULL, tty, vncport)))
|
||||||
vncport)))
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(actual = virDomainDiskPathByName(def, path))) {
|
if (!(actual = virDomainDiskPathByName(def, path))) {
|
||||||
|
@ -920,7 +920,7 @@ xenXMDomainCreate(virConnectPtr conn,
|
|||||||
if (!(entry = virHashLookup(priv->configCache, filename)))
|
if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(sexpr = xenFormatSxpr(conn, entry->def, priv->xendConfigVersion)))
|
if (!(sexpr = xenFormatSxpr(conn, entry->def)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ret = xenDaemonDomainCreateXML(conn, sexpr);
|
ret = xenDaemonDomainCreateXML(conn, sexpr);
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
VIR_LOG_INIT("xenconfig.xen_sxpr");
|
VIR_LOG_INIT("xenconfig.xen_sxpr");
|
||||||
|
|
||||||
/* Get a domain id from a S-expression string */
|
/* Get a domain id from a S-expression string */
|
||||||
int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion, int *id)
|
int xenGetDomIdFromSxprString(const char *sexpr, int *id)
|
||||||
{
|
{
|
||||||
struct sexpr *root = string2sexpr(sexpr);
|
struct sexpr *root = string2sexpr(sexpr);
|
||||||
int ret;
|
int ret;
|
||||||
@ -52,15 +52,13 @@ int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion, int *id)
|
|||||||
if (!root)
|
if (!root)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = xenGetDomIdFromSxpr(root, xendConfigVersion, id);
|
ret = xenGetDomIdFromSxpr(root, id);
|
||||||
sexpr_free(root);
|
sexpr_free(root);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a domain id from a S-expression */
|
/* Get a domain id from a S-expression */
|
||||||
int xenGetDomIdFromSxpr(const struct sexpr *root,
|
int xenGetDomIdFromSxpr(const struct sexpr *root, int *id)
|
||||||
int xendConfigVersion ATTRIBUTE_UNUSED,
|
|
||||||
int *id)
|
|
||||||
{
|
{
|
||||||
const char * tmp = sexpr_node(root, "domain/domid");
|
const char * tmp = sexpr_node(root, "domain/domid");
|
||||||
|
|
||||||
@ -322,7 +320,6 @@ xenParseSxprChar(const char *value,
|
|||||||
* @def: the domain config
|
* @def: the domain config
|
||||||
* @root: root S-expression
|
* @root: root S-expression
|
||||||
* @hvm: true or 1 if node contains HVM S-Expression
|
* @hvm: true or 1 if node contains HVM S-Expression
|
||||||
* @xendConfigVersion: version of xend
|
|
||||||
*
|
*
|
||||||
* This parses out block devices from the domain S-expression
|
* This parses out block devices from the domain S-expression
|
||||||
*
|
*
|
||||||
@ -331,8 +328,7 @@ xenParseSxprChar(const char *value,
|
|||||||
static int
|
static int
|
||||||
xenParseSxprDisks(virDomainDefPtr def,
|
xenParseSxprDisks(virDomainDefPtr def,
|
||||||
const struct sexpr *root,
|
const struct sexpr *root,
|
||||||
int hvm,
|
int hvm)
|
||||||
int xendConfigVersion ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
const struct sexpr *cur, *node;
|
const struct sexpr *cur, *node;
|
||||||
virDomainDiskDefPtr disk = NULL;
|
virDomainDiskDefPtr disk = NULL;
|
||||||
@ -754,7 +750,6 @@ xenParseSxprUSB(virDomainDefPtr def,
|
|||||||
* @def: the domain config
|
* @def: the domain config
|
||||||
* @root: root S-expression
|
* @root: root S-expression
|
||||||
* @hvm: true or 1 if root contains HVM S-Expression
|
* @hvm: true or 1 if root contains HVM S-Expression
|
||||||
* @xendConfigVersion: version of xend
|
|
||||||
* @vncport: VNC port number
|
* @vncport: VNC port number
|
||||||
*
|
*
|
||||||
* This parses out VNC devices from the domain S-expression
|
* This parses out VNC devices from the domain S-expression
|
||||||
@ -765,7 +760,6 @@ static int
|
|||||||
xenParseSxprGraphicsOld(virDomainDefPtr def,
|
xenParseSxprGraphicsOld(virDomainDefPtr def,
|
||||||
const struct sexpr *root,
|
const struct sexpr *root,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion ATTRIBUTE_UNUSED,
|
|
||||||
int vncport)
|
int vncport)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
@ -1059,7 +1053,6 @@ xenParseSxprPCI(virDomainDefPtr def,
|
|||||||
/**
|
/**
|
||||||
* xenParseSxpr:
|
* xenParseSxpr:
|
||||||
* @root: the root of the parsed S-Expression
|
* @root: the root of the parsed S-Expression
|
||||||
* @xendConfigVersion: version of xend
|
|
||||||
* @cpus: set of cpus the domain may be pinned to
|
* @cpus: set of cpus the domain may be pinned to
|
||||||
* @tty: the console pty path
|
* @tty: the console pty path
|
||||||
* @vncport: VNC port number
|
* @vncport: VNC port number
|
||||||
@ -1072,7 +1065,6 @@ xenParseSxprPCI(virDomainDefPtr def,
|
|||||||
*/
|
*/
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenParseSxpr(const struct sexpr *root,
|
xenParseSxpr(const struct sexpr *root,
|
||||||
int xendConfigVersion,
|
|
||||||
const char *cpus, char *tty, int vncport)
|
const char *cpus, char *tty, int vncport)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
@ -1271,7 +1263,7 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* append block devices */
|
/* append block devices */
|
||||||
if (xenParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
|
if (xenParseSxprDisks(def, root, hvm) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (xenParseSxprNets(def, root) < 0)
|
if (xenParseSxprNets(def, root) < 0)
|
||||||
@ -1286,8 +1278,7 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
|
|
||||||
/* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
|
/* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
|
||||||
if ((def->ngraphics == 0) &&
|
if ((def->ngraphics == 0) &&
|
||||||
xenParseSxprGraphicsOld(def, root, hvm, xendConfigVersion,
|
xenParseSxprGraphicsOld(def, root, hvm, vncport) < 0)
|
||||||
vncport) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* in case of HVM we have USB device emulation */
|
/* in case of HVM we have USB device emulation */
|
||||||
@ -1392,7 +1383,6 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
/**
|
/**
|
||||||
* xenParseSxprString:
|
* xenParseSxprString:
|
||||||
* @sexpr: the root of the parsed S-Expression
|
* @sexpr: the root of the parsed S-Expression
|
||||||
* @xendConfigVersion: version of xend
|
|
||||||
* @tty: the console pty path
|
* @tty: the console pty path
|
||||||
* @vncport: VNC port number
|
* @vncport: VNC port number
|
||||||
*
|
*
|
||||||
@ -1404,7 +1394,6 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
*/
|
*/
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenParseSxprString(const char *sexpr,
|
xenParseSxprString(const char *sexpr,
|
||||||
int xendConfigVersion,
|
|
||||||
char *tty,
|
char *tty,
|
||||||
int vncport,
|
int vncport,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
@ -1416,7 +1405,7 @@ xenParseSxprString(const char *sexpr,
|
|||||||
if (!root)
|
if (!root)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(def = xenParseSxpr(root, xendConfigVersion, NULL, tty, vncport)))
|
if (!(def = xenParseSxpr(root, NULL, tty, vncport)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainDefPostParse(def, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
if (virDomainDefPostParse(def, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
|
||||||
@ -1499,7 +1488,6 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
|
|||||||
* xenFormatSxprGraphicsOld:
|
* xenFormatSxprGraphicsOld:
|
||||||
* @def: the domain config
|
* @def: the domain config
|
||||||
* @buf: a buffer for the result S-expression
|
* @buf: a buffer for the result S-expression
|
||||||
* @xendConfigVersion: version of xend
|
|
||||||
*
|
*
|
||||||
* Convert the graphics part of the domain description into a S-expression
|
* Convert the graphics part of the domain description into a S-expression
|
||||||
* in buf. (HVM <= 3.0.4 or PV <= 3.0.3)
|
* in buf. (HVM <= 3.0.4 or PV <= 3.0.3)
|
||||||
@ -1507,9 +1495,7 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
|
|||||||
* Returns 0 in case of success, -1 in case of error
|
* Returns 0 in case of success, -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
|
xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf)
|
||||||
virBufferPtr buf,
|
|
||||||
int xendConfigVersion ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
const char *listenAddr;
|
const char *listenAddr;
|
||||||
|
|
||||||
@ -1639,7 +1625,6 @@ xenFormatSxprChr(virDomainChrDefPtr def,
|
|||||||
* @node: node containing the disk description
|
* @node: node containing the disk description
|
||||||
* @buf: a buffer for the result S-expression
|
* @buf: a buffer for the result S-expression
|
||||||
* @hvm: true or 1 if domain is HVM
|
* @hvm: true or 1 if domain is HVM
|
||||||
* @xendConfigVersion: xend configuration file format
|
|
||||||
* @isAttach: create expression for device attach (1).
|
* @isAttach: create expression for device attach (1).
|
||||||
*
|
*
|
||||||
* Convert the disk device part of the domain config into a S-expresssion in buf.
|
* Convert the disk device part of the domain config into a S-expresssion in buf.
|
||||||
@ -1650,7 +1635,6 @@ int
|
|||||||
xenFormatSxprDisk(virDomainDiskDefPtr def,
|
xenFormatSxprDisk(virDomainDiskDefPtr def,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion ATTRIBUTE_UNUSED,
|
|
||||||
int isAttach)
|
int isAttach)
|
||||||
{
|
{
|
||||||
const char *src = virDomainDiskGetSource(def);
|
const char *src = virDomainDiskGetSource(def);
|
||||||
@ -1758,7 +1742,6 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
|
|||||||
* @def: the domain config
|
* @def: the domain config
|
||||||
* @buf: a buffer for the result S-expression
|
* @buf: a buffer for the result S-expression
|
||||||
* @hvm: true or 1 if domain is HVM
|
* @hvm: true or 1 if domain is HVM
|
||||||
* @xendConfigVersion: xend configuration file format
|
|
||||||
* @isAttach: create expression for device attach (1).
|
* @isAttach: create expression for device attach (1).
|
||||||
*
|
*
|
||||||
* Convert the interface description of the domain config into a S-expression in buf.
|
* Convert the interface description of the domain config into a S-expression in buf.
|
||||||
@ -1773,7 +1756,6 @@ xenFormatSxprNet(virConnectPtr conn,
|
|||||||
virDomainNetDefPtr def,
|
virDomainNetDefPtr def,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion ATTRIBUTE_UNUSED,
|
|
||||||
int isAttach)
|
int isAttach)
|
||||||
{
|
{
|
||||||
const char *script = DEFAULT_VIF_SCRIPT;
|
const char *script = DEFAULT_VIF_SCRIPT;
|
||||||
@ -2093,7 +2075,6 @@ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
|||||||
* xenFormatSxpr:
|
* xenFormatSxpr:
|
||||||
* @conn: pointer to the hypervisor connection
|
* @conn: pointer to the hypervisor connection
|
||||||
* @def: domain config definition
|
* @def: domain config definition
|
||||||
* @xendConfigVersion: xend configuration file format
|
|
||||||
*
|
*
|
||||||
* Generate an S-expression representing the domain configuration.
|
* Generate an S-expression representing the domain configuration.
|
||||||
*
|
*
|
||||||
@ -2101,9 +2082,7 @@ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
|||||||
* the caller must free() the returned value.
|
* the caller must free() the returned value.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
xenFormatSxpr(virConnectPtr conn,
|
xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def)
|
||||||
virDomainDefPtr def,
|
|
||||||
int xendConfigVersion)
|
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
@ -2324,8 +2303,7 @@ xenFormatSxpr(virConnectPtr conn,
|
|||||||
/* PV graphics for xen <= 3.0.4, or HVM graphics */
|
/* PV graphics for xen <= 3.0.4, or HVM graphics */
|
||||||
if (hvm) {
|
if (hvm) {
|
||||||
if ((def->ngraphics == 1) &&
|
if ((def->ngraphics == 1) &&
|
||||||
xenFormatSxprGraphicsOld(def->graphics[0],
|
xenFormatSxprGraphicsOld(def->graphics[0], &buf) < 0)
|
||||||
&buf, xendConfigVersion) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2405,13 +2383,11 @@ xenFormatSxpr(virConnectPtr conn,
|
|||||||
|
|
||||||
|
|
||||||
for (i = 0; i < def->ndisks; i++)
|
for (i = 0; i < def->ndisks; i++)
|
||||||
if (xenFormatSxprDisk(def->disks[i],
|
if (xenFormatSxprDisk(def->disks[i], &buf, hvm, 0) < 0)
|
||||||
&buf, hvm, xendConfigVersion, 0) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; i < def->nnets; i++)
|
for (i = 0; i < def->nnets; i++)
|
||||||
if (xenFormatSxprNet(conn, def->nets[i],
|
if (xenFormatSxprNet(conn, def->nets[i], &buf, hvm, 0) < 0)
|
||||||
&buf, hvm, xendConfigVersion, 0) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (xenFormatSxprAllPCI(def, &buf) < 0)
|
if (xenFormatSxprAllPCI(def, &buf) < 0)
|
||||||
|
@ -32,25 +32,17 @@
|
|||||||
# include "domain_conf.h"
|
# include "domain_conf.h"
|
||||||
# include "virsexpr.h"
|
# include "virsexpr.h"
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
XEND_CONFIG_VERSION_3_0_2 = 1,
|
|
||||||
XEND_CONFIG_VERSION_3_0_3 = 2,
|
|
||||||
XEND_CONFIG_VERSION_3_0_4 = 3,
|
|
||||||
XEND_CONFIG_VERSION_3_1_0 = 4,
|
|
||||||
} xenConfigVersionEnum;
|
|
||||||
|
|
||||||
/* helper functions to get the dom id from a sexpr */
|
/* helper functions to get the dom id from a sexpr */
|
||||||
int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion, int *id);
|
int xenGetDomIdFromSxprString(const char *sexpr, int *id);
|
||||||
int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion, int *id);
|
int xenGetDomIdFromSxpr(const struct sexpr *root, int *id);
|
||||||
|
|
||||||
virDomainDefPtr xenParseSxprString(const char *sexpr,
|
virDomainDefPtr xenParseSxprString(const char *sexpr,
|
||||||
int xendConfigVersion,
|
|
||||||
char *tty,
|
char *tty,
|
||||||
int vncport,
|
int vncport,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
virDomainXMLOptionPtr xmlopt);
|
virDomainXMLOptionPtr xmlopt);
|
||||||
|
|
||||||
virDomainDefPtr xenParseSxpr(const struct sexpr *root, int xendConfigVersion,
|
virDomainDefPtr xenParseSxpr(const struct sexpr *root,
|
||||||
const char *cpus, char *tty, int vncport);
|
const char *cpus, char *tty, int vncport);
|
||||||
|
|
||||||
int xenParseSxprSound(virDomainDefPtr def, const char *str);
|
int xenParseSxprSound(virDomainDefPtr def, const char *str);
|
||||||
@ -58,11 +50,11 @@ int xenParseSxprSound(virDomainDefPtr def, const char *str);
|
|||||||
virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty);
|
virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty);
|
||||||
|
|
||||||
int xenFormatSxprDisk(virDomainDiskDefPtr def, virBufferPtr buf, int hvm,
|
int xenFormatSxprDisk(virDomainDiskDefPtr def, virBufferPtr buf, int hvm,
|
||||||
int xendConfigVersion, int isAttach);
|
int isAttach);
|
||||||
|
|
||||||
int xenFormatSxprNet(virConnectPtr conn,
|
int xenFormatSxprNet(virConnectPtr conn,
|
||||||
virDomainNetDefPtr def, virBufferPtr buf, int hvm,
|
virDomainNetDefPtr def, virBufferPtr buf, int hvm,
|
||||||
int xendConfigVersion, int isAttach);
|
int isAttach);
|
||||||
|
|
||||||
int xenFormatSxprOnePCI(virDomainHostdevDefPtr def, virBufferPtr buf,
|
int xenFormatSxprOnePCI(virDomainHostdevDefPtr def, virBufferPtr buf,
|
||||||
int detach);
|
int detach);
|
||||||
@ -70,7 +62,6 @@ int xenFormatSxprOnePCI(virDomainHostdevDefPtr def, virBufferPtr buf,
|
|||||||
int xenFormatSxprChr(virDomainChrDefPtr def, virBufferPtr buf);
|
int xenFormatSxprChr(virDomainChrDefPtr def, virBufferPtr buf);
|
||||||
int xenFormatSxprSound(virDomainDefPtr def, virBufferPtr buf);
|
int xenFormatSxprSound(virDomainDefPtr def, virBufferPtr buf);
|
||||||
|
|
||||||
char * xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def,
|
char * xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def);
|
||||||
int xendConfigVersion);
|
|
||||||
|
|
||||||
#endif /* __VIR_XEN_SXPR_H__ */
|
#endif /* __VIR_XEN_SXPR_H__ */
|
||||||
|
@ -38,14 +38,6 @@
|
|||||||
# define MAX_VIRT_CPUS XEN_LEGACY_MAX_VCPUS
|
# define MAX_VIRT_CPUS XEN_LEGACY_MAX_VCPUS
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef WITH_RHEL5_API
|
|
||||||
# define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 0
|
|
||||||
# define XEND_CONFIG_MIN_VERS_PVFB_NEWCONF XEND_CONFIG_VERSION_3_0_3
|
|
||||||
# else
|
|
||||||
# define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU XEND_CONFIG_VERSION_3_0_4
|
|
||||||
# define XEND_CONFIG_MIN_VERS_PVFB_NEWCONF XEND_CONFIG_VERSION_3_0_4
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define MIN_XEN_GUEST_SIZE 64 /* 64 megabytes */
|
# define MIN_XEN_GUEST_SIZE 64 /* 64 megabytes */
|
||||||
|
|
||||||
# ifdef __sun
|
# ifdef __sun
|
||||||
|
@ -41,20 +41,19 @@ testCompareFiles(const char *xml, const char *sexpr)
|
|||||||
|
|
||||||
memset(&priv, 0, sizeof(priv));
|
memset(&priv, 0, sizeof(priv));
|
||||||
/* Many puppies died to bring you this code. */
|
/* Many puppies died to bring you this code. */
|
||||||
priv.xendConfigVersion = 4;
|
|
||||||
priv.caps = caps;
|
priv.caps = caps;
|
||||||
conn->privateData = &priv;
|
conn->privateData = &priv;
|
||||||
if (virMutexInit(&priv.lock) < 0)
|
if (virMutexInit(&priv.lock) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (xenGetDomIdFromSxprString(sexprData, 4, &id) < 0)
|
if (xenGetDomIdFromSxprString(sexprData, &id) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
xenUnifiedLock(&priv);
|
xenUnifiedLock(&priv);
|
||||||
tty = xenStoreDomainGetConsolePath(conn, id);
|
tty = xenStoreDomainGetConsolePath(conn, id);
|
||||||
vncport = xenStoreDomainGetVNCPort(conn, id);
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
||||||
xenUnifiedUnlock(&priv);
|
xenUnifiedUnlock(&priv);
|
||||||
|
|
||||||
if (!(def = xenParseSxprString(sexprData, 4,
|
if (!(def = xenParseSxprString(sexprData,
|
||||||
tty, vncport, caps, xmlopt)))
|
tty, vncport, caps, xmlopt)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ testCompareParseXML(const char *xmcfg, const char *xml)
|
|||||||
if (!conn) goto fail;
|
if (!conn) goto fail;
|
||||||
|
|
||||||
/* Many puppies died to bring you this code. */
|
/* Many puppies died to bring you this code. */
|
||||||
priv.xendConfigVersion = 4;
|
|
||||||
priv.caps = caps;
|
priv.caps = caps;
|
||||||
conn->privateData = &priv;
|
conn->privateData = &priv;
|
||||||
|
|
||||||
@ -113,7 +112,6 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Many puppies died to bring you this code. */
|
/* Many puppies died to bring you this code. */
|
||||||
priv.xendConfigVersion = 4;
|
|
||||||
priv.caps = caps;
|
priv.caps = caps;
|
||||||
conn->privateData = &priv;
|
conn->privateData = &priv;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ testCompareFiles(const char *xml, const char *sexpr)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(gotsexpr = xenFormatSxpr(NULL, def, 4)))
|
if (!(gotsexpr = xenFormatSxpr(NULL, def)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotsexpr, sexpr) < 0)
|
if (virtTestCompareToFile(gotsexpr, sexpr) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user