mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-11 06:01:33 +00:00
Added support for <driver> element and blktap
This commit is contained in:
parent
a98ac28b16
commit
16a65d1c93
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Mon Oct 9 09:34:42 EDT 2006 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/xml.c, src/xend_internal.c: Added support for a <driver>
|
||||
element in disk specification, allowing use of alternate Xen
|
||||
drivers such as blktap.
|
||||
* tests/xml2sexprtest.c, tests/sexpr2xmltest.c: Added tests for
|
||||
new <driver> element, and blktap driver impl.
|
||||
* tests/xml2sexprdata/*, tests/sexpr2xmldata/*: New / updated
|
||||
data files for new <driver> element
|
||||
|
||||
Fri Oct 6 10:33:20 EDT 2006 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/xend_internal.c: Fixed memory leak in xend_get_config_version
|
||||
|
@ -1451,7 +1451,7 @@ xend_parse_sexp_desc_os(struct sexpr *node, virBufferPtr buf, int hvm)
|
||||
|
||||
/**
|
||||
* xend_parse_sexp_desc:
|
||||
* @domain: the domain associated with the XML
|
||||
* @conn: the connection associated with the XML
|
||||
* @root: the root of the parsed S-Expression
|
||||
*
|
||||
* Parse the xend sexp description and turn it into the XML format similar
|
||||
@ -1487,7 +1487,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
|
||||
tmp = sexpr_node(root, "domain/name");
|
||||
if (tmp == NULL) {
|
||||
virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("domain information incomplete, missing name"));
|
||||
goto error;
|
||||
}
|
||||
@ -1498,10 +1498,11 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
int i, j;
|
||||
for (i = 0, j = 0;(i < 32) && (tmp[j] != 0);j++) {
|
||||
if (((tmp[j] >= '0') && (tmp[j] <= '9')) ||
|
||||
((tmp[j] >= 'a') && (tmp[j] <= 'f')))
|
||||
compact[i++] = tmp[j];
|
||||
else if ((tmp[j] >= 'A') && (tmp[j] <= 'F'))
|
||||
((tmp[j] >= 'a') && (tmp[j] <= 'f'))) {
|
||||
compact[i++] = tmp[j];
|
||||
} else if ((tmp[j] >= 'A') && (tmp[j] <= 'F')) {
|
||||
compact[i++] = tmp[j] + 'a' - 'A';
|
||||
}
|
||||
}
|
||||
compact[i] = 0;
|
||||
if (i > 0)
|
||||
@ -1509,7 +1510,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
}
|
||||
tmp = sexpr_node(root, "domain/bootloader");
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", tmp);
|
||||
virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", tmp);
|
||||
|
||||
if (sexpr_lookup(root, "domain/image")) {
|
||||
hvm = sexpr_lookup(root, "domain/image/hvm") ? 1 : 0;
|
||||
@ -1522,13 +1523,13 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
sexpr_int(root, "domain/vcpus"));
|
||||
tmp = sexpr_node(root, "domain/on_poweroff");
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <on_poweroff>%s</on_poweroff>\n", tmp);
|
||||
virBufferVSprintf(&buf, " <on_poweroff>%s</on_poweroff>\n", tmp);
|
||||
tmp = sexpr_node(root, "domain/on_reboot");
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <on_reboot>%s</on_reboot>\n", tmp);
|
||||
virBufferVSprintf(&buf, " <on_reboot>%s</on_reboot>\n", tmp);
|
||||
tmp = sexpr_node(root, "domain/on_crash");
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <on_crash>%s</on_crash>\n", tmp);
|
||||
virBufferVSprintf(&buf, " <on_crash>%s</on_crash>\n", tmp);
|
||||
|
||||
if (hvm) {
|
||||
virBufferAdd(&buf, " <features>\n", 13);
|
||||
@ -1546,105 +1547,150 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
/* in case of HVM we have devices emulation */
|
||||
tmp = sexpr_node(root, "domain/image/hvm/device_model");
|
||||
if ((tmp != NULL) && (tmp[0] != 0))
|
||||
virBufferVSprintf(&buf, " <emulator>%s</emulator>\n", tmp);
|
||||
virBufferVSprintf(&buf, " <emulator>%s</emulator>\n", tmp);
|
||||
|
||||
for (cur = root; cur->kind == SEXPR_CONS; cur = cur->cdr) {
|
||||
node = cur->car;
|
||||
if (sexpr_lookup(node, "device/vbd")) {
|
||||
tmp = sexpr_node(node, "device/vbd/uname");
|
||||
if (tmp == NULL)
|
||||
continue;
|
||||
if (!memcmp(tmp, "file:", 5)) {
|
||||
int cdrom = 0;
|
||||
const char *src = tmp+5;
|
||||
const char *dst = sexpr_node(node, "device/vbd/dev");
|
||||
/* Normally disks are in a (device (vbd ...)) block
|
||||
but blktap disks ended up in a differently named
|
||||
(device (tap ....)) block.... */
|
||||
if (sexpr_lookup(node, "device/vbd") ||
|
||||
sexpr_lookup(node, "device/tap")) {
|
||||
char *offset;
|
||||
int isBlock = 0;
|
||||
int cdrom = 0;
|
||||
char *drvName = NULL;
|
||||
char *drvType = NULL;
|
||||
const char *src = NULL;
|
||||
const char *dst = NULL;
|
||||
const char *mode = NULL;
|
||||
|
||||
if (dst == NULL) {
|
||||
virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("domain information incomplete, vbd has no dev"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!strncmp(dst, "ioemu:", 6))
|
||||
dst += 6;
|
||||
/* New style disk config from Xen >= 3.0.3 */
|
||||
if (xendConfigVersion > 1) {
|
||||
char *offset = rindex(dst, ':');
|
||||
if (offset) {
|
||||
if (!strcmp(offset, ":cdrom")) {
|
||||
cdrom = 1;
|
||||
} else if (!strcmp(offset, ":disk")) {
|
||||
/* defualt anyway */
|
||||
} else {
|
||||
/* Unknown, lets pretend its a disk */
|
||||
}
|
||||
offset[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
virBufferVSprintf(&buf, " <disk type='file' device='%s'>\n", cdrom ? "cdrom" : "disk");
|
||||
virBufferVSprintf(&buf, " <source file='%s'/>\n", src);
|
||||
virBufferVSprintf(&buf, " <target dev='%s'/>\n", dst);
|
||||
tmp = sexpr_node(node, "device/vbd/mode");
|
||||
/* XXX should we force mode == r, if cdrom==1, or assume
|
||||
xend has already done this ? */
|
||||
if ((tmp != NULL) && (!strcmp(tmp, "r")))
|
||||
virBufferVSprintf(&buf, " <readonly/>\n");
|
||||
virBufferAdd(&buf, " </disk>\n", 12);
|
||||
} else if (!memcmp(tmp, "phy:", 4)) {
|
||||
int cdrom = 0;
|
||||
const char *src = tmp+4;
|
||||
const char *dst = sexpr_node(node, "device/vbd/dev");
|
||||
|
||||
if (dst == NULL) {
|
||||
virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("domain information incomplete, vbd has no dev"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!strncmp(dst, "ioemu:", 6))
|
||||
dst += 6;
|
||||
/* New style cdrom config from Xen >= 3.0.3 */
|
||||
if (xendConfigVersion > 1) {
|
||||
char *offset = rindex(dst, ':');
|
||||
if (offset) {
|
||||
if (!strcmp(offset, ":cdrom")) {
|
||||
cdrom = 1;
|
||||
} else if (!strcmp(offset, ":disk")) {
|
||||
/* defualt anyway */
|
||||
} else {
|
||||
/* Unknown, lets pretend its a disk */
|
||||
}
|
||||
offset[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
virBufferVSprintf(&buf, " <disk type='block' device='%s'>\n", cdrom ? "cdrom" : "disk");
|
||||
virBufferVSprintf(&buf, " <source dev='%s'/>\n", src);
|
||||
virBufferVSprintf(&buf, " <target dev='%s'/>\n", dst);
|
||||
tmp = sexpr_node(node, "device/vbd/mode");
|
||||
/* XXX should we force mode == r, if cdrom==1, or assume
|
||||
xend has already done this ? */
|
||||
if ((tmp != NULL) && (!strcmp(tmp, "r")))
|
||||
virBufferVSprintf(&buf, " <readonly/>\n");
|
||||
virBufferAdd(&buf, " </disk>\n", 12);
|
||||
/* Again dealing with (vbd...) vs (tap ...) differences */
|
||||
if (sexpr_lookup(node, "device/vbd")) {
|
||||
src = sexpr_node(node, "device/vbd/uname");
|
||||
dst = sexpr_node(node, "device/vbd/dev");
|
||||
mode = sexpr_node(node, "device/vbd/mode");
|
||||
} else {
|
||||
char serial[1000];
|
||||
src = sexpr_node(node, "device/tap/uname");
|
||||
dst = sexpr_node(node, "device/tap/dev");
|
||||
mode = sexpr_node(node, "device/tap/mode");
|
||||
}
|
||||
|
||||
TODO sexpr2string(node, serial, 1000);
|
||||
virBufferVSprintf(&buf, "<!-- Failed to parse %s -->\n",
|
||||
serial);
|
||||
TODO}
|
||||
if (src == NULL) {
|
||||
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("domain information incomplete, vbd has no src"));
|
||||
goto bad_parse;
|
||||
}
|
||||
|
||||
if (dst == NULL) {
|
||||
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("domain information incomplete, vbd has no dev"));
|
||||
goto bad_parse;
|
||||
}
|
||||
|
||||
|
||||
offset = strchr(src, ':');
|
||||
if (!offset) {
|
||||
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse vbd filename, missing driver name"));
|
||||
goto bad_parse;
|
||||
}
|
||||
|
||||
drvName = malloc((offset-src)+1);
|
||||
if (!drvName) {
|
||||
virXendError(conn, VIR_ERR_NO_MEMORY,
|
||||
_("allocate new buffer"));
|
||||
goto bad_parse;
|
||||
}
|
||||
strncpy(drvName, src, (offset-src));
|
||||
drvName[offset-src] = '\0';
|
||||
|
||||
src = offset + 1;
|
||||
|
||||
if (!strcmp(drvName, "tap")) {
|
||||
offset = strchr(src, ':');
|
||||
if (!offset) {
|
||||
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse vbd filename, missing driver type"));
|
||||
goto bad_parse;
|
||||
}
|
||||
|
||||
drvType = malloc((offset-src)+1);
|
||||
if (!drvType) {
|
||||
virXendError(conn, VIR_ERR_NO_MEMORY,
|
||||
_("allocate new buffer"));
|
||||
goto bad_parse;
|
||||
}
|
||||
strncpy(drvType, src, (offset-src));
|
||||
drvType[offset-src] = '\0';
|
||||
src = offset + 1;
|
||||
/* Its possible to use blktap driver for block devs
|
||||
too, but kinda pointless because blkback is better,
|
||||
so we assume common case here. If blktap becomes
|
||||
omnipotent, we can revisit this, perhaps stat()'ing
|
||||
the src file in question */
|
||||
isBlock = 0;
|
||||
} else if (!strcmp(drvName, "phy")) {
|
||||
isBlock = 1;
|
||||
} else if (!strcmp(drvName, "file")) {
|
||||
isBlock = 0;
|
||||
}
|
||||
|
||||
if (!strncmp(dst, "ioemu:", 6))
|
||||
dst += 6;
|
||||
|
||||
/* New style disk config from Xen >= 3.0.3 */
|
||||
if (xendConfigVersion > 1) {
|
||||
offset = rindex(dst, ':');
|
||||
if (offset) {
|
||||
if (!strcmp(offset, ":cdrom")) {
|
||||
cdrom = 1;
|
||||
} else if (!strcmp(offset, ":disk")) {
|
||||
/* The default anyway */
|
||||
} else {
|
||||
/* Unknown, lets pretend its a disk too */
|
||||
}
|
||||
offset[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
virBufferVSprintf(&buf, " <disk type='%s' device='%s'>\n",
|
||||
isBlock ? "block" : "file",
|
||||
cdrom ? "cdrom" : "disk");
|
||||
if (drvType) {
|
||||
virBufferVSprintf(&buf, " <driver name='%s' type='%s'/>\n", drvName, drvType);
|
||||
} else {
|
||||
virBufferVSprintf(&buf, " <driver name='%s'/>\n", drvName);
|
||||
}
|
||||
if (isBlock) {
|
||||
virBufferVSprintf(&buf, " <source dev='%s'/>\n", src);
|
||||
} else {
|
||||
virBufferVSprintf(&buf, " <source file='%s'/>\n", src);
|
||||
}
|
||||
virBufferVSprintf(&buf, " <target dev='%s'/>\n", dst);
|
||||
|
||||
|
||||
/* XXX should we force mode == r, if cdrom==1, or assume
|
||||
xend has already done this ? */
|
||||
if ((mode != NULL) && (!strcmp(mode, "r")))
|
||||
virBufferVSprintf(&buf, " <readonly/>\n");
|
||||
virBufferAdd(&buf, " </disk>\n", 12);
|
||||
|
||||
bad_parse:
|
||||
if (drvName)
|
||||
free(drvName);
|
||||
if (drvType)
|
||||
free(drvType);
|
||||
} else if (sexpr_lookup(node, "device/vif")) {
|
||||
const char *tmp2;
|
||||
const char *tmp2;
|
||||
|
||||
tmp = sexpr_node(node, "device/vif/bridge");
|
||||
tmp2 = sexpr_node(node, "device/vif/script");
|
||||
tmp2 = sexpr_node(node, "device/vif/script");
|
||||
if ((tmp != NULL) || (strstr(tmp2, "bridge"))) {
|
||||
virBufferVSprintf(&buf, " <interface type='bridge'>\n");
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <source bridge='%s'/>\n",
|
||||
tmp);
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <source bridge='%s'/>\n",
|
||||
tmp);
|
||||
tmp = sexpr_node(node, "device/vif/vifname");
|
||||
if (tmp != NULL)
|
||||
virBufferVSprintf(&buf, " <target dev='%s'/>\n",
|
||||
@ -1688,10 +1734,11 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
}
|
||||
|
||||
/* Old style cdrom config from Xen <= 3.0.2 */
|
||||
if (xendConfigVersion == 1) {
|
||||
if (xendConfigVersion == 1) {
|
||||
tmp = sexpr_node(root, "domain/image/hvm/cdrom");
|
||||
if ((tmp != NULL) && (tmp[0] != 0)) {
|
||||
virBufferAdd(&buf, " <disk type='file' device='cdrom'>\n", 38);
|
||||
virBufferAdd(&buf, " <driver name='file'/>\n", 28);
|
||||
virBufferVSprintf(&buf, " <source file='%s'/>\n", tmp);
|
||||
virBufferAdd(&buf, " <target dev='hdc'/>\n", 26);
|
||||
virBufferAdd(&buf, " <readonly/>\n", 18);
|
||||
|
51
src/xml.c
51
src/xml.c
@ -931,6 +931,8 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
||||
xmlChar *device = NULL;
|
||||
xmlChar *source = NULL;
|
||||
xmlChar *target = NULL;
|
||||
xmlChar *drvName = NULL;
|
||||
xmlChar *drvType = NULL;
|
||||
int ro = 0;
|
||||
int typ = 0;
|
||||
int cdrom = 0;
|
||||
@ -958,6 +960,11 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
||||
} else if ((target == NULL) &&
|
||||
(xmlStrEqual(cur->name, BAD_CAST "target"))) {
|
||||
target = xmlGetProp(cur, BAD_CAST "dev");
|
||||
} else if ((drvName == NULL) &&
|
||||
(xmlStrEqual(cur->name, BAD_CAST "driver"))) {
|
||||
drvName = xmlGetProp(cur, BAD_CAST "name");
|
||||
if (drvName && !strcmp((const char *)drvName, "tap"))
|
||||
drvType = xmlGetProp(cur, BAD_CAST "type");
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
|
||||
ro = 1;
|
||||
}
|
||||
@ -1004,7 +1011,14 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
||||
|
||||
|
||||
virBufferAdd(buf, "(device ", 8);
|
||||
virBufferAdd(buf, "(vbd ", 5);
|
||||
/* Normally disks are in a (device (vbd ...)) block
|
||||
but blktap disks ended up in a differently named
|
||||
(device (tap ....)) block.... */
|
||||
if (drvName && !strcmp((const char *)drvName, "tap")) {
|
||||
virBufferAdd(buf, "(tap ", 5);
|
||||
} else {
|
||||
virBufferAdd(buf, "(vbd ", 5);
|
||||
}
|
||||
|
||||
if (hvm) {
|
||||
char *tmp = (char *)target;
|
||||
@ -1014,19 +1028,32 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
||||
|
||||
/* Xend <= 3.0.2 wants a ioemu: prefix on devices for HVM */
|
||||
if (xendConfigVersion == 1)
|
||||
virBufferVSprintf(buf, "(dev 'ioemu:%s')", (const char *) tmp);
|
||||
virBufferVSprintf(buf, "(dev 'ioemu:%s')", (const char *)tmp);
|
||||
else /* But newer does not */
|
||||
virBufferVSprintf(buf, "(dev '%s%s')", (const char *) tmp, cdrom ? ":cdrom" : ":disk");
|
||||
virBufferVSprintf(buf, "(dev '%s%s')", (const char *)tmp, cdrom ? ":cdrom" : ":disk");
|
||||
} else
|
||||
virBufferVSprintf(buf, "(dev '%s')", (const char *) target);
|
||||
virBufferVSprintf(buf, "(dev '%s')", (const char *)target);
|
||||
|
||||
if (typ == 0)
|
||||
virBufferVSprintf(buf, "(uname 'file:%s')", source);
|
||||
else if (typ == 1) {
|
||||
if (source[0] == '/')
|
||||
virBufferVSprintf(buf, "(uname 'phy:%s')", source);
|
||||
else
|
||||
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", source);
|
||||
if (drvName) {
|
||||
if (!strcmp((const char *)drvName, "tap")) {
|
||||
virBufferVSprintf(buf, "(uname '%s:%s:%s')",
|
||||
(const char *)drvName,
|
||||
(drvType ? (const char *)drvType : "aio"),
|
||||
(const char *)source);
|
||||
} else {
|
||||
virBufferVSprintf(buf, "(uname '%s:%s')",
|
||||
(const char *)drvName,
|
||||
(const char *)source);
|
||||
}
|
||||
} else {
|
||||
if (typ == 0)
|
||||
virBufferVSprintf(buf, "(uname 'file:%s')", source);
|
||||
else if (typ == 1) {
|
||||
if (source[0] == '/')
|
||||
virBufferVSprintf(buf, "(uname 'phy:%s')", source);
|
||||
else
|
||||
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", source);
|
||||
}
|
||||
}
|
||||
if (ro == 0)
|
||||
virBufferVSprintf(buf, "(mode 'w')");
|
||||
@ -1037,6 +1064,8 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
||||
virBufferAdd(buf, ")", 1);
|
||||
|
||||
cleanup:
|
||||
xmlFree(drvType);
|
||||
xmlFree(drvName);
|
||||
xmlFree(device);
|
||||
xmlFree(target);
|
||||
xmlFree(source);
|
||||
|
2
tests/sexpr2xmldata/sexpr2xml-disk-block.sexpr
Normal file
2
tests/sexpr2xmldata/sexpr2xml-disk-block.sexpr
Normal file
@ -0,0 +1,2 @@
|
||||
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'phy:/dev/MainVG/GuestVG')(mode 'w'))))
|
||||
|
22
tests/sexpr2xmldata/sexpr2xml-disk-block.xml
Normal file
22
tests/sexpr2xmldata/sexpr2xml-disk-block.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<domain type='xen' id='6'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='phy'/>
|
||||
<source dev='/dev/MainVG/GuestVG'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
</devices>
|
||||
</domain>
|
2
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.sexpr
Normal file
2
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.sexpr
Normal file
@ -0,0 +1,2 @@
|
||||
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (tap (dev 'xvda')(uname 'tap:qcow:/root/some.img')(mode 'w'))))
|
||||
|
22
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml
Normal file
22
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<domain type='xen' id='6'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='qcow'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
</devices>
|
||||
</domain>
|
2
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.sexpr
Normal file
2
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.sexpr
Normal file
@ -0,0 +1,2 @@
|
||||
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (tap (dev 'xvda')(uname 'tap:aio:/root/some.img')(mode 'w'))))
|
||||
|
22
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml
Normal file
22
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<domain type='xen' id='6'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='aio'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
</devices>
|
||||
</domain>
|
2
tests/sexpr2xmldata/sexpr2xml-disk-file.sexpr
Normal file
2
tests/sexpr2xmldata/sexpr2xml-disk-file.sexpr
Normal file
@ -0,0 +1,2 @@
|
||||
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
|
||||
|
22
tests/sexpr2xmldata/sexpr2xml-disk-file.xml
Normal file
22
tests/sexpr2xmldata/sexpr2xml-disk-file.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<domain type='xen' id='6'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
</devices>
|
||||
</domain>
|
@ -17,11 +17,13 @@
|
||||
<devices>
|
||||
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/foo.img'/>
|
||||
<target dev='hda'/>
|
||||
</disk>
|
||||
|
@ -17,6 +17,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/foo.img'/>
|
||||
<target dev='hda'/>
|
||||
</disk>
|
||||
@ -26,6 +27,7 @@
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -67,6 +66,31 @@ static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskFile(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-file.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-file.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareDiskBlock(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-block.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-block.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlktapQcow(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlktapRaw(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -75,25 +99,41 @@ main(int argc, char **argv)
|
||||
progname = argv[0];
|
||||
|
||||
if (argc > 1) {
|
||||
fprintf(stderr, "Usage: %s\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
fprintf(stderr, "Usage: %s\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML PV config (version 1)",
|
||||
1, testComparePVversion1, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML FV config (version 1)",
|
||||
1, testCompareFVversion1, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML PV config (version 2)",
|
||||
1, testComparePVversion2, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML FV config (version 2)",
|
||||
1, testCompareFVversion2, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML Disk File config",
|
||||
1, testCompareDiskFile, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML Disk Block config",
|
||||
1, testCompareDiskBlock, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML Disk Driver blktap qcow config",
|
||||
1, testCompareDiskDrvBlktapQcow, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML Disk Driver blktap raw config",
|
||||
1, testCompareDiskDrvBlktapRaw, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-block.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-block.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'phy:/dev/MainVG/GuestLV')(mode 'w'))))
|
23
tests/xml2sexprdata/xml2sexpr-disk-block.xml
Normal file
23
tests/xml2sexprdata/xml2sexpr-disk-block.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='block' device='disk'>
|
||||
<source dev='/dev/MainVG/GuestLV'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'phy:/dev/MainVG/GuestLV')(mode 'w'))))
|
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml
Normal file
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name="phy"/>
|
||||
<source dev='/dev/MainVG/GuestLV'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (tap (dev 'xvda')(uname 'tap:qcow:/root/some.img')(mode 'w'))))
|
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml
Normal file
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name="tap" type="qcow"/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (tap (dev 'xvda')(uname 'tap:aio:/root/some.img')(mode 'w'))))
|
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml
Normal file
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name="tap" type="aio"/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (tap (dev 'xvda')(uname 'tap:aio:/root/some.img')(mode 'w'))))
|
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml
Normal file
24
tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name="tap"/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-drv-loop.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-drv-loop.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
|
24
tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml
Normal file
24
tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name="file"/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
1
tests/xml2sexprdata/xml2sexpr-disk-file.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-disk-file.sexpr
Normal file
@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
|
23
tests/xml2sexprdata/xml2sexpr-disk-file.xml
Normal file
23
tests/xml2sexprdata/xml2sexpr-disk-file.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -78,9 +77,58 @@ static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
|
||||
|
||||
static int testCompareFVversion2VNC(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-fv-vncunused.xml",
|
||||
"xml2sexprdata/xml2sexpr-fv-vncunused.sexpr",
|
||||
"fvtest",
|
||||
2);
|
||||
"xml2sexprdata/xml2sexpr-fv-vncunused.sexpr",
|
||||
"fvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskFile(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-file.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-file.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskBlock(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-block.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-block.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvLoop(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-loop.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-drv-loop.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlkback(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blkback.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-drv-blkback.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlktap(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blktap.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-drv-blktap.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlktapQcow(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlktapRaw(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml",
|
||||
"xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
int
|
||||
@ -91,29 +139,58 @@ main(int argc, char **argv)
|
||||
progname = argv[0];
|
||||
|
||||
if (argc > 1) {
|
||||
fprintf(stderr, "Usage: %s\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
fprintf(stderr, "Usage: %s\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR PV config (format 1)",
|
||||
1, testComparePVversion1, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR FV config (format 1)",
|
||||
1, testCompareFVversion1, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR PV config (format 2)",
|
||||
1, testComparePVversion2, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR FV config (format 2)",
|
||||
1, testCompareFVversion2, NULL) != 0)
|
||||
ret = -1;
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR FV config (format 2, VNC unused)",
|
||||
1, testCompareFVversion2VNC, NULL) != 0)
|
||||
ret = -1;
|
||||
1, testCompareFVversion2VNC, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk File",
|
||||
1, testCompareDiskFile, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk Block",
|
||||
1, testCompareDiskBlock, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk Drv Loop",
|
||||
1, testCompareDiskDrvLoop, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk Drv Blkback",
|
||||
1, testCompareDiskDrvBlkback, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk Drv Blktap",
|
||||
1, testCompareDiskDrvBlktap, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk Drv Blktap QCow",
|
||||
1, testCompareDiskDrvBlktapQcow, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Disk Drv Blktap Raw",
|
||||
1, testCompareDiskDrvBlktapRaw, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user