} else if (STREQ(nativeFormat, LIBXL_CONFIG_FORMAT_SEXPR)) {
/* only support latest xend config format */
if (!(def = xenParseSxprString(nativeConfig,
- XEND_CONFIG_VERSION_3_1_0,
NULL,
-1,
cfg->caps,
def = xenParseXM(conf, priv->caps, priv->xmlopt);
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
- if (xenGetDomIdFromSxprString(config, priv->xendConfigVersion, &id) < 0)
+ if (xenGetDomIdFromSxprString(config, &id) < 0)
goto cleanup;
xenUnifiedLock(priv);
tty = xenStoreDomainGetConsolePath(conn, id);
vncport = xenStoreDomainGetVNCPort(conn, id);
xenUnifiedUnlock(priv);
- def = xenParseSxprString(config, priv->xendConfigVersion, tty,
+ def = xenParseSxprString(config, tty,
vncport, priv->caps, priv->xmlopt);
}
if (!def)
goto cleanup;
}
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
- ret = xenFormatSxpr(conn, def, priv->xendConfigVersion);
+ ret = xenFormatSxpr(conn, def);
}
cleanup:
if (root == NULL)
return NULL;
- if (xenGetDomIdFromSxpr(root, priv->xendConfigVersion, &id) < 0)
+ if (xenGetDomIdFromSxpr(root, &id) < 0)
goto cleanup;
xenUnifiedLock(priv);
if (sexpr_lookup(root, "domain/image/hvm"))
vncport = xenStoreDomainGetVNCPort(conn, id);
xenUnifiedUnlock(priv);
if (!(def = xenParseSxpr(root,
- priv->xendConfigVersion,
cpus,
tty,
vncport)))
char *sexpr;
const char *tmp;
struct sexpr *root;
- xenUnifiedPrivatePtr priv = conn->privateData;
if (def->id != -1) {
virReportError(VIR_ERR_OPERATION_INVALID,
return -1;
}
- if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion)))
+ if (!(sexpr = xenFormatSxpr(conn, def)))
return -1;
ret = xenDaemonDomainCreateXML(conn, sexpr);
if (xenFormatSxprDisk(dev->data.disk,
&buf,
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
- priv->xendConfigVersion, 1) < 0)
+ 1) < 0)
goto cleanup;
if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
dev->data.net,
&buf,
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
- priv->xendConfigVersion, 1) < 0)
+ 1) < 0)
goto cleanup;
char macStr[VIR_MAC_STRING_BUFLEN];
if (xenFormatSxprDisk(dev->data.disk,
&buf,
def->os.type == VIR_DOMAIN_OSTYPE_HVM ? 1 : 0,
- priv->xendConfigVersion, 1) < 0)
+ 1) < 0)
goto cleanup;
break;
{
int ret = -1;
char *sexpr;
- xenUnifiedPrivatePtr priv = conn->privateData;
- if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
+ if (!(sexpr = xenFormatSxpr(conn, def))) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("failed to build sexpr"));
goto cleanup;
return -1;
}
- if (xenGetDomIdFromSxpr(root, priv->xendConfigVersion, &id) < 0)
+ if (xenGetDomIdFromSxpr(root, &id) < 0)
goto cleanup;
xenUnifiedLock(priv);
tty = xenStoreDomainGetConsolePath(conn, id);
vncport = xenStoreDomainGetVNCPort(conn, id);
xenUnifiedUnlock(priv);
- if (!(def = xenParseSxpr(root, priv->xendConfigVersion, NULL, tty,
- vncport)))
+ if (!(def = xenParseSxpr(root, NULL, tty, vncport)))
goto cleanup;
if (!(actual = virDomainDiskPathByName(def, path))) {
if (!(entry = virHashLookup(priv->configCache, filename)))
goto error;
- if (!(sexpr = xenFormatSxpr(conn, entry->def, priv->xendConfigVersion)))
+ if (!(sexpr = xenFormatSxpr(conn, entry->def)))
goto error;
ret = xenDaemonDomainCreateXML(conn, sexpr);
VIR_LOG_INIT("xenconfig.xen_sxpr");
/* 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);
int ret;
if (!root)
return -1;
- ret = xenGetDomIdFromSxpr(root, xendConfigVersion, id);
+ ret = xenGetDomIdFromSxpr(root, id);
sexpr_free(root);
return ret;
}
/* Get a domain id from a S-expression */
-int xenGetDomIdFromSxpr(const struct sexpr *root,
- int xendConfigVersion ATTRIBUTE_UNUSED,
- int *id)
+int xenGetDomIdFromSxpr(const struct sexpr *root, int *id)
{
const char * tmp = sexpr_node(root, "domain/domid");
* @def: the domain config
* @root: root 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
*
static int
xenParseSxprDisks(virDomainDefPtr def,
const struct sexpr *root,
- int hvm,
- int xendConfigVersion ATTRIBUTE_UNUSED)
+ int hvm)
{
const struct sexpr *cur, *node;
virDomainDiskDefPtr disk = NULL;
* @def: the domain config
* @root: root S-expression
* @hvm: true or 1 if root contains HVM S-Expression
- * @xendConfigVersion: version of xend
* @vncport: VNC port number
*
* This parses out VNC devices from the domain S-expression
xenParseSxprGraphicsOld(virDomainDefPtr def,
const struct sexpr *root,
int hvm,
- int xendConfigVersion ATTRIBUTE_UNUSED,
int vncport)
{
const char *tmp;
/**
* xenParseSxpr:
* @root: the root of the parsed S-Expression
- * @xendConfigVersion: version of xend
* @cpus: set of cpus the domain may be pinned to
* @tty: the console pty path
* @vncport: VNC port number
*/
virDomainDefPtr
xenParseSxpr(const struct sexpr *root,
- int xendConfigVersion,
const char *cpus, char *tty, int vncport)
{
const char *tmp;
goto error;
/* append block devices */
- if (xenParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
+ if (xenParseSxprDisks(def, root, hvm) < 0)
goto error;
if (xenParseSxprNets(def, root) < 0)
/* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
if ((def->ngraphics == 0) &&
- xenParseSxprGraphicsOld(def, root, hvm, xendConfigVersion,
- vncport) < 0)
+ xenParseSxprGraphicsOld(def, root, hvm, vncport) < 0)
goto error;
/* in case of HVM we have USB device emulation */
/**
* xenParseSxprString:
* @sexpr: the root of the parsed S-Expression
- * @xendConfigVersion: version of xend
* @tty: the console pty path
* @vncport: VNC port number
*
*/
virDomainDefPtr
xenParseSxprString(const char *sexpr,
- int xendConfigVersion,
char *tty,
int vncport,
virCapsPtr caps,
if (!root)
return NULL;
- if (!(def = xenParseSxpr(root, xendConfigVersion, NULL, tty, vncport)))
+ if (!(def = xenParseSxpr(root, NULL, tty, vncport)))
goto cleanup;
if (virDomainDefPostParse(def, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
* xenFormatSxprGraphicsOld:
* @def: the domain config
* @buf: a buffer for the result S-expression
- * @xendConfigVersion: version of xend
*
* Convert the graphics part of the domain description into a S-expression
* in buf. (HVM <= 3.0.4 or PV <= 3.0.3)
* Returns 0 in case of success, -1 in case of error
*/
static int
-xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
- virBufferPtr buf,
- int xendConfigVersion ATTRIBUTE_UNUSED)
+xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf)
{
const char *listenAddr;
* @node: node containing the disk description
* @buf: a buffer for the result S-expression
* @hvm: true or 1 if domain is HVM
- * @xendConfigVersion: xend configuration file format
* @isAttach: create expression for device attach (1).
*
* Convert the disk device part of the domain config into a S-expresssion in buf.
xenFormatSxprDisk(virDomainDiskDefPtr def,
virBufferPtr buf,
int hvm,
- int xendConfigVersion ATTRIBUTE_UNUSED,
int isAttach)
{
const char *src = virDomainDiskGetSource(def);
* @def: the domain config
* @buf: a buffer for the result S-expression
* @hvm: true or 1 if domain is HVM
- * @xendConfigVersion: xend configuration file format
* @isAttach: create expression for device attach (1).
*
* Convert the interface description of the domain config into a S-expression in buf.
virDomainNetDefPtr def,
virBufferPtr buf,
int hvm,
- int xendConfigVersion ATTRIBUTE_UNUSED,
int isAttach)
{
const char *script = DEFAULT_VIF_SCRIPT;
* xenFormatSxpr:
* @conn: pointer to the hypervisor connection
* @def: domain config definition
- * @xendConfigVersion: xend configuration file format
*
* Generate an S-expression representing the domain configuration.
*
* the caller must free() the returned value.
*/
char *
-xenFormatSxpr(virConnectPtr conn,
- virDomainDefPtr def,
- int xendConfigVersion)
+xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char uuidstr[VIR_UUID_STRING_BUFLEN];
/* PV graphics for xen <= 3.0.4, or HVM graphics */
if (hvm) {
if ((def->ngraphics == 1) &&
- xenFormatSxprGraphicsOld(def->graphics[0],
- &buf, xendConfigVersion) < 0)
+ xenFormatSxprGraphicsOld(def->graphics[0], &buf) < 0)
goto error;
}
} else {
for (i = 0; i < def->ndisks; i++)
- if (xenFormatSxprDisk(def->disks[i],
- &buf, hvm, xendConfigVersion, 0) < 0)
+ if (xenFormatSxprDisk(def->disks[i], &buf, hvm, 0) < 0)
goto error;
for (i = 0; i < def->nnets; i++)
- if (xenFormatSxprNet(conn, def->nets[i],
- &buf, hvm, xendConfigVersion, 0) < 0)
+ if (xenFormatSxprNet(conn, def->nets[i], &buf, hvm, 0) < 0)
goto error;
if (xenFormatSxprAllPCI(def, &buf) < 0)
# include "domain_conf.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 */
-int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion, int *id);
-int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion, int *id);
+int xenGetDomIdFromSxprString(const char *sexpr, int *id);
+int xenGetDomIdFromSxpr(const struct sexpr *root, int *id);
virDomainDefPtr xenParseSxprString(const char *sexpr,
- int xendConfigVersion,
char *tty,
int vncport,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt);
-virDomainDefPtr xenParseSxpr(const struct sexpr *root, int xendConfigVersion,
+virDomainDefPtr xenParseSxpr(const struct sexpr *root,
const char *cpus, char *tty, int vncport);
int xenParseSxprSound(virDomainDefPtr def, const char *str);
virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty);
int xenFormatSxprDisk(virDomainDiskDefPtr def, virBufferPtr buf, int hvm,
- int xendConfigVersion, int isAttach);
+ int isAttach);
int xenFormatSxprNet(virConnectPtr conn,
virDomainNetDefPtr def, virBufferPtr buf, int hvm,
- int xendConfigVersion, int isAttach);
+ int isAttach);
int xenFormatSxprOnePCI(virDomainHostdevDefPtr def, virBufferPtr buf,
int detach);
int xenFormatSxprChr(virDomainChrDefPtr def, virBufferPtr buf);
int xenFormatSxprSound(virDomainDefPtr def, virBufferPtr buf);
-char * xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def,
- int xendConfigVersion);
+char * xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def);
#endif /* __VIR_XEN_SXPR_H__ */
# define MAX_VIRT_CPUS XEN_LEGACY_MAX_VCPUS
# 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 */
# ifdef __sun
memset(&priv, 0, sizeof(priv));
/* Many puppies died to bring you this code. */
- priv.xendConfigVersion = 4;
priv.caps = caps;
conn->privateData = &priv;
if (virMutexInit(&priv.lock) < 0)
goto fail;
- if (xenGetDomIdFromSxprString(sexprData, 4, &id) < 0)
+ if (xenGetDomIdFromSxprString(sexprData, &id) < 0)
goto fail;
xenUnifiedLock(&priv);
tty = xenStoreDomainGetConsolePath(conn, id);
vncport = xenStoreDomainGetVNCPort(conn, id);
xenUnifiedUnlock(&priv);
- if (!(def = xenParseSxprString(sexprData, 4,
+ if (!(def = xenParseSxprString(sexprData,
tty, vncport, caps, xmlopt)))
goto fail;
if (!conn) goto fail;
/* Many puppies died to bring you this code. */
- priv.xendConfigVersion = 4;
priv.caps = caps;
conn->privateData = &priv;
goto fail;
/* Many puppies died to bring you this code. */
- priv.xendConfigVersion = 4;
priv.caps = caps;
conn->privateData = &priv;
goto fail;
}
- if (!(gotsexpr = xenFormatSxpr(NULL, def, 4)))
+ if (!(gotsexpr = xenFormatSxpr(NULL, def)))
goto fail;
if (virtTestCompareToFile(gotsexpr, sexpr) < 0)