mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Renamed functions in xenxs
This commit is contained in:
parent
2e69e66e38
commit
3e53c7f954
@ -1217,14 +1217,14 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn,
|
|||||||
if (!conf)
|
if (!conf)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
def = xenXMDomainConfigParse(conf, priv->xendConfigVersion, priv->caps);
|
def = xenParseXM(conf, priv->xendConfigVersion, priv->caps);
|
||||||
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
|
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
|
||||||
id = xenGetDomIdFromSxprString(config, priv->xendConfigVersion);
|
id = xenGetDomIdFromSxprString(config, priv->xendConfigVersion);
|
||||||
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 = xenDaemonParseSxprString(config, priv->xendConfigVersion, tty,
|
def = xenParseSxprString(config, priv->xendConfigVersion, tty,
|
||||||
vncport);
|
vncport);
|
||||||
}
|
}
|
||||||
if (!def)
|
if (!def)
|
||||||
@ -1266,7 +1266,7 @@ xenUnifiedDomainXMLToNative(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 = xenXMDomainConfigFormat(conn, def, priv->xendConfigVersion);
|
conf = xenFormatXM(conn, def, priv->xendConfigVersion);
|
||||||
if (!conf)
|
if (!conf)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1280,7 +1280,7 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
|
} else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
|
||||||
ret = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion);
|
ret = xenFormatSxpr(conn, def, priv->xendConfigVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -1793,11 +1793,11 @@ xenDaemonDomainFetch(virConnectPtr conn,
|
|||||||
tty = xenStoreDomainGetConsolePath(conn, id);
|
tty = xenStoreDomainGetConsolePath(conn, id);
|
||||||
vncport = xenStoreDomainGetVNCPort(conn, id);
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
if (!(def = xenDaemonParseSxpr(root,
|
if (!(def = xenParseSxpr(root,
|
||||||
priv->xendConfigVersion,
|
priv->xendConfigVersion,
|
||||||
cpus,
|
cpus,
|
||||||
tty,
|
tty,
|
||||||
vncport)))
|
vncport)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -2525,7 +2525,7 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
|
|||||||
VIR_DOMAIN_XML_INACTIVE)))
|
VIR_DOMAIN_XML_INACTIVE)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
|
if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -2641,11 +2641,11 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
|
|
||||||
switch (dev->type) {
|
switch (dev->type) {
|
||||||
case VIR_DOMAIN_DEVICE_DISK:
|
case VIR_DOMAIN_DEVICE_DISK:
|
||||||
if (xenDaemonFormatSxprDisk(domain->conn,
|
if (xenFormatSxprDisk(domain->conn,
|
||||||
dev->data.disk,
|
dev->data.disk,
|
||||||
&buf,
|
&buf,
|
||||||
STREQ(def->os.type, "hvm") ? 1 : 0,
|
STREQ(def->os.type, "hvm") ? 1 : 0,
|
||||||
priv->xendConfigVersion, 1) < 0)
|
priv->xendConfigVersion, 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) {
|
||||||
@ -2657,11 +2657,11 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DEVICE_NET:
|
case VIR_DOMAIN_DEVICE_NET:
|
||||||
if (xenDaemonFormatSxprNet(domain->conn,
|
if (xenFormatSxprNet(domain->conn,
|
||||||
dev->data.net,
|
dev->data.net,
|
||||||
&buf,
|
&buf,
|
||||||
STREQ(def->os.type, "hvm") ? 1 : 0,
|
STREQ(def->os.type, "hvm") ? 1 : 0,
|
||||||
priv->xendConfigVersion, 1) < 0)
|
priv->xendConfigVersion, 1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
char macStr[VIR_MAC_STRING_BUFLEN];
|
char macStr[VIR_MAC_STRING_BUFLEN];
|
||||||
@ -2676,8 +2676,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||||
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||||
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
||||||
if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
|
if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 0) < 0)
|
||||||
&buf, 0) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virDomainDevicePCIAddress PCIAddr;
|
virDomainDevicePCIAddress PCIAddr;
|
||||||
@ -2812,11 +2811,11 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
|
|
||||||
switch (dev->type) {
|
switch (dev->type) {
|
||||||
case VIR_DOMAIN_DEVICE_DISK:
|
case VIR_DOMAIN_DEVICE_DISK:
|
||||||
if (xenDaemonFormatSxprDisk(domain->conn,
|
if (xenFormatSxprDisk(domain->conn,
|
||||||
dev->data.disk,
|
dev->data.disk,
|
||||||
&buf,
|
&buf,
|
||||||
STREQ(def->os.type, "hvm") ? 1 : 0,
|
STREQ(def->os.type, "hvm") ? 1 : 0,
|
||||||
priv->xendConfigVersion, 1) < 0)
|
priv->xendConfigVersion, 1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2927,8 +2926,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
||||||
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||||
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
||||||
if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
|
if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 1) < 0)
|
||||||
&buf, 1) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
virXendError(VIR_ERR_NO_SUPPORT, "%s",
|
virXendError(VIR_ERR_NO_SUPPORT, "%s",
|
||||||
@ -3267,7 +3265,7 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
|
if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
|
||||||
virXendError(VIR_ERR_XML_ERROR,
|
virXendError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("failed to build sexpr"));
|
"%s", _("failed to build sexpr"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -3759,8 +3757,8 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
|||||||
vncport = xenStoreDomainGetVNCPort(domain->conn, id);
|
vncport = xenStoreDomainGetVNCPort(domain->conn, id);
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
|
|
||||||
if (!(def = xenDaemonParseSxpr(root, priv->xendConfigVersion, NULL, tty,
|
if (!(def = xenParseSxpr(root, priv->xendConfigVersion, NULL, tty,
|
||||||
vncport)))
|
vncport)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0 ; i < def->ndisks ; i++) {
|
for (i = 0 ; i < def->ndisks ; i++) {
|
||||||
|
@ -178,7 +178,7 @@ xenXMConfigReadFile(virConnectPtr conn, const char *filename) {
|
|||||||
if (!(conf = virConfReadFile(filename, 0)))
|
if (!(conf = virConfReadFile(filename, 0)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
def = xenXMDomainConfigParse(conf, priv->xendConfigVersion, priv->caps);
|
def = xenParseXM(conf, priv->xendConfigVersion, priv->caps);
|
||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
@ -190,7 +190,7 @@ xenXMConfigSaveFile(virConnectPtr conn, const char *filename, virDomainDefPtr de
|
|||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(conf = xenXMDomainConfigFormat(conn, def, priv->xendConfigVersion)))
|
if (!(conf = xenFormatXM(conn, def, priv->xendConfigVersion)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virConfWriteFile(filename, conf);
|
ret = virConfWriteFile(filename, conf);
|
||||||
@ -1011,7 +1011,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
|
|||||||
if (!(entry = virHashLookup(priv->configCache, filename)))
|
if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(sexpr = xenDaemonFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion)))
|
if (!(sexpr = xenFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ret = xenDaemonDomainCreateXML(domain->conn, sexpr);
|
ret = xenDaemonDomainCreateXML(domain->conn, sexpr);
|
||||||
|
@ -71,7 +71,7 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion)
|
|||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenDaemonParseSxprOS
|
* xenParseSxprOS
|
||||||
* @node: the root of the parsed S-Expression
|
* @node: the root of the parsed S-Expression
|
||||||
* @def: the domain config
|
* @def: the domain config
|
||||||
* @hvm: true or 1 if no contains HVM S-Expression
|
* @hvm: true or 1 if no contains HVM S-Expression
|
||||||
@ -82,9 +82,9 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion)
|
|||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprOS(const struct sexpr *node,
|
xenParseSxprOS(const struct sexpr *node,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def,
|
||||||
int hvm)
|
int hvm)
|
||||||
{
|
{
|
||||||
if (hvm) {
|
if (hvm) {
|
||||||
if (sexpr_node_copy(node, "domain/image/hvm/loader", &def->os.loader) < 0)
|
if (sexpr_node_copy(node, "domain/image/hvm/loader", &def->os.loader) < 0)
|
||||||
@ -161,8 +161,8 @@ no_memory:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virDomainChrDefPtr
|
virDomainChrDefPtr
|
||||||
xenDaemonParseSxprChar(const char *value,
|
xenParseSxprChar(const char *value,
|
||||||
const char *tty)
|
const char *tty)
|
||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@ -321,10 +321,10 @@ error:
|
|||||||
* Returns 0 if successful or -1 if failed.
|
* Returns 0 if successful or -1 if failed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprDisks(virDomainDefPtr def,
|
xenParseSxprDisks(virDomainDefPtr def,
|
||||||
const struct sexpr *root,
|
const struct sexpr *root,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion)
|
int xendConfigVersion)
|
||||||
{
|
{
|
||||||
const struct sexpr *cur, *node;
|
const struct sexpr *cur, *node;
|
||||||
virDomainDiskDefPtr disk = NULL;
|
virDomainDiskDefPtr disk = NULL;
|
||||||
@ -497,8 +497,8 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprNets(virDomainDefPtr def,
|
xenParseSxprNets(virDomainDefPtr def,
|
||||||
const struct sexpr *root)
|
const struct sexpr *root)
|
||||||
{
|
{
|
||||||
virDomainNetDefPtr net = NULL;
|
virDomainNetDefPtr net = NULL;
|
||||||
const struct sexpr *cur, *node;
|
const struct sexpr *cur, *node;
|
||||||
@ -590,8 +590,8 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
xenDaemonParseSxprSound(virDomainDefPtr def,
|
xenParseSxprSound(virDomainDefPtr def,
|
||||||
const char *str)
|
const char *str)
|
||||||
{
|
{
|
||||||
if (STREQ(str, "all")) {
|
if (STREQ(str, "all")) {
|
||||||
int i;
|
int i;
|
||||||
@ -668,8 +668,8 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprUSB(virDomainDefPtr def,
|
xenParseSxprUSB(virDomainDefPtr def,
|
||||||
const struct sexpr *root)
|
const struct sexpr *root)
|
||||||
{
|
{
|
||||||
struct sexpr *cur, *node;
|
struct sexpr *cur, *node;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
@ -709,10 +709,10 @@ no_memory:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprGraphicsOld(virDomainDefPtr def,
|
xenParseSxprGraphicsOld(virDomainDefPtr def,
|
||||||
const struct sexpr *root,
|
const struct sexpr *root,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion, int vncport)
|
int xendConfigVersion, int vncport)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
virDomainGraphicsDefPtr graphics = NULL;
|
virDomainGraphicsDefPtr graphics = NULL;
|
||||||
@ -796,8 +796,8 @@ no_memory:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprGraphicsNew(virDomainDefPtr def,
|
xenParseSxprGraphicsNew(virDomainDefPtr def,
|
||||||
const struct sexpr *root, int vncport)
|
const struct sexpr *root, int vncport)
|
||||||
{
|
{
|
||||||
virDomainGraphicsDefPtr graphics = NULL;
|
virDomainGraphicsDefPtr graphics = NULL;
|
||||||
const struct sexpr *cur, *node;
|
const struct sexpr *cur, *node;
|
||||||
@ -893,7 +893,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenDaemonParseSxprPCI
|
* xenParseSxprPCI
|
||||||
* @root: root sexpr
|
* @root: root sexpr
|
||||||
*
|
*
|
||||||
* This parses out block devices from the domain sexpr
|
* This parses out block devices from the domain sexpr
|
||||||
@ -901,8 +901,8 @@ error:
|
|||||||
* Returns 0 if successful or -1 if failed.
|
* Returns 0 if successful or -1 if failed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenDaemonParseSxprPCI(virDomainDefPtr def,
|
xenParseSxprPCI(virDomainDefPtr def,
|
||||||
const struct sexpr *root)
|
const struct sexpr *root)
|
||||||
{
|
{
|
||||||
const struct sexpr *cur, *tmp = NULL, *node;
|
const struct sexpr *cur, *tmp = NULL, *node;
|
||||||
virDomainHostdevDefPtr dev = NULL;
|
virDomainHostdevDefPtr dev = NULL;
|
||||||
@ -1017,7 +1017,7 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenDaemonParseSxpr:
|
* xenParseSxpr:
|
||||||
* @conn: the connection associated with the XML
|
* @conn: the connection associated with the XML
|
||||||
* @root: the root of the parsed S-Expression
|
* @root: the root of the parsed S-Expression
|
||||||
* @xendConfigVersion: version of xend
|
* @xendConfigVersion: version of xend
|
||||||
@ -1030,9 +1030,9 @@ error:
|
|||||||
* the caller must free() the returned value.
|
* the caller must free() the returned value.
|
||||||
*/
|
*/
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenDaemonParseSxpr(const struct sexpr *root,
|
xenParseSxpr(const struct sexpr *root,
|
||||||
int xendConfigVersion,
|
int xendConfigVersion,
|
||||||
const char *cpus, char *tty, int vncport)
|
const char *cpus, char *tty, int vncport)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
virDomainDefPtr def;
|
virDomainDefPtr def;
|
||||||
@ -1094,7 +1094,7 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
|
|
||||||
if (def->id != 0) {
|
if (def->id != 0) {
|
||||||
if (sexpr_lookup(root, "domain/image")) {
|
if (sexpr_lookup(root, "domain/image")) {
|
||||||
if (xenDaemonParseSxprOS(root, def, hvm) < 0)
|
if (xenParseSxprOS(root, def, hvm) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1184,22 +1184,22 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
/* append block devices */
|
/* append block devices */
|
||||||
if (xenDaemonParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
|
if (xenParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (xenDaemonParseSxprNets(def, root) < 0)
|
if (xenParseSxprNets(def, root) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (xenDaemonParseSxprPCI(def, root) < 0)
|
if (xenParseSxprPCI(def, root) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* New style graphics device config */
|
/* New style graphics device config */
|
||||||
if (xenDaemonParseSxprGraphicsNew(def, root, vncport) < 0)
|
if (xenParseSxprGraphicsNew(def, root, vncport) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* 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) &&
|
||||||
xenDaemonParseSxprGraphicsOld(def, root, hvm, xendConfigVersion,
|
xenParseSxprGraphicsOld(def, root, hvm, xendConfigVersion,
|
||||||
vncport) < 0)
|
vncport) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -1275,7 +1275,7 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
|
|
||||||
/* in case of HVM we have USB device emulation */
|
/* in case of HVM we have USB device emulation */
|
||||||
if (hvm &&
|
if (hvm &&
|
||||||
xenDaemonParseSxprUSB(def, root) < 0)
|
xenParseSxprUSB(def, root) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Character device config */
|
/* Character device config */
|
||||||
@ -1283,7 +1283,7 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
tmp = sexpr_node(root, "domain/image/hvm/serial");
|
tmp = sexpr_node(root, "domain/image/hvm/serial");
|
||||||
if (tmp && STRNEQ(tmp, "none")) {
|
if (tmp && STRNEQ(tmp, "none")) {
|
||||||
virDomainChrDefPtr chr;
|
virDomainChrDefPtr chr;
|
||||||
if ((chr = xenDaemonParseSxprChar(tmp, tty)) == NULL)
|
if ((chr = xenParseSxprChar(tmp, tty)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
|
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
|
||||||
virDomainChrDefFree(chr);
|
virDomainChrDefFree(chr);
|
||||||
@ -1296,7 +1296,7 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
if (tmp && STRNEQ(tmp, "none")) {
|
if (tmp && STRNEQ(tmp, "none")) {
|
||||||
virDomainChrDefPtr chr;
|
virDomainChrDefPtr chr;
|
||||||
/* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */
|
/* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */
|
||||||
if ((chr = xenDaemonParseSxprChar(tmp, NULL)) == NULL)
|
if ((chr = xenParseSxprChar(tmp, NULL)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
|
if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
|
||||||
virDomainChrDefFree(chr);
|
virDomainChrDefFree(chr);
|
||||||
@ -1307,7 +1307,7 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Fake a paravirt console, since that's not in the sexpr */
|
/* Fake a paravirt console, since that's not in the sexpr */
|
||||||
if (!(def->console = xenDaemonParseSxprChar("pty", tty)))
|
if (!(def->console = xenParseSxprChar("pty", tty)))
|
||||||
goto error;
|
goto error;
|
||||||
def->console->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
|
def->console->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
|
||||||
def->console->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
def->console->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||||
@ -1319,7 +1319,7 @@ xenDaemonParseSxpr(const struct sexpr *root,
|
|||||||
if (hvm &&
|
if (hvm &&
|
||||||
(tmp = sexpr_node(root, "domain/image/hvm/soundhw")) != NULL &&
|
(tmp = sexpr_node(root, "domain/image/hvm/soundhw")) != NULL &&
|
||||||
*tmp) {
|
*tmp) {
|
||||||
if (xenDaemonParseSxprSound(def, tmp) < 0)
|
if (xenParseSxprSound(def, tmp) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,7 +1334,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenDaemonParseSxprString(const char *sexpr,
|
xenParseSxprString(const char *sexpr,
|
||||||
int xendConfigVersion, char *tty, int vncport)
|
int xendConfigVersion, char *tty, int vncport)
|
||||||
{
|
{
|
||||||
struct sexpr *root = string2sexpr(sexpr);
|
struct sexpr *root = string2sexpr(sexpr);
|
||||||
@ -1343,7 +1343,7 @@ xenDaemonParseSxprString(const char *sexpr,
|
|||||||
if (!root)
|
if (!root)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
def = xenDaemonParseSxpr(root, xendConfigVersion, NULL, tty, vncport);
|
def = xenParseSxpr(root, xendConfigVersion, NULL, tty, vncport);
|
||||||
|
|
||||||
sexpr_free(root);
|
sexpr_free(root);
|
||||||
|
|
||||||
@ -1371,8 +1371,8 @@ xenDaemonParseSxprString(const char *sexpr,
|
|||||||
* 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
|
||||||
xenDaemonFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
|
xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
|
||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
|
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
|
||||||
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||||
@ -1415,9 +1415,9 @@ xenDaemonFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
|
xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
int xendConfigVersion)
|
int xendConfigVersion)
|
||||||
{
|
{
|
||||||
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
|
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
|
||||||
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||||
@ -1457,8 +1457,8 @@ xenDaemonFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenDaemonFormatSxprChr(virDomainChrDefPtr def,
|
xenFormatSxprChr(virDomainChrDefPtr def,
|
||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
const char *type = virDomainChrTypeToString(def->source.type);
|
const char *type = virDomainChrTypeToString(def->source.type);
|
||||||
|
|
||||||
@ -1531,7 +1531,6 @@ xenDaemonFormatSxprChr(virDomainChrDefPtr def,
|
|||||||
/**
|
/**
|
||||||
* virDomainParseXMLDiskDesc:
|
* virDomainParseXMLDiskDesc:
|
||||||
* @node: node containing disk description
|
* @node: node containing disk description
|
||||||
* @conn: pointer to the hypervisor connection
|
|
||||||
* @buf: a buffer for the result S-Expr
|
* @buf: a buffer for the result S-Expr
|
||||||
* @xendConfigVersion: xend configuration file format
|
* @xendConfigVersion: xend configuration file format
|
||||||
*
|
*
|
||||||
@ -1543,12 +1542,12 @@ xenDaemonFormatSxprChr(virDomainChrDefPtr def,
|
|||||||
* Returns 0 in case of success, -1 in case of error.
|
* Returns 0 in case of success, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
|
xenFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
virDomainDiskDefPtr def,
|
virDomainDiskDefPtr def,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion,
|
int xendConfigVersion,
|
||||||
int isAttach)
|
int isAttach)
|
||||||
{
|
{
|
||||||
/* Xend (all versions) put the floppy device config
|
/* Xend (all versions) put the floppy device config
|
||||||
* under the hvm (image (os)) block
|
* under the hvm (image (os)) block
|
||||||
@ -1652,8 +1651,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenDaemonFormatSxprNet
|
* xenFormatSxprNet
|
||||||
* @conn: pointer to the hypervisor connection
|
|
||||||
* @node: node containing the interface description
|
* @node: node containing the interface description
|
||||||
* @buf: a buffer for the result S-Expr
|
* @buf: a buffer for the result S-Expr
|
||||||
* @xendConfigVersion: xend configuration file format
|
* @xendConfigVersion: xend configuration file format
|
||||||
@ -1666,12 +1664,12 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
* Returns 0 in case of success, -1 in case of error.
|
* Returns 0 in case of success, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenDaemonFormatSxprNet(virConnectPtr conn,
|
xenFormatSxprNet(virConnectPtr conn,
|
||||||
virDomainNetDefPtr def,
|
virDomainNetDefPtr def,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion,
|
int xendConfigVersion,
|
||||||
int isAttach)
|
int isAttach)
|
||||||
{
|
{
|
||||||
const char *script = DEFAULT_VIF_SCRIPT;
|
const char *script = DEFAULT_VIF_SCRIPT;
|
||||||
|
|
||||||
@ -1782,8 +1780,8 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xenDaemonFormatSxprPCI(virDomainHostdevDefPtr def,
|
xenFormatSxprPCI(virDomainHostdevDefPtr def,
|
||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
virBufferVSprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))",
|
virBufferVSprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))",
|
||||||
def->source.subsys.u.pci.domain,
|
def->source.subsys.u.pci.domain,
|
||||||
@ -1793,9 +1791,9 @@ xenDaemonFormatSxprPCI(virDomainHostdevDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
|
xenFormatSxprOnePCI(virDomainHostdevDefPtr def,
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
int detach)
|
int detach)
|
||||||
{
|
{
|
||||||
if (def->managed) {
|
if (def->managed) {
|
||||||
XENXS_ERROR(VIR_ERR_NO_SUPPORT, "%s",
|
XENXS_ERROR(VIR_ERR_NO_SUPPORT, "%s",
|
||||||
@ -1804,7 +1802,7 @@ xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virBufferAddLit(buf, "(pci ");
|
virBufferAddLit(buf, "(pci ");
|
||||||
xenDaemonFormatSxprPCI(def, buf);
|
xenFormatSxprPCI(def, buf);
|
||||||
if (detach)
|
if (detach)
|
||||||
virBufferAddLit(buf, "(state 'Closing')");
|
virBufferAddLit(buf, "(state 'Closing')");
|
||||||
else
|
else
|
||||||
@ -1815,8 +1813,8 @@ xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonFormatSxprAllPCI(virDomainDefPtr def,
|
xenFormatSxprAllPCI(virDomainDefPtr def,
|
||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
int hasPCI = 0;
|
int hasPCI = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -1853,7 +1851,7 @@ xenDaemonFormatSxprAllPCI(virDomainDefPtr def,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
xenDaemonFormatSxprPCI(def->hostdevs[i], buf);
|
xenFormatSxprPCI(def->hostdevs[i], buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virBufferAddLit(buf, "))");
|
virBufferAddLit(buf, "))");
|
||||||
@ -1862,8 +1860,8 @@ xenDaemonFormatSxprAllPCI(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenDaemonFormatSxprSound(virDomainDefPtr def,
|
xenFormatSxprSound(virDomainDefPtr def,
|
||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
int i;
|
int i;
|
||||||
@ -1890,8 +1888,8 @@ xenDaemonFormatSxprSound(virDomainDefPtr def,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenDaemonFormatSxprInput(virDomainInputDefPtr input,
|
xenFormatSxprInput(virDomainInputDefPtr input,
|
||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
if (input->bus != VIR_DOMAIN_INPUT_BUS_USB)
|
if (input->bus != VIR_DOMAIN_INPUT_BUS_USB)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1916,7 +1914,7 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input,
|
|||||||
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenDaemonFormatSxpr:
|
* 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
|
* @xendConfigVersion: xend configuration file format
|
||||||
@ -1927,9 +1925,9 @@ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
|||||||
* the caller must free() the returned value.
|
* the caller must free() the returned value.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
xenDaemonFormatSxpr(virConnectPtr conn,
|
xenFormatSxpr(virConnectPtr conn,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def,
|
||||||
int xendConfigVersion)
|
int xendConfigVersion)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
@ -2111,12 +2109,12 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
|||||||
virBufferAddLit(&buf, "(usb 1)");
|
virBufferAddLit(&buf, "(usb 1)");
|
||||||
|
|
||||||
for (i = 0 ; i < def->ninputs ; i++)
|
for (i = 0 ; i < def->ninputs ; i++)
|
||||||
if (xenDaemonFormatSxprInput(def->inputs[i], &buf) < 0)
|
if (xenFormatSxprInput(def->inputs[i], &buf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (def->parallels) {
|
if (def->parallels) {
|
||||||
virBufferAddLit(&buf, "(parallel ");
|
virBufferAddLit(&buf, "(parallel ");
|
||||||
if (xenDaemonFormatSxprChr(def->parallels[0], &buf) < 0)
|
if (xenFormatSxprChr(def->parallels[0], &buf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
virBufferAddLit(&buf, ")");
|
virBufferAddLit(&buf, ")");
|
||||||
} else {
|
} else {
|
||||||
@ -2124,7 +2122,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
if (def->serials) {
|
if (def->serials) {
|
||||||
virBufferAddLit(&buf, "(serial ");
|
virBufferAddLit(&buf, "(serial ");
|
||||||
if (xenDaemonFormatSxprChr(def->serials[0], &buf) < 0)
|
if (xenFormatSxprChr(def->serials[0], &buf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
virBufferAddLit(&buf, ")");
|
virBufferAddLit(&buf, ")");
|
||||||
} else {
|
} else {
|
||||||
@ -2137,7 +2135,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
|||||||
|
|
||||||
if (def->sounds) {
|
if (def->sounds) {
|
||||||
virBufferAddLit(&buf, "(soundhw '");
|
virBufferAddLit(&buf, "(soundhw '");
|
||||||
if (xenDaemonFormatSxprSound(def, &buf) < 0)
|
if (xenFormatSxprSound(def, &buf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
virBufferAddLit(&buf, "')");
|
virBufferAddLit(&buf, "')");
|
||||||
}
|
}
|
||||||
@ -2152,8 +2150,8 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
|||||||
if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF) ||
|
if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF) ||
|
||||||
(hvm && xendConfigVersion < 4)) {
|
(hvm && xendConfigVersion < 4)) {
|
||||||
if ((def->ngraphics == 1) &&
|
if ((def->ngraphics == 1) &&
|
||||||
xenDaemonFormatSxprGraphicsOld(def->graphics[0],
|
xenFormatSxprGraphicsOld(def->graphics[0],
|
||||||
&buf, xendConfigVersion) < 0)
|
&buf, xendConfigVersion) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2161,16 +2159,16 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0 ; i < def->ndisks ; i++)
|
for (i = 0 ; i < def->ndisks ; i++)
|
||||||
if (xenDaemonFormatSxprDisk(conn, def->disks[i],
|
if (xenFormatSxprDisk(conn, def->disks[i],
|
||||||
&buf, hvm, xendConfigVersion, 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 (xenDaemonFormatSxprNet(conn, def->nets[i],
|
if (xenFormatSxprNet(conn, def->nets[i],
|
||||||
&buf, hvm, xendConfigVersion, 0) < 0)
|
&buf, hvm, xendConfigVersion, 0) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (xenDaemonFormatSxprAllPCI(def, &buf) < 0)
|
if (xenFormatSxprAllPCI(def, &buf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* New style PV graphics config xen >= 3.0.4,
|
/* New style PV graphics config xen >= 3.0.4,
|
||||||
@ -2178,7 +2176,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
|||||||
if ((xendConfigVersion >= XEND_CONFIG_MIN_VERS_PVFB_NEWCONF && !hvm) ||
|
if ((xendConfigVersion >= XEND_CONFIG_MIN_VERS_PVFB_NEWCONF && !hvm) ||
|
||||||
(xendConfigVersion >= 4 && hvm)) {
|
(xendConfigVersion >= 4 && hvm)) {
|
||||||
if ((def->ngraphics == 1) &&
|
if ((def->ngraphics == 1) &&
|
||||||
xenDaemonFormatSxprGraphicsNew(def->graphics[0], &buf) < 0)
|
xenFormatSxprGraphicsNew(def->graphics[0], &buf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,53 +36,31 @@
|
|||||||
int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion);
|
int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion);
|
||||||
int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion);
|
int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion);
|
||||||
|
|
||||||
virDomainDefPtr
|
virDomainDefPtr xenParseSxprString(const char *sexpr, int xendConfigVersion,
|
||||||
xenDaemonParseSxprString(const char *sexpr,
|
char *tty, int vncport);
|
||||||
int xendConfigVersion, char *tty, int vncport);
|
|
||||||
|
|
||||||
virDomainDefPtr
|
virDomainDefPtr xenParseSxpr(const struct sexpr *root, int xendConfigVersion,
|
||||||
xenDaemonParseSxpr(const struct sexpr *root,
|
const char *cpus, char *tty, int vncport);
|
||||||
int xendConfigVersion,
|
|
||||||
const char *cpus, char *tty, int vncport);
|
|
||||||
|
|
||||||
int
|
int xenParseSxprSound(virDomainDefPtr def, const char *str);
|
||||||
xenDaemonParseSxprSound(virDomainDefPtr def,
|
|
||||||
const char *str);
|
|
||||||
|
|
||||||
virDomainChrDefPtr
|
virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty);
|
||||||
xenDaemonParseSxprChar(const char *value,
|
|
||||||
const char *tty);
|
|
||||||
|
|
||||||
int
|
int xenFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
|
virDomainDiskDefPtr def, virBufferPtr buf, int hvm,
|
||||||
virDomainDiskDefPtr def,
|
int xendConfigVersion, int isAttach);
|
||||||
virBufferPtr buf,
|
|
||||||
int hvm,
|
|
||||||
int xendConfigVersion,
|
|
||||||
int isAttach);
|
|
||||||
int
|
|
||||||
xenDaemonFormatSxprNet(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
||||||
virDomainNetDefPtr def,
|
|
||||||
virBufferPtr buf,
|
|
||||||
int hvm,
|
|
||||||
int xendConfigVersion,
|
|
||||||
int isAttach);
|
|
||||||
|
|
||||||
int
|
int xenFormatSxprNet(virConnectPtr conn,
|
||||||
xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
|
virDomainNetDefPtr def, virBufferPtr buf, int hvm,
|
||||||
virBufferPtr buf,
|
int xendConfigVersion, int isAttach);
|
||||||
int detach);
|
|
||||||
|
|
||||||
int
|
int xenFormatSxprOnePCI(virDomainHostdevDefPtr def, virBufferPtr buf,
|
||||||
xenDaemonFormatSxprChr(virDomainChrDefPtr def,
|
int detach);
|
||||||
virBufferPtr buf);
|
|
||||||
int
|
|
||||||
xenDaemonFormatSxprSound(virDomainDefPtr def,
|
|
||||||
virBufferPtr buf);
|
|
||||||
|
|
||||||
char *
|
int xenFormatSxprChr(virDomainChrDefPtr def, virBufferPtr buf);
|
||||||
xenDaemonFormatSxpr(virConnectPtr conn,
|
int xenFormatSxprSound(virDomainDefPtr def, virBufferPtr buf);
|
||||||
virDomainDefPtr def,
|
|
||||||
int xendConfigVersion);
|
char * xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def,
|
||||||
|
int xendConfigVersion);
|
||||||
|
|
||||||
#endif /* __VIR_XEN_SXPR_H__ */
|
#endif /* __VIR_XEN_SXPR_H__ */
|
||||||
|
@ -196,7 +196,7 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *
|
|||||||
* domain, suitable for later feeding for virDomainCreateXML
|
* domain, suitable for later feeding for virDomainCreateXML
|
||||||
*/
|
*/
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion,
|
xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||||
virCapsPtr caps) {
|
virCapsPtr caps) {
|
||||||
const char *str;
|
const char *str;
|
||||||
int hvm = 0;
|
int hvm = 0;
|
||||||
@ -951,7 +951,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion,
|
|||||||
if (xenXMConfigGetString(conf, "parallel", &str, NULL) < 0)
|
if (xenXMConfigGetString(conf, "parallel", &str, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (str && STRNEQ(str, "none") &&
|
if (str && STRNEQ(str, "none") &&
|
||||||
!(chr = xenDaemonParseSxprChar(str, NULL)))
|
!(chr = xenParseSxprChar(str, NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (chr) {
|
if (chr) {
|
||||||
@ -968,7 +968,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion,
|
|||||||
if (xenXMConfigGetString(conf, "serial", &str, NULL) < 0)
|
if (xenXMConfigGetString(conf, "serial", &str, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (str && STRNEQ(str, "none") &&
|
if (str && STRNEQ(str, "none") &&
|
||||||
!(chr = xenDaemonParseSxprChar(str, NULL)))
|
!(chr = xenParseSxprChar(str, NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (chr) {
|
if (chr) {
|
||||||
@ -981,7 +981,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion,
|
|||||||
def->nserials++;
|
def->nserials++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(def->console = xenDaemonParseSxprChar("pty", NULL)))
|
if (!(def->console = xenParseSxprChar("pty", NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
def->console->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
|
def->console->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
|
||||||
def->console->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
def->console->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||||
@ -992,7 +992,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (str &&
|
if (str &&
|
||||||
xenDaemonParseSxprSound(def, str) < 0)
|
xenParseSxprSound(def, str) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1048,7 +1048,7 @@ int xenXMConfigSetString(virConfPtr conf, const char *setting, const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int xenXMDomainConfigFormatDisk(virConfValuePtr list,
|
static int xenFormatXMDisk(virConfValuePtr list,
|
||||||
virDomainDiskDefPtr disk,
|
virDomainDiskDefPtr disk,
|
||||||
int hvm,
|
int hvm,
|
||||||
int xendConfigVersion)
|
int xendConfigVersion)
|
||||||
@ -1120,7 +1120,7 @@ cleanup:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xenXMDomainConfigFormatNet(virConnectPtr conn,
|
static int xenFormatXMNet(virConnectPtr conn,
|
||||||
virConfValuePtr list,
|
virConfValuePtr list,
|
||||||
virDomainNetDefPtr net,
|
virDomainNetDefPtr net,
|
||||||
int hvm, int xendConfigVersion)
|
int hvm, int xendConfigVersion)
|
||||||
@ -1232,7 +1232,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenXMDomainConfigFormatPCI(virConfPtr conf,
|
xenFormatXMPCI(virConfPtr conf,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1308,7 +1308,7 @@ error:
|
|||||||
either 32, or 64 on a platform where long is big enough. */
|
either 32, or 64 on a platform where long is big enough. */
|
||||||
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||||
|
|
||||||
virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
virConfPtr xenFormatXM(virConnectPtr conn,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def,
|
||||||
int xendConfigVersion) {
|
int xendConfigVersion) {
|
||||||
virConfPtr conf = NULL;
|
virConfPtr conf = NULL;
|
||||||
@ -1626,8 +1626,8 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
|||||||
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
|
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (xenXMDomainConfigFormatDisk(diskVal, def->disks[i],
|
if (xenFormatXMDisk(diskVal, def->disks[i],
|
||||||
hvm, xendConfigVersion) < 0)
|
hvm, xendConfigVersion) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (diskVal->list != NULL) {
|
if (diskVal->list != NULL) {
|
||||||
@ -1644,9 +1644,8 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
|||||||
netVal->list = NULL;
|
netVal->list = NULL;
|
||||||
|
|
||||||
for (i = 0 ; i < def->nnets ; i++) {
|
for (i = 0 ; i < def->nnets ; i++) {
|
||||||
if (xenXMDomainConfigFormatNet(conn, netVal,
|
if (xenFormatXMNet(conn, netVal,def->nets[i],
|
||||||
def->nets[i],
|
hvm, xendConfigVersion) < 0)
|
||||||
hvm, xendConfigVersion) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (netVal->list != NULL) {
|
if (netVal->list != NULL) {
|
||||||
@ -1657,7 +1656,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
VIR_FREE(netVal);
|
VIR_FREE(netVal);
|
||||||
|
|
||||||
if (xenXMDomainConfigFormatPCI(conf, def) < 0)
|
if (xenFormatXMPCI(conf, def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (hvm) {
|
if (hvm) {
|
||||||
@ -1666,7 +1665,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
|||||||
char *str;
|
char *str;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = xenDaemonFormatSxprChr(def->parallels[0], &buf);
|
ret = xenFormatSxprChr(def->parallels[0], &buf);
|
||||||
str = virBufferContentAndReset(&buf);
|
str = virBufferContentAndReset(&buf);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = xenXMConfigSetString(conf, "parallel", str);
|
ret = xenXMConfigSetString(conf, "parallel", str);
|
||||||
@ -1683,7 +1682,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
|||||||
char *str;
|
char *str;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = xenDaemonFormatSxprChr(def->serials[0], &buf);
|
ret = xenFormatSxprChr(def->serials[0], &buf);
|
||||||
str = virBufferContentAndReset(&buf);
|
str = virBufferContentAndReset(&buf);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = xenXMConfigSetString(conf, "serial", str);
|
ret = xenXMConfigSetString(conf, "serial", str);
|
||||||
@ -1699,7 +1698,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
|||||||
if (def->sounds) {
|
if (def->sounds) {
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
int ret = xenDaemonFormatSxprSound(def, &buf);
|
int ret = xenFormatSxprSound(def, &buf);
|
||||||
str = virBufferContentAndReset(&buf);
|
str = virBufferContentAndReset(&buf);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = xenXMConfigSetString(conf, "soundhw", str);
|
ret = xenXMConfigSetString(conf, "soundhw", str);
|
||||||
|
@ -30,10 +30,10 @@
|
|||||||
# include "conf.h"
|
# include "conf.h"
|
||||||
# include "domain_conf.h"
|
# include "domain_conf.h"
|
||||||
|
|
||||||
virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, virDomainDefPtr def,
|
virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def,
|
||||||
int xendConfigVersion);
|
int xendConfigVersion);
|
||||||
|
|
||||||
virDomainDefPtr xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion,
|
virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||||
virCapsPtr caps);
|
virCapsPtr caps);
|
||||||
|
|
||||||
#endif /* __VIR_XEN_XM_H__ */
|
#endif /* __VIR_XEN_XM_H__ */
|
||||||
|
@ -58,8 +58,7 @@ static int testCompareFiles(const char *xml, const char *sexpr,
|
|||||||
vncport = xenStoreDomainGetVNCPort(conn, id);
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
||||||
xenUnifiedUnlock(&priv);
|
xenUnifiedUnlock(&priv);
|
||||||
|
|
||||||
if (!(def = xenDaemonParseSxprString(sexprData, xendConfigVersion, tty,
|
if (!(def = xenParseSxprString(sexprData, xendConfigVersion, tty, vncport)))
|
||||||
vncport)))
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(gotxml = virDomainDefFormat(def, 0)))
|
if (!(gotxml = virDomainDefFormat(def, 0)))
|
||||||
|
@ -75,7 +75,7 @@ static int testCompareParseXML(const char *xmcfg, const char *xml,
|
|||||||
VIR_DOMAIN_XML_INACTIVE)))
|
VIR_DOMAIN_XML_INACTIVE)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(conf = xenXMDomainConfigFormat(conn, def, xendConfigVersion)))
|
if (!(conf = xenFormatXM(conn, def, xendConfigVersion)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virConfWriteMem(gotxmcfgPtr, &wrote, conf) < 0)
|
if (virConfWriteMem(gotxmcfgPtr, &wrote, conf) < 0)
|
||||||
@ -128,7 +128,7 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml,
|
|||||||
if (!(conf = virConfReadMem(xmcfgPtr, strlen(xmcfgPtr), 0)))
|
if (!(conf = virConfReadMem(xmcfgPtr, strlen(xmcfgPtr), 0)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(def = xenXMDomainConfigParse(conf, priv.xendConfigVersion, priv.caps)))
|
if (!(def = xenParseXM(conf, priv.xendConfigVersion, priv.caps)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
|
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
|
||||||
|
@ -40,7 +40,7 @@ static int testCompareFiles(const char *xml, const char *sexpr,
|
|||||||
VIR_DOMAIN_XML_INACTIVE)))
|
VIR_DOMAIN_XML_INACTIVE)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(gotsexpr = xenDaemonFormatSxpr(NULL, def, xendConfigVersion)))
|
if (!(gotsexpr = xenFormatSxpr(NULL, def, xendConfigVersion)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (STRNEQ(sexprData, gotsexpr)) {
|
if (STRNEQ(sexprData, gotsexpr)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user