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>
|
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
|
* 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:
|
* 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
|
* @root: the root of the parsed S-Expression
|
||||||
*
|
*
|
||||||
* Parse the xend sexp description and turn it into the XML format similar
|
* 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");
|
tmp = sexpr_node(root, "domain/name");
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("domain information incomplete, missing name"));
|
_("domain information incomplete, missing name"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1498,11 +1498,12 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||||||
int i, j;
|
int i, j;
|
||||||
for (i = 0, j = 0;(i < 32) && (tmp[j] != 0);j++) {
|
for (i = 0, j = 0;(i < 32) && (tmp[j] != 0);j++) {
|
||||||
if (((tmp[j] >= '0') && (tmp[j] <= '9')) ||
|
if (((tmp[j] >= '0') && (tmp[j] <= '9')) ||
|
||||||
((tmp[j] >= 'a') && (tmp[j] <= 'f')))
|
((tmp[j] >= 'a') && (tmp[j] <= 'f'))) {
|
||||||
compact[i++] = tmp[j];
|
compact[i++] = tmp[j];
|
||||||
else if ((tmp[j] >= 'A') && (tmp[j] <= 'F'))
|
} else if ((tmp[j] >= 'A') && (tmp[j] <= 'F')) {
|
||||||
compact[i++] = tmp[j] + 'a' - 'A';
|
compact[i++] = tmp[j] + 'a' - 'A';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
compact[i] = 0;
|
compact[i] = 0;
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", compact);
|
virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", compact);
|
||||||
@ -1550,91 +1551,136 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||||||
|
|
||||||
for (cur = root; cur->kind == SEXPR_CONS; cur = cur->cdr) {
|
for (cur = root; cur->kind == SEXPR_CONS; cur = cur->cdr) {
|
||||||
node = cur->car;
|
node = cur->car;
|
||||||
if (sexpr_lookup(node, "device/vbd")) {
|
/* Normally disks are in a (device (vbd ...)) block
|
||||||
tmp = sexpr_node(node, "device/vbd/uname");
|
but blktap disks ended up in a differently named
|
||||||
if (tmp == NULL)
|
(device (tap ....)) block.... */
|
||||||
continue;
|
if (sexpr_lookup(node, "device/vbd") ||
|
||||||
if (!memcmp(tmp, "file:", 5)) {
|
sexpr_lookup(node, "device/tap")) {
|
||||||
|
char *offset;
|
||||||
|
int isBlock = 0;
|
||||||
int cdrom = 0;
|
int cdrom = 0;
|
||||||
const char *src = tmp+5;
|
char *drvName = NULL;
|
||||||
const char *dst = sexpr_node(node, "device/vbd/dev");
|
char *drvType = NULL;
|
||||||
|
const char *src = NULL;
|
||||||
|
const char *dst = NULL;
|
||||||
|
const char *mode = NULL;
|
||||||
|
|
||||||
|
/* 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 {
|
||||||
|
src = sexpr_node(node, "device/tap/uname");
|
||||||
|
dst = sexpr_node(node, "device/tap/dev");
|
||||||
|
mode = sexpr_node(node, "device/tap/mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src == NULL) {
|
||||||
|
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("domain information incomplete, vbd has no src"));
|
||||||
|
goto bad_parse;
|
||||||
|
}
|
||||||
|
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXendError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("domain information incomplete, vbd has no dev"));
|
_("domain information incomplete, vbd has no dev"));
|
||||||
goto error;
|
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))
|
if (!strncmp(dst, "ioemu:", 6))
|
||||||
dst += 6;
|
dst += 6;
|
||||||
|
|
||||||
/* New style disk config from Xen >= 3.0.3 */
|
/* New style disk config from Xen >= 3.0.3 */
|
||||||
if (xendConfigVersion > 1) {
|
if (xendConfigVersion > 1) {
|
||||||
char *offset = rindex(dst, ':');
|
offset = rindex(dst, ':');
|
||||||
if (offset) {
|
if (offset) {
|
||||||
if (!strcmp(offset, ":cdrom")) {
|
if (!strcmp(offset, ":cdrom")) {
|
||||||
cdrom = 1;
|
cdrom = 1;
|
||||||
} else if (!strcmp(offset, ":disk")) {
|
} else if (!strcmp(offset, ":disk")) {
|
||||||
/* defualt anyway */
|
/* The default anyway */
|
||||||
} else {
|
} else {
|
||||||
/* Unknown, lets pretend its a disk */
|
/* Unknown, lets pretend its a disk too */
|
||||||
}
|
}
|
||||||
offset[0] = '\0';
|
offset[0] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferVSprintf(&buf, " <disk type='file' device='%s'>\n", cdrom ? "cdrom" : "disk");
|
virBufferVSprintf(&buf, " <disk type='%s' device='%s'>\n",
|
||||||
virBufferVSprintf(&buf, " <source file='%s'/>\n", src);
|
isBlock ? "block" : "file",
|
||||||
virBufferVSprintf(&buf, " <target dev='%s'/>\n", dst);
|
cdrom ? "cdrom" : "disk");
|
||||||
tmp = sexpr_node(node, "device/vbd/mode");
|
if (drvType) {
|
||||||
/* XXX should we force mode == r, if cdrom==1, or assume
|
virBufferVSprintf(&buf, " <driver name='%s' type='%s'/>\n", drvName, drvType);
|
||||||
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 {
|
} else {
|
||||||
/* Unknown, lets pretend its a disk */
|
virBufferVSprintf(&buf, " <driver name='%s'/>\n", drvName);
|
||||||
}
|
}
|
||||||
offset[0] = '\0';
|
if (isBlock) {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virBufferVSprintf(&buf, " <disk type='block' device='%s'>\n", cdrom ? "cdrom" : "disk");
|
|
||||||
virBufferVSprintf(&buf, " <source dev='%s'/>\n", src);
|
virBufferVSprintf(&buf, " <source dev='%s'/>\n", src);
|
||||||
|
} else {
|
||||||
|
virBufferVSprintf(&buf, " <source file='%s'/>\n", src);
|
||||||
|
}
|
||||||
virBufferVSprintf(&buf, " <target dev='%s'/>\n", dst);
|
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
|
/* XXX should we force mode == r, if cdrom==1, or assume
|
||||||
xend has already done this ? */
|
xend has already done this ? */
|
||||||
if ((tmp != NULL) && (!strcmp(tmp, "r")))
|
if ((mode != NULL) && (!strcmp(mode, "r")))
|
||||||
virBufferVSprintf(&buf, " <readonly/>\n");
|
virBufferVSprintf(&buf, " <readonly/>\n");
|
||||||
virBufferAdd(&buf, " </disk>\n", 12);
|
virBufferAdd(&buf, " </disk>\n", 12);
|
||||||
} else {
|
|
||||||
char serial[1000];
|
|
||||||
|
|
||||||
TODO sexpr2string(node, serial, 1000);
|
bad_parse:
|
||||||
virBufferVSprintf(&buf, "<!-- Failed to parse %s -->\n",
|
if (drvName)
|
||||||
serial);
|
free(drvName);
|
||||||
TODO}
|
if (drvType)
|
||||||
|
free(drvType);
|
||||||
} else if (sexpr_lookup(node, "device/vif")) {
|
} else if (sexpr_lookup(node, "device/vif")) {
|
||||||
const char *tmp2;
|
const char *tmp2;
|
||||||
|
|
||||||
@ -1692,6 +1738,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||||||
tmp = sexpr_node(root, "domain/image/hvm/cdrom");
|
tmp = sexpr_node(root, "domain/image/hvm/cdrom");
|
||||||
if ((tmp != NULL) && (tmp[0] != 0)) {
|
if ((tmp != NULL) && (tmp[0] != 0)) {
|
||||||
virBufferAdd(&buf, " <disk type='file' device='cdrom'>\n", 38);
|
virBufferAdd(&buf, " <disk type='file' device='cdrom'>\n", 38);
|
||||||
|
virBufferAdd(&buf, " <driver name='file'/>\n", 28);
|
||||||
virBufferVSprintf(&buf, " <source file='%s'/>\n", tmp);
|
virBufferVSprintf(&buf, " <source file='%s'/>\n", tmp);
|
||||||
virBufferAdd(&buf, " <target dev='hdc'/>\n", 26);
|
virBufferAdd(&buf, " <target dev='hdc'/>\n", 26);
|
||||||
virBufferAdd(&buf, " <readonly/>\n", 18);
|
virBufferAdd(&buf, " <readonly/>\n", 18);
|
||||||
|
29
src/xml.c
29
src/xml.c
@ -931,6 +931,8 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
|||||||
xmlChar *device = NULL;
|
xmlChar *device = NULL;
|
||||||
xmlChar *source = NULL;
|
xmlChar *source = NULL;
|
||||||
xmlChar *target = NULL;
|
xmlChar *target = NULL;
|
||||||
|
xmlChar *drvName = NULL;
|
||||||
|
xmlChar *drvType = NULL;
|
||||||
int ro = 0;
|
int ro = 0;
|
||||||
int typ = 0;
|
int typ = 0;
|
||||||
int cdrom = 0;
|
int cdrom = 0;
|
||||||
@ -958,6 +960,11 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
|||||||
} else if ((target == NULL) &&
|
} else if ((target == NULL) &&
|
||||||
(xmlStrEqual(cur->name, BAD_CAST "target"))) {
|
(xmlStrEqual(cur->name, BAD_CAST "target"))) {
|
||||||
target = xmlGetProp(cur, BAD_CAST "dev");
|
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")) {
|
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
|
||||||
ro = 1;
|
ro = 1;
|
||||||
}
|
}
|
||||||
@ -1004,7 +1011,14 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
|||||||
|
|
||||||
|
|
||||||
virBufferAdd(buf, "(device ", 8);
|
virBufferAdd(buf, "(device ", 8);
|
||||||
|
/* 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);
|
virBufferAdd(buf, "(vbd ", 5);
|
||||||
|
}
|
||||||
|
|
||||||
if (hvm) {
|
if (hvm) {
|
||||||
char *tmp = (char *)target;
|
char *tmp = (char *)target;
|
||||||
@ -1020,6 +1034,18 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
|||||||
} else
|
} else
|
||||||
virBufferVSprintf(buf, "(dev '%s')", (const char *)target);
|
virBufferVSprintf(buf, "(dev '%s')", (const char *)target);
|
||||||
|
|
||||||
|
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)
|
if (typ == 0)
|
||||||
virBufferVSprintf(buf, "(uname 'file:%s')", source);
|
virBufferVSprintf(buf, "(uname 'file:%s')", source);
|
||||||
else if (typ == 1) {
|
else if (typ == 1) {
|
||||||
@ -1028,6 +1054,7 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
|||||||
else
|
else
|
||||||
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", source);
|
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", source);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ro == 0)
|
if (ro == 0)
|
||||||
virBufferVSprintf(buf, "(mode 'w')");
|
virBufferVSprintf(buf, "(mode 'w')");
|
||||||
else if (ro == 1)
|
else if (ro == 1)
|
||||||
@ -1037,6 +1064,8 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
|
|||||||
virBufferAdd(buf, ")", 1);
|
virBufferAdd(buf, ")", 1);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
xmlFree(drvType);
|
||||||
|
xmlFree(drvName);
|
||||||
xmlFree(device);
|
xmlFree(device);
|
||||||
xmlFree(target);
|
xmlFree(target);
|
||||||
xmlFree(source);
|
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>
|
<devices>
|
||||||
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
||||||
<disk type='file' device='cdrom'>
|
<disk type='file' device='cdrom'>
|
||||||
|
<driver name='file'/>
|
||||||
<source file='/root/boot.iso'/>
|
<source file='/root/boot.iso'/>
|
||||||
<target dev='hdc'/>
|
<target dev='hdc'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='file'/>
|
||||||
<source file='/root/foo.img'/>
|
<source file='/root/foo.img'/>
|
||||||
<target dev='hda'/>
|
<target dev='hda'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
<devices>
|
<devices>
|
||||||
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='file'/>
|
||||||
<source file='/root/foo.img'/>
|
<source file='/root/foo.img'/>
|
||||||
<target dev='hda'/>
|
<target dev='hda'/>
|
||||||
</disk>
|
</disk>
|
||||||
@ -26,6 +27,7 @@
|
|||||||
<script path='vif-bridge'/>
|
<script path='vif-bridge'/>
|
||||||
</interface>
|
</interface>
|
||||||
<disk type='file' device='cdrom'>
|
<disk type='file' device='cdrom'>
|
||||||
|
<driver name='file'/>
|
||||||
<source file='/root/boot.iso'/>
|
<source file='/root/boot.iso'/>
|
||||||
<target dev='hdc'/>
|
<target dev='hdc'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='file'/>
|
||||||
<source file='/root/some.img'/>
|
<source file='/root/some.img'/>
|
||||||
<target dev='xvda'/>
|
<target dev='xvda'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -67,6 +66,31 @@ static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
|
|||||||
2);
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -95,5 +119,21 @@ main(int argc, char **argv)
|
|||||||
1, testCompareFVversion2, NULL) != 0)
|
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);
|
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 <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -83,6 +82,55 @@ static int testCompareFVversion2VNC(void *data ATTRIBUTE_UNUSED) {
|
|||||||
2);
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -115,5 +163,34 @@ main(int argc, char **argv)
|
|||||||
1, testCompareFVversion2VNC, NULL) != 0)
|
1, testCompareFVversion2VNC, NULL) != 0)
|
||||||
ret = -1;
|
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);
|
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user