mirror of https://gitee.com/openkylin/libvirt.git
Added support for input devices
This commit is contained in:
parent
6365ff098c
commit
f029721d2b
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Wed Jul 18 16:42:08 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/qemu_conf.c, src/qemu_conf.h, src/xm_internal.c,
|
||||
src/xend_internal.c, src/xml.c: Added support for input devices
|
||||
using <input type='mouse|pointer' bus='ps2|xen|usb'/> element.
|
||||
* tests/sexpr2xmltest.c, tests/xmconfigtest.c,
|
||||
tests/xml2sexprtest.c: Add new tests for input devices
|
||||
* tests/test_utils.c, src/test_utils.h: the virTestRun callback
|
||||
uses a const void * instead of void *
|
||||
* tests/virshtest.c, tests/xencaptest.c: Switch to const void *
|
||||
* tests/sexpr2xmldata/*, tests/xmconfigdata/*, tests/xml2sexprdata/*
|
||||
Updated data files to take account of new input device syntax
|
||||
|
||||
Wed Jul 18 12:10:08 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/test.c include/libvirt/libvirt.h include/libvirt/libvirt.h.in:
|
||||
|
|
153
src/qemu_conf.c
153
src/qemu_conf.c
|
@ -806,6 +806,74 @@ static struct qemud_vm_net_def *qemudParseInterfaceXML(virConnectPtr conn,
|
|||
}
|
||||
|
||||
|
||||
/* Parse the XML definition for a network interface */
|
||||
static struct qemud_vm_input_def *qemudParseInputXML(virConnectPtr conn,
|
||||
struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
xmlNodePtr node) {
|
||||
struct qemud_vm_input_def *input = calloc(1, sizeof(struct qemud_vm_input_def));
|
||||
xmlChar *type = NULL;
|
||||
xmlChar *bus = NULL;
|
||||
|
||||
if (!input) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "input");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
type = xmlGetProp(node, BAD_CAST "type");
|
||||
bus = xmlGetProp(node, BAD_CAST "bus");
|
||||
|
||||
if (!type) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no type provide for input device");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!strcmp((const char *)type, "mouse")) {
|
||||
input->type = QEMU_INPUT_TYPE_MOUSE;
|
||||
} else if (!strcmp((const char *)type, "tablet")) {
|
||||
input->type = QEMU_INPUT_TYPE_TABLET;
|
||||
} else {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unsupported input device type %s", (const char*)type);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (bus) {
|
||||
if (!strcmp((const char*)bus, "ps2")) { /* Only allow mouse */
|
||||
if (input->type == QEMU_INPUT_TYPE_TABLET) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "ps2 bus does not support %s input device", (const char*)type);
|
||||
goto error;
|
||||
}
|
||||
input->bus = QEMU_INPUT_BUS_PS2;
|
||||
} else if (!strcmp((const char *)bus, "usb")) { /* Allow mouse & keyboard */
|
||||
input->bus = QEMU_INPUT_BUS_USB;
|
||||
} else {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unsupported input bus %s", (const char*)bus);
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
if (input->type == QEMU_INPUT_TYPE_MOUSE)
|
||||
input->bus = QEMU_INPUT_BUS_PS2;
|
||||
else
|
||||
input->bus = QEMU_INPUT_BUS_USB;
|
||||
}
|
||||
|
||||
if (type)
|
||||
xmlFree(type);
|
||||
if (bus)
|
||||
xmlFree(bus);
|
||||
|
||||
return input;
|
||||
|
||||
error:
|
||||
if (type)
|
||||
xmlFree(type);
|
||||
if (bus)
|
||||
xmlFree(bus);
|
||||
|
||||
free(input);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parses a libvirt XML definition of a guest, and populates the
|
||||
* the qemud_vm struct with matching data about the guests config
|
||||
|
@ -1193,6 +1261,61 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
|
|||
}
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
|
||||
/* analysis of the input devices */
|
||||
obj = xmlXPathEval(BAD_CAST "/domain/devices/input", ctxt);
|
||||
if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
|
||||
(obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) {
|
||||
struct qemud_vm_input_def *prev = NULL;
|
||||
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
|
||||
struct qemud_vm_input_def *input;
|
||||
if (!(input = qemudParseInputXML(conn, driver, obj->nodesetval->nodeTab[i]))) {
|
||||
goto error;
|
||||
}
|
||||
/* Mouse + PS/2 is implicit with graphics, so don't store it */
|
||||
if (input->bus == QEMU_INPUT_BUS_PS2 &&
|
||||
input->type == QEMU_INPUT_TYPE_MOUSE) {
|
||||
free(input);
|
||||
continue;
|
||||
}
|
||||
def->ninputs++;
|
||||
input->next = NULL;
|
||||
if (i == 0) {
|
||||
def->inputs = input;
|
||||
} else {
|
||||
prev->next = input;
|
||||
}
|
||||
prev = input;
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
obj = NULL;
|
||||
|
||||
/* If graphics are enabled, there's an implicit PS2 mouse */
|
||||
if (def->graphicsType != QEMUD_GRAPHICS_NONE) {
|
||||
int hasPS2mouse = 0;
|
||||
struct qemud_vm_input_def *input = def->inputs;
|
||||
while (input) {
|
||||
if (input->type == QEMU_INPUT_TYPE_MOUSE &&
|
||||
input->bus == QEMU_INPUT_BUS_PS2)
|
||||
hasPS2mouse = 1;
|
||||
input = input->next;
|
||||
}
|
||||
|
||||
if (!hasPS2mouse) {
|
||||
input = calloc(1, sizeof(struct qemud_vm_input_def));
|
||||
if (!input) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "input");
|
||||
goto error;
|
||||
}
|
||||
input->type = QEMU_INPUT_TYPE_MOUSE;
|
||||
input->bus = QEMU_INPUT_BUS_PS2;
|
||||
input->next = def->inputs;
|
||||
def->inputs = input;
|
||||
def->ninputs++;
|
||||
}
|
||||
}
|
||||
|
||||
xmlXPathFreeContext(ctxt);
|
||||
|
||||
return def;
|
||||
|
@ -1307,6 +1430,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||
struct stat sb;
|
||||
struct qemud_vm_disk_def *disk = vm->def->disks;
|
||||
struct qemud_vm_net_def *net = vm->def->nets;
|
||||
struct qemud_vm_input_def *input = vm->def->inputs;
|
||||
struct utsname ut;
|
||||
int disableKQEMU = 0;
|
||||
|
||||
|
@ -1348,6 +1472,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||
disableKQEMU + /* Disable kqemu */
|
||||
2 * vm->def->ndisks + /* disks*/
|
||||
(vm->def->nnets > 0 ? (4 * vm->def->nnets) : 2) + /* networks */
|
||||
1 + /* usb */
|
||||
2 * vm->def->ninputs + /* input devices */
|
||||
2 + /* memory*/
|
||||
2 + /* cpus */
|
||||
2 + /* boot device */
|
||||
|
@ -1561,6 +1687,19 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||
}
|
||||
}
|
||||
|
||||
if (!((*argv)[++n] = strdup("-usb")))
|
||||
goto no_memory;
|
||||
while (input) {
|
||||
if (input->bus == QEMU_INPUT_BUS_USB) {
|
||||
if (!((*argv)[++n] = strdup("-usbdevice")))
|
||||
goto no_memory;
|
||||
if (!((*argv)[++n] = strdup(input->type == QEMU_INPUT_TYPE_MOUSE ? "mouse" : "tablet")))
|
||||
goto no_memory;
|
||||
}
|
||||
|
||||
input = input->next;
|
||||
}
|
||||
|
||||
if (vm->def->graphicsType == QEMUD_GRAPHICS_VNC) {
|
||||
char port[10];
|
||||
int ret;
|
||||
|
@ -2541,6 +2680,7 @@ char *qemudGenerateXML(virConnectPtr conn,
|
|||
unsigned char *uuid;
|
||||
struct qemud_vm_disk_def *disk;
|
||||
struct qemud_vm_net_def *net;
|
||||
struct qemud_vm_input_def *input;
|
||||
const char *type = NULL;
|
||||
int n;
|
||||
|
||||
|
@ -2769,6 +2909,19 @@ char *qemudGenerateXML(virConnectPtr conn,
|
|||
net = net->next;
|
||||
}
|
||||
|
||||
input = def->inputs;
|
||||
while (input) {
|
||||
if (input->bus != QEMU_INPUT_BUS_PS2 &&
|
||||
virBufferVSprintf(buf, " <input type='%s' bus='usb'/>\n",
|
||||
input->type == QEMU_INPUT_TYPE_MOUSE ? "mouse" : "tablet") < 0)
|
||||
goto no_memory;
|
||||
input = input->next;
|
||||
}
|
||||
/* If graphics is enable, add implicit mouse */
|
||||
if (def->graphicsType != QEMUD_GRAPHICS_NONE)
|
||||
if (virBufferAdd(buf, " <input type='mouse' bus='ps2'/>\n", -1) < 0)
|
||||
goto no_memory;
|
||||
|
||||
switch (def->graphicsType) {
|
||||
case QEMUD_GRAPHICS_VNC:
|
||||
if (virBufferAdd(buf, " <graphics type='vnc'", -1) < 0)
|
||||
|
|
|
@ -109,6 +109,23 @@ struct qemud_vm_net_def {
|
|||
struct qemud_vm_net_def *next;
|
||||
};
|
||||
|
||||
|
||||
enum qemu_vm_input_type {
|
||||
QEMU_INPUT_TYPE_MOUSE,
|
||||
QEMU_INPUT_TYPE_TABLET,
|
||||
};
|
||||
|
||||
enum qemu_vm_input_bus {
|
||||
QEMU_INPUT_BUS_PS2,
|
||||
QEMU_INPUT_BUS_USB,
|
||||
};
|
||||
|
||||
struct qemud_vm_input_def {
|
||||
int type;
|
||||
int bus;
|
||||
struct qemud_vm_input_def *next;
|
||||
};
|
||||
|
||||
#define QEMUD_MAX_BOOT_DEVS 4
|
||||
|
||||
/* 3 possible boot devices */
|
||||
|
@ -119,7 +136,7 @@ enum qemud_vm_boot_order {
|
|||
QEMUD_BOOT_NET,
|
||||
};
|
||||
/* 3 possible graphics console modes */
|
||||
enum qemud_vm_grapics_type {
|
||||
enum qemud_vm_graphics_type {
|
||||
QEMUD_GRAPHICS_NONE,
|
||||
QEMUD_GRAPHICS_SDL,
|
||||
QEMUD_GRAPHICS_VNC,
|
||||
|
@ -175,6 +192,9 @@ struct qemud_vm_def {
|
|||
|
||||
int nnets;
|
||||
struct qemud_vm_net_def *nets;
|
||||
|
||||
int ninputs;
|
||||
struct qemud_vm_input_def *inputs;
|
||||
};
|
||||
|
||||
/* Guest VM runtime state */
|
||||
|
|
|
@ -1651,11 +1651,13 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||
tmp = sexpr_node(node, "device/vfb/type");
|
||||
|
||||
if (tmp && !strcmp(tmp, "sdl")) {
|
||||
virBufferVSprintf(&buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2": "xen");
|
||||
virBufferAdd(&buf, " <graphics type='sdl'/>\n", 27);
|
||||
} else if (tmp && !strcmp(tmp, "vnc")) {
|
||||
int port = xenStoreDomainGetVNCPort(conn, domid);
|
||||
const char *listenAddr = sexpr_node(node, "device/vfb/vnclisten");
|
||||
const char *keymap = sexpr_node(node, "device/vfb/keymap");
|
||||
virBufferVSprintf(&buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2": "xen");
|
||||
virBufferVSprintf(&buf, " <graphics type='vnc' port='%d'", port);
|
||||
if (listenAddr)
|
||||
virBufferVSprintf(&buf, " listen='%s'", listenAddr);
|
||||
|
@ -1696,6 +1698,22 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||
}
|
||||
}
|
||||
|
||||
/* in case of HVM we have devices emulation */
|
||||
if (hvm) {
|
||||
for (cur = sexpr_lookup(root, "domain/image/hvm"); cur && cur->kind == SEXPR_CONS; cur = cur->cdr) {
|
||||
node = cur->car;
|
||||
if (sexpr_lookup(node, "usbdevice")) {
|
||||
tmp = sexpr_node(node, "usbdevice");
|
||||
if (tmp && *tmp) {
|
||||
if (!strcmp(tmp, "usbtablet"))
|
||||
virBufferAdd(&buf, " <input type='tablet' bus='usb'/>\n", 37);
|
||||
else if (!strcmp(tmp, "usbmouse"))
|
||||
virBufferAdd(&buf, " <input type='mouse' bus='usb'/>\n", 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
|
||||
if ((hvm && xendConfigVersion < 4) ||
|
||||
(!hvm && xendConfigVersion < 3)) {
|
||||
|
@ -1713,6 +1731,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||
*/
|
||||
if (port == -1 && xendConfigVersion < 2)
|
||||
port = 5900 + domid;
|
||||
virBufferVSprintf(&buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2" : "xen");
|
||||
virBufferVSprintf(&buf, " <graphics type='vnc' port='%d'", port);
|
||||
if (listenAddr)
|
||||
virBufferVSprintf(&buf, " listen='%s'", listenAddr);
|
||||
|
@ -1725,10 +1744,12 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
|||
/* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
|
||||
tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux");
|
||||
if (tmp != NULL) {
|
||||
if (tmp[0] == '1')
|
||||
if (tmp[0] == '1') {
|
||||
virBufferVSprintf(&buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2" : "xen");
|
||||
virBufferAdd(&buf, " <graphics type='sdl'/>\n", 27 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tty = xenStoreDomainGetConsolePath(conn, domid);
|
||||
if (tty) {
|
||||
|
|
|
@ -913,6 +913,17 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
|
|||
}
|
||||
}
|
||||
|
||||
if (hvm) {
|
||||
if (xenXMConfigGetString(conf, "usbdevice", &str) == 0 && str) {
|
||||
if (!strcmp(str, "tablet"))
|
||||
virBufferAdd(buf, " <input type='tablet' bus='usb'/>\n", 37);
|
||||
else if (!strcmp(str, "mouse"))
|
||||
virBufferAdd(buf, " <input type='mouse' bus='usb'/>\n", 36);
|
||||
/* Ignore else branch - probably some other non-input device we don't
|
||||
support in libvirt yet */
|
||||
}
|
||||
}
|
||||
|
||||
/* HVM guests, or old PV guests use this config format */
|
||||
if (hvm || priv->xendConfigVersion < 3) {
|
||||
if (xenXMConfigGetInt(conf, "vnc", &val) == 0 && val) {
|
||||
|
@ -980,6 +991,9 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
|
|||
}
|
||||
}
|
||||
|
||||
if (vnc || sdl) {
|
||||
virBufferVSprintf(buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2":"xen");
|
||||
}
|
||||
if (vnc) {
|
||||
virBufferVSprintf(buf,
|
||||
" <graphics type='vnc' port='%ld'",
|
||||
|
@ -1902,6 +1916,9 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
|
|||
"cannot set the device_model parameter") < 0)
|
||||
goto error;
|
||||
|
||||
if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "usbdevice", "string(/domain/devices/input[@bus='usb' or (not(@bus) and @type='tablet')]/@type)", 1,
|
||||
"cannot set the usbdevice parameter") < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (hvm || priv->xendConfigVersion < 3) {
|
||||
|
|
56
src/xml.c
56
src/xml.c
|
@ -416,11 +416,12 @@ static int
|
|||
virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr ctxt, int vcpus, int xendConfigVersion)
|
||||
{
|
||||
xmlNodePtr cur, txt;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
xmlChar *type = NULL;
|
||||
xmlChar *loader = NULL;
|
||||
char bootorder[5];
|
||||
int nbootorder = 0;
|
||||
int res;
|
||||
int res, nb_nodes;
|
||||
char *str;
|
||||
|
||||
cur = node->children;
|
||||
|
@ -540,6 +541,57 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node, virBufferPtr buf
|
|||
if (virXPathNode("/domain/features/pae", ctxt) != NULL)
|
||||
virBufferAdd(buf, "(pae 1)", 7);
|
||||
|
||||
virBufferAdd(buf, "(usb 1)", 7);
|
||||
nb_nodes = virXPathNodeSet("/domain/devices/input", ctxt, &nodes);
|
||||
if (nb_nodes > 0) {
|
||||
int i;
|
||||
for (i = 0; i < nb_nodes; i++) {
|
||||
xmlChar *itype = NULL, *bus = NULL;
|
||||
int isMouse = 1;
|
||||
|
||||
itype = xmlGetProp(nodes[i], (xmlChar *)"type");
|
||||
|
||||
if (!itype) {
|
||||
goto error;
|
||||
}
|
||||
if (!strcmp((const char *)itype, "tablet"))
|
||||
isMouse = 0;
|
||||
else if (strcmp((const char*)itype, "mouse")) {
|
||||
xmlFree(itype);
|
||||
virXMLError(conn, VIR_ERR_XML_ERROR, "input", 0);
|
||||
goto error;
|
||||
}
|
||||
xmlFree(itype);
|
||||
|
||||
bus = xmlGetProp(nodes[i], (xmlChar *)"bus");
|
||||
if (!bus) {
|
||||
if (!isMouse) {
|
||||
/* Nothing - implicit ps2 */
|
||||
} else {
|
||||
virBufferAdd(buf, "(usbdevice tablet)", 13);
|
||||
}
|
||||
} else {
|
||||
if (!strcmp((const char*)bus, "ps2")) {
|
||||
if (!isMouse) {
|
||||
xmlFree(bus);
|
||||
virXMLError(conn, VIR_ERR_XML_ERROR, "input", 0);
|
||||
goto error;
|
||||
}
|
||||
/* Nothing - implicit ps2 */
|
||||
} else if (!strcmp((const char*)bus, "usb")) {
|
||||
if (isMouse)
|
||||
virBufferAdd(buf, "(usbdevice mouse)", 17);
|
||||
else
|
||||
virBufferAdd(buf, "(usbdevice tablet)", 18);
|
||||
}
|
||||
}
|
||||
xmlFree(bus);
|
||||
}
|
||||
free(nodes);
|
||||
nodes = NULL;
|
||||
}
|
||||
|
||||
|
||||
res = virXPathBoolean("count(domain/devices/console) > 0", ctxt);
|
||||
if (res < 0) {
|
||||
virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0);
|
||||
|
@ -572,6 +624,8 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node, virBufferPtr buf
|
|||
return (0);
|
||||
|
||||
error:
|
||||
if (nodes)
|
||||
free(nodes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<source file='/xen/rhel5.img'/>
|
||||
<target dev='xvda:disk'/>
|
||||
</disk>
|
||||
<input type='mouse' bus='xen'/>
|
||||
<graphics type='vnc' port='5905'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(usbdevice usbmouse)(vnc 1)(keymap ja)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -0,0 +1,40 @@
|
|||
<domain type='xen' id='3'>
|
||||
<name>fvtest</name>
|
||||
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<memory>409600</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<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>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr0'/>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type='mouse' bus='usb'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1 @@
|
|||
(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice usbtablet)(vnc 1)(keymap ja)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -0,0 +1,40 @@
|
|||
<domain type='xen' id='3'>
|
||||
<name>fvtest</name>
|
||||
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<memory>409600</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<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>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr0'/>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type='tablet' bus='usb'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -33,6 +33,7 @@
|
|||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5906'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<input type='mouse' bus='xen'/>
|
||||
<graphics type='vnc' port='-1' listen='0.0.0.0' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<input type='mouse' bus='xen'/>
|
||||
<graphics type='vnc' port='-1' listen='0.0.0.0' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -44,113 +44,124 @@ static int testCompareFiles(const char *xml, const char *sexpr, int xendConfigVe
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int testComparePVversion1(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testComparePVversion1(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-pv.xml",
|
||||
"sexpr2xmldata/sexpr2xml-pv.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFVversion1(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFVversion1(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv.xml",
|
||||
"sexpr2xmldata/sexpr2xml-fv.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testComparePVversion2(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testComparePVversion2(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-pv.xml",
|
||||
"sexpr2xmldata/sexpr2xml-pv.sexpr",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testComparePVOrigVFB(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testComparePVOrigVFB(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml",
|
||||
"sexpr2xmldata/sexpr2xml-pv-vfb-orig.sexpr",
|
||||
2);
|
||||
}
|
||||
|
||||
|
||||
static int testComparePVNewVFB(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testComparePVNewVFB(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-vfb-new.xml",
|
||||
"sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr",
|
||||
3);
|
||||
}
|
||||
|
||||
|
||||
static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFVversion2(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-v2.xml",
|
||||
"sexpr2xmldata/sexpr2xml-fv-v2.sexpr",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testComparePVBootloader(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testComparePVBootloader(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-bootloader.xml",
|
||||
"sexpr2xmldata/sexpr2xml-pv-bootloader.sexpr",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareDiskFile(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDiskFile(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-file.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-file.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareDiskBlock(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDiskBlock(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-block.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-block.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareDiskDrvBlktapQcow(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDiskDrvBlktapQcow(const 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) {
|
||||
static int testCompareDiskDrvBlktapRaw(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml",
|
||||
"sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareResizedMemory(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareResizedMemory(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-curmem.xml",
|
||||
"sexpr2xmldata/sexpr2xml-curmem.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
static int testCompareNetRouted(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareNetRouted(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-net-routed.xml",
|
||||
"sexpr2xmldata/sexpr2xml-net-routed.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareNetBridged(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareNetBridged(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-net-bridged.xml",
|
||||
"sexpr2xmldata/sexpr2xml-net-bridged.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareNoSourceCDRom(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareNoSourceCDRom(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-no-source-cdrom.xml",
|
||||
"sexpr2xmldata/sexpr2xml-no-source-cdrom.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFVclockUTC(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFVInputUSBMouse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-usbmouse.xml",
|
||||
"sexpr2xmldata/sexpr2xml-fv-usbmouse.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFVInputUSBTablet(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-usbtablet.xml",
|
||||
"sexpr2xmldata/sexpr2xml-fv-usbtablet.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFVclockUTC(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-utc.xml",
|
||||
"sexpr2xmldata/sexpr2xml-fv-utc.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFVclockLocaltime(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFVclockLocaltime(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-localtime.xml",
|
||||
"sexpr2xmldata/sexpr2xml-fv-localtime.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
@ -223,6 +234,13 @@ main(int argc, char **argv)
|
|||
1, testCompareNoSourceCDRom, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML USB Mouse",
|
||||
1, testCompareFVInputUSBMouse, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("SEXPR-2-XML USB Tablet",
|
||||
1, testCompareFVInputUSBTablet, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML clock UTC",
|
||||
1, testCompareFVclockUTC, NULL) != 0)
|
||||
ret = -1;
|
||||
|
|
|
@ -52,7 +52,7 @@ virtTestCountAverage(double *items, int nitems)
|
|||
* returns: -1 = error, 0 = success
|
||||
*/
|
||||
int
|
||||
virtTestRun(const char *title, int nloops, int (*body)(void *data), void *data)
|
||||
virtTestRun(const char *title, int nloops, int (*body)(const void *data), const void *data)
|
||||
{
|
||||
int i, ret = 0;
|
||||
double *ts = NULL;
|
||||
|
|
|
@ -18,17 +18,17 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
|
||||
double virtTestCountAverage (double *items,
|
||||
double virtTestCountAverage(double *items,
|
||||
int nitems);
|
||||
|
||||
int virtTestRun (const char *title,
|
||||
int virtTestRun(const char *title,
|
||||
int nloops,
|
||||
int (*body)(void *data),
|
||||
void *data);
|
||||
int virtTestLoadFile(const char *name,
|
||||
int (*body)(const void *data),
|
||||
const void *data);
|
||||
int virtTestLoadFile(const char *name,
|
||||
char **buf,
|
||||
int buflen);
|
||||
int virtTestCaptureProgramOutput(const char *const argv[],
|
||||
int virtTestCaptureProgramOutput(const char *const argv[],
|
||||
char **buf,
|
||||
int buflen);
|
||||
|
||||
|
@ -37,3 +37,11 @@ int virtTestCaptureProgramOutput(const char *const argv[],
|
|||
#endif
|
||||
#endif /* __VIT_TEST_UTILS_H__ */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* End:
|
||||
*/
|
||||
|
|
|
@ -66,7 +66,7 @@ static char *custom_uri;
|
|||
|
||||
|
||||
|
||||
static int testCompareListDefault(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareListDefault(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_DEFAULT,
|
||||
"list",
|
||||
|
@ -77,7 +77,7 @@ static int testCompareListDefault(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareListCustom(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareListCustom(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"list",
|
||||
|
@ -89,7 +89,7 @@ static int testCompareListCustom(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareNodeinfoDefault(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareNodeinfoDefault(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_DEFAULT,
|
||||
"nodeinfo",
|
||||
|
@ -100,7 +100,7 @@ static int testCompareNodeinfoDefault(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareNodeinfoCustom(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareNodeinfoCustom(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"nodeinfo",
|
||||
|
@ -111,7 +111,7 @@ static int testCompareNodeinfoCustom(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareDominfoByID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDominfoByID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"dominfo",
|
||||
|
@ -124,7 +124,7 @@ static int testCompareDominfoByID(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDominfoByUUID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDominfoByUUID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"dominfo",
|
||||
|
@ -137,7 +137,7 @@ static int testCompareDominfoByUUID(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDominfoByName(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDominfoByName(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"dominfo",
|
||||
|
@ -150,7 +150,7 @@ static int testCompareDominfoByName(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDomuuidByID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomuuidByID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domuuid",
|
||||
|
@ -162,7 +162,7 @@ static int testCompareDomuuidByID(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareDomuuidByName(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomuuidByName(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domuuid",
|
||||
|
@ -174,7 +174,7 @@ static int testCompareDomuuidByName(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareDomidByName(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomidByName(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domid",
|
||||
|
@ -187,7 +187,7 @@ static int testCompareDomidByName(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDomidByUUID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomidByUUID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domid",
|
||||
|
@ -200,7 +200,7 @@ static int testCompareDomidByUUID(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDomnameByID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomnameByID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domname",
|
||||
|
@ -213,7 +213,7 @@ static int testCompareDomnameByID(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDomnameByUUID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomnameByUUID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domname",
|
||||
|
@ -225,7 +225,7 @@ static int testCompareDomnameByUUID(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareDomstateByID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomstateByID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domstate",
|
||||
|
@ -238,7 +238,7 @@ static int testCompareDomstateByID(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareDomstateByUUID(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomstateByUUID(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domstate",
|
||||
|
@ -250,7 +250,7 @@ static int testCompareDomstateByUUID(void *data ATTRIBUTE_UNUSED) {
|
|||
argv);
|
||||
}
|
||||
|
||||
static int testCompareDomstateByName(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareDomstateByName(const void *data ATTRIBUTE_UNUSED) {
|
||||
const char *const argv[] = {
|
||||
VIRSH_CUSTOM,
|
||||
"domstate",
|
||||
|
|
|
@ -60,21 +60,21 @@ static int testCompareFiles(const char *hostmachine,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int testXeni686(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXeni686(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686.xml",
|
||||
"xencapsdata/xen-i686.cpuinfo",
|
||||
"xencapsdata/xen-i686.caps");
|
||||
}
|
||||
|
||||
static int testXeni686PAE(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXeni686PAE(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686-pae.xml",
|
||||
"xencapsdata/xen-i686-pae.cpuinfo",
|
||||
"xencapsdata/xen-i686-pae.caps");
|
||||
}
|
||||
|
||||
static int testXeni686PAEHVM(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXeni686PAEHVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686-pae-hvm.xml",
|
||||
"xencapsdata/xen-i686-pae-hvm.cpuinfo",
|
||||
|
@ -84,7 +84,7 @@ static int testXeni686PAEHVM(void *data ATTRIBUTE_UNUSED) {
|
|||
/* No PAE + HVM is non-sensical - all VMX capable
|
||||
CPUs have PAE */
|
||||
/*
|
||||
static int testXeni686HVM(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXeni686HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686-hvm.xml",
|
||||
"xencapsdata/xen-i686.cpuinfo",
|
||||
|
@ -92,46 +92,46 @@ static int testXeni686HVM(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
*/
|
||||
|
||||
static int testXenx86_64(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenx86_64(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("x86_64",
|
||||
"xencapsdata/xen-x86_64.xml",
|
||||
"xencapsdata/xen-x86_64.cpuinfo",
|
||||
"xencapsdata/xen-x86_64.caps");
|
||||
}
|
||||
static int testXenx86_64HVM(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenx86_64HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("x86_64",
|
||||
"xencapsdata/xen-x86_64-hvm.xml",
|
||||
"xencapsdata/xen-x86_64-hvm.cpuinfo",
|
||||
"xencapsdata/xen-x86_64-hvm.caps");
|
||||
}
|
||||
|
||||
static int testXenia64(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenia64(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64.xml",
|
||||
"xencapsdata/xen-ia64.cpuinfo",
|
||||
"xencapsdata/xen-ia64.caps");
|
||||
}
|
||||
static int testXenia64BE(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenia64BE(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64-be.xml",
|
||||
"xencapsdata/xen-ia64-be.cpuinfo",
|
||||
"xencapsdata/xen-ia64-be.caps");
|
||||
}
|
||||
|
||||
static int testXenia64HVM(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenia64HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64-hvm.xml",
|
||||
"xencapsdata/xen-ia64-hvm.cpuinfo",
|
||||
"xencapsdata/xen-ia64-hvm.caps");
|
||||
}
|
||||
static int testXenia64BEHVM(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenia64BEHVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64-be-hvm.xml",
|
||||
"xencapsdata/xen-ia64-be-hvm.cpuinfo",
|
||||
"xencapsdata/xen-ia64-be-hvm.caps");
|
||||
}
|
||||
|
||||
static int testXenppc64(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testXenppc64(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ppc64",
|
||||
"xencapsdata/xen-ppc64.xml",
|
||||
"xencapsdata/xen-ppc64.cpuinfo",
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr1'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr1'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
name = "XenGuest2"
|
||||
uuid = "c7a5fdb2cdaf9455926ad65c16db1809"
|
||||
maxmem = 579
|
||||
memory = 394
|
||||
vcpus = 1
|
||||
builder = "hvm"
|
||||
kernel = "/usr/lib/xen/boot/hvmloader"
|
||||
boot = "d"
|
||||
pae = 1
|
||||
acpi = 1
|
||||
apic = 1
|
||||
localtime = 0
|
||||
on_poweroff = "destroy"
|
||||
on_reboot = "restart"
|
||||
on_crash = "restart"
|
||||
device_model = "/usr/lib/xen/bin/qemu-dm"
|
||||
usbdevice = "mouse"
|
||||
sdl = 0
|
||||
vnc = 1
|
||||
vncunused = 1
|
||||
vnclisten = "127.0.0.1"
|
||||
vncpasswd = "123poi"
|
||||
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
|
||||
vif = [ "mac=00:16:3E:66:92:9C,bridge=xenbr1,type=ioemu" ]
|
|
@ -0,0 +1,42 @@
|
|||
<domain type='xen'>
|
||||
<name>XenGuest2</name>
|
||||
<uuid>c7a5fdb2cdaf9455926ad65c16db1809</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='cdrom'/>
|
||||
</os>
|
||||
<currentMemory>403456</currentMemory>
|
||||
<memory>592896</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<pae/>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<devices>
|
||||
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='phy'/>
|
||||
<source dev='/dev/HostVG/XenGuest2'/>
|
||||
<target dev='hda'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr1'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='usb'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1,42 @@
|
|||
<domain type='xen'>
|
||||
<name>XenGuest2</name>
|
||||
<uuid>c7a5fdb2cdaf9455926ad65c16db1809</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='cdrom'/>
|
||||
</os>
|
||||
<currentMemory>403456</currentMemory>
|
||||
<memory>592896</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<pae/>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<devices>
|
||||
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='phy'/>
|
||||
<source dev='/dev/HostVG/XenGuest2'/>
|
||||
<target dev='hda'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr1'/>
|
||||
</interface>
|
||||
<input type='tablet'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1,24 @@
|
|||
name = "XenGuest2"
|
||||
uuid = "c7a5fdb2cdaf9455926ad65c16db1809"
|
||||
maxmem = 579
|
||||
memory = 394
|
||||
vcpus = 1
|
||||
builder = "hvm"
|
||||
kernel = "/usr/lib/xen/boot/hvmloader"
|
||||
boot = "d"
|
||||
pae = 1
|
||||
acpi = 1
|
||||
apic = 1
|
||||
localtime = 0
|
||||
on_poweroff = "destroy"
|
||||
on_reboot = "restart"
|
||||
on_crash = "restart"
|
||||
device_model = "/usr/lib/xen/bin/qemu-dm"
|
||||
usbdevice = "tablet"
|
||||
sdl = 0
|
||||
vnc = 1
|
||||
vncunused = 1
|
||||
vnclisten = "127.0.0.1"
|
||||
vncpasswd = "123poi"
|
||||
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
|
||||
vif = [ "mac=00:16:3E:66:92:9C,bridge=xenbr1,type=ioemu" ]
|
|
@ -0,0 +1,42 @@
|
|||
<domain type='xen'>
|
||||
<name>XenGuest2</name>
|
||||
<uuid>c7a5fdb2cdaf9455926ad65c16db1809</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='cdrom'/>
|
||||
</os>
|
||||
<currentMemory>403456</currentMemory>
|
||||
<memory>592896</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<pae/>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<devices>
|
||||
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='phy'/>
|
||||
<source dev='/dev/HostVG/XenGuest2'/>
|
||||
<target dev='hda'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr1'/>
|
||||
</interface>
|
||||
<input type='tablet' bus='usb'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -35,6 +35,7 @@
|
|||
<mac address='00:16:3E:66:92:9C'/>
|
||||
<source bridge='xenbr1'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<mac address='00:16:3E:66:94:9C'/>
|
||||
<ip address='192.168.0.9'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='xen'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
<console/>
|
||||
</devices>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<mac address='00:16:3E:66:94:9C'/>
|
||||
<ip address='192.168.0.9'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='xen'/>
|
||||
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
|
||||
<console/>
|
||||
</devices>
|
||||
|
|
|
@ -148,73 +148,104 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml, int xendConf
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int testCompareParavirtOldPVFBFormat(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareParavirtOldPVFBFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-paravirt-old-pvfb.cfg",
|
||||
"xmconfigdata/test-paravirt-old-pvfb.xml",
|
||||
2);
|
||||
}
|
||||
static int testCompareParavirtOldPVFBParse(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareParavirtOldPVFBParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-paravirt-old-pvfb.cfg",
|
||||
"xmconfigdata/test-paravirt-old-pvfb.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareParavirtNewPVFBFormat(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareParavirtNewPVFBFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-paravirt-new-pvfb.cfg",
|
||||
"xmconfigdata/test-paravirt-new-pvfb.xml",
|
||||
3);
|
||||
}
|
||||
static int testCompareParavirtNewPVFBParse(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareParavirtNewPVFBParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-paravirt-new-pvfb.cfg",
|
||||
"xmconfigdata/test-paravirt-new-pvfb.xml",
|
||||
3);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtOldCDROMFormat(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtOldCDROMFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-fullvirt-old-cdrom.cfg",
|
||||
"xmconfigdata/test-fullvirt-old-cdrom.xml",
|
||||
1);
|
||||
}
|
||||
static int testCompareFullvirtOldCDROMParse(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtOldCDROMParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-old-cdrom.cfg",
|
||||
"xmconfigdata/test-fullvirt-old-cdrom.xml",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtNewCDROMFormat(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtNewCDROMFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-fullvirt-new-cdrom.cfg",
|
||||
"xmconfigdata/test-fullvirt-new-cdrom.xml",
|
||||
2);
|
||||
}
|
||||
static int testCompareFullvirtNewCDROMParse(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtNewCDROMParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-new-cdrom.cfg",
|
||||
"xmconfigdata/test-fullvirt-new-cdrom.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtClockUTCFormat(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtClockUTCFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-fullvirt-utc.cfg",
|
||||
"xmconfigdata/test-fullvirt-utc.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtClockUTCParse(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtClockUTCParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-utc.cfg",
|
||||
"xmconfigdata/test-fullvirt-utc.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtClockLocaltimeFormat(void *data ATTRIBUTE_UNUSED) {
|
||||
static int testCompareFullvirtClockLocaltimeFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-fullvirt-localtime.cfg",
|
||||
"xmconfigdata/test-fullvirt-localtime.xml",
|
||||
2);
|
||||
}
|
||||
static int testCompareFullvirtClockLocaltimeParse(void *data ATTRIBUTE_UNUSED) {
|
||||
|
||||
static int testCompareFullvirtClockLocaltimeParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-localtime.cfg",
|
||||
"xmconfigdata/test-fullvirt-localtime.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtInputUSBTabletFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFormatXML("xmconfigdata/test-fullvirt-usbtablet.cfg",
|
||||
"xmconfigdata/test-fullvirt-usbtablet.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtInputUSBTabletParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-usbtablet.cfg",
|
||||
"xmconfigdata/test-fullvirt-usbtablet.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtInputUSBTabletNoBusParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-usbtablet.cfg",
|
||||
"xmconfigdata/test-fullvirt-usbtablet-no-bus.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtInputUSBMouseFormat(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-usbmouse.cfg",
|
||||
"xmconfigdata/test-fullvirt-usbmouse.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareFullvirtInputUSBMouseParse(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareParseXML("xmconfigdata/test-fullvirt-usbmouse.cfg",
|
||||
"xmconfigdata/test-fullvirt-usbmouse.xml",
|
||||
2);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
|
@ -247,6 +278,12 @@ main(int argc, char **argv)
|
|||
if (virtTestRun("Fullvirt clock UTC (Format)",
|
||||
1, testCompareFullvirtClockUTCFormat, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("Fullvirt USB mouse (Format)",
|
||||
1, testCompareFullvirtInputUSBMouseFormat, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("Fullvirt USB tablet (Format)",
|
||||
1, testCompareFullvirtInputUSBTabletFormat, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
/* XML -> Config */
|
||||
if (virtTestRun("Paravirt old PVFB (Parse)",
|
||||
|
@ -267,6 +304,16 @@ main(int argc, char **argv)
|
|||
if (virtTestRun("Fullvirt clock UTC (Parse)",
|
||||
1, testCompareFullvirtClockUTCParse, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("Fullvirt USB mouse (Parse)",
|
||||
1, testCompareFullvirtInputUSBMouseParse, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("Fullvirt USB tablet (Parse)",
|
||||
1, testCompareFullvirtInputUSBTabletParse, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("Fullvirt USB tablet no bus (Parse)",
|
||||
1, testCompareFullvirtInputUSBTabletNoBusParse, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(localtime 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
||||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(vnc 1)(localtime 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -0,0 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice mouse)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -0,0 +1,37 @@
|
|||
<domain type='xen'>
|
||||
<name>fvtest</name>
|
||||
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<memory>409600</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<devices>
|
||||
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr0'/>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='cdrom'>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<disk type='file'>
|
||||
<source file='/root/foo.img'/>
|
||||
<target dev='ioemu:hda'/>
|
||||
</disk>
|
||||
<input type='mouse' bus='usb'/>
|
||||
<graphics type='vnc' port='5917' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
@ -0,0 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice tablet)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -0,0 +1,37 @@
|
|||
<domain type='xen'>
|
||||
<name>fvtest</name>
|
||||
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
<loader>/usr/lib/xen/boot/hvmloader</loader>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<memory>409600</memory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<devices>
|
||||
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr0'/>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='cdrom'>
|
||||
<source file='/root/boot.iso'/>
|
||||
<target dev='hdc'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<disk type='file'>
|
||||
<source file='/root/foo.img'/>
|
||||
<target dev='ioemu:hda'/>
|
||||
</disk>
|
||||
<input type='tablet' bus='usb'/>
|
||||
<graphics type='vnc' port='5917' keymap='ja'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
@ -1 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
||||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -1 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(vnc 1)(vncdisplay 17)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
||||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(usb 1)(vnc 1)(vncdisplay 17)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -1 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(vnc 1)(vncunused 1)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
||||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(usb 1)(vnc 1)(vncunused 1)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -1 +1 @@
|
|||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
||||
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
|
|
@ -1 +1 @@
|
|||
(vm (name 'test')(memory 350)(maxmem 382)(vcpus 1)(uuid 'cc2315e7d26a307a438c6d188ec4c09c')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(vnc 1)(vncdisplay 6)))(device (vbd (dev 'hda:disk:disk')(uname 'phy:/dev/sda8')(mode 'w')))(device (vbd (dev 'hdc:cdrom')(mode 'r')))(device (vif (mac '00:16:3e:0a:7b:39')(type ioemu))))
|
||||
(vm (name 'test')(memory 350)(maxmem 382)(vcpus 1)(uuid 'cc2315e7d26a307a438c6d188ec4c09c')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(usb 1)(vnc 1)(vncdisplay 6)))(device (vbd (dev 'hda:disk:disk')(uname 'phy:/dev/sda8')(mode 'w')))(device (vbd (dev 'hdc:cdrom')(mode 'r')))(device (vif (mac '00:16:3e:0a:7b:39')(type ioemu))))
|
|
@ -30,11 +30,11 @@ static int testCompareFiles(const char *xml, const char *sexpr, const char *name
|
|||
if (!(gotsexpr = virDomainParseXMLDesc(NULL, xmlData, &gotname, xendConfigVersion)))
|
||||
goto fail;
|
||||
|
||||
if (strcmp(sexprData, gotsexpr)) {
|
||||
if (getenv("DEBUG_TESTS")) {
|
||||
printf("Expect %d '%s'\n", (int)strlen(sexprData), sexprData);
|
||||
printf("Actual %d '%s'\n", (int)strlen(gotsexpr), gotsexpr);
|
||||
}
|
||||
if (strcmp(sexprData, gotsexpr)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -202,6 +202,22 @@ static int testCompareFVclockLocaltime(void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
static int testCompareFVInputUSBMouse(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-fv-usbmouse.xml",
|
||||
"xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr",
|
||||
"fvtest",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareFVInputUSBTablet(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-fv-usbtablet.xml",
|
||||
"xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr",
|
||||
"fvtest",
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
@ -290,6 +306,13 @@ main(int argc, char **argv)
|
|||
1, testCompareNoSourceCDRom, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR FV usb mouse)",
|
||||
1, testCompareFVInputUSBMouse, NULL) != 0)
|
||||
ret = -1;
|
||||
if (virtTestRun("XML-2-SEXPR FV usb tablet)",
|
||||
1, testCompareFVInputUSBTablet, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR clock UTC",
|
||||
1, testCompareFVclockUTC, NULL) != 0)
|
||||
ret = -1;
|
||||
|
|
Loading…
Reference in New Issue