[Libvir] PATCH 0/4: Serial / parallel device support

This patch series adds support for serial & parallel devices to the QEMU driver, and updates the Xen driver to support new syntax for HVM guests too. The following syntax is used. Anywhere you see 'serial', you can equally use 'console' or 'parallel'. The 'serial' is for real serial devices only, likewise 'parallel' is for parallel port devices only. 'console' tag is for paravirtualized consoles. IF there is no paravirt console, then the first serial device (if any) is also duplicated as a 'console' tag. This provides backwards compatability with existing syntax. - To attach device to STDIO - in essence this makes input /dev/null and output goto the VM's logfile <serial type='stdio'> <target port="1"/> </serial> - To attach to a virtual console - accessed via Ctrl+Alt+'n' in the SDL / VNC graphical console <serial type='vc'> <target port="1"/> </serial> - To send input & output to /dev/null <serial type='null'> <target port="1"/> </serial> - To auto-allocate a Pseudo TTY device <serial type="pty"> <source path="/dev/pts/3"/> <target port="1"/> </serial> NB special case if <console type='pty'>, then the TTY path is also duplicated as an attribute tty='/dv/pts/3' on the top level <console> tag. This provides compat with existing syntax for <console> tags. - To attach to a host device <serial type="dev"> <source path="/dev/ttyS0"/> <target port="1"/> </serial> - To operate as a TCP client <serial type="tcp"> <source mode="connect" host="0.0.0.0" service="2445"/> <target port="1"/> </serial> - To operate as a TCP client <serial type="tcp"> <source mode="bind" host="0.0.0.0" service="2445"/> <target port="1"/> </serial> - To operate as a UDP network console <serial type="udp"> <source mode="bind" host="0.0.0.0" service="2445"/> <source mode="connect" host="0.0.0.0" service="2445"/> <target port="1"/> </serial> - To operate as a UNIX domain socket server <serial type="unix"> <source mode="bind" path="/tmp/foo"/> <target port="1"/> </serial> This is sufficient flexibility to represent all QEMU character device modes, Xen paravirt console, LXC container fake console and the Solaris LDoms console, and VMWare serial devices. This series of patches updates the Xen and QEMU drivers, and their test suites. A later patch will also update the LXC driver to this new syntax. I was going to document this all in the format.html page, but looking at the content there it needs a complete re-write. The split between Xen and QEMU formats is pointless because they share 95% of the their config. Both the Xen and QEMU descriptions are outdated, and the Xen PV vs HVM split is also less than useful since they have much more commmonaility now. I intend to re-write it to describe each element / attribute in turn, and then at the end provide some example configs for each driver. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

This supports the serial/character devices in QEMU. It is complete except for fact that I don't extract the TTY path for type='pty'. This needs addressing before merging internal.h | 4 qemu_conf.c | 646 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- qemu_conf.h | 60 +++++ 3 files changed, 701 insertions(+), 9 deletions(-) Dan. Index: src/internal.h =================================================================== RCS file: /data/cvs/libvirt/src/internal.h,v retrieving revision 1.69 diff -u -p -r1.69 internal.h --- src/internal.h 18 Apr 2008 09:26:45 -0000 1.69 +++ src/internal.h 18 Apr 2008 20:01:36 -0000 @@ -66,6 +66,10 @@ extern "C" { #define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) #define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) + +#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0) +#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) + /* If configured with --enable-debug=yes then library calls * are printed to stderr for debugging. */ Index: src/qemu_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_conf.c,v retrieving revision 1.48 diff -u -p -r1.48 qemu_conf.c --- src/qemu_conf.c 10 Apr 2008 16:54:54 -0000 1.48 +++ src/qemu_conf.c 18 Apr 2008 20:01:37 -0000 @@ -205,6 +205,8 @@ void qemudFreeVMDef(struct qemud_vm_def struct qemud_vm_disk_def *disk = def->disks; struct qemud_vm_net_def *net = def->nets; struct qemud_vm_input_def *input = def->inputs; + struct qemud_vm_chr_def *serial = def->serials; + struct qemud_vm_chr_def *parallel = def->parallels; while (disk) { struct qemud_vm_disk_def *prev = disk; @@ -221,6 +223,16 @@ void qemudFreeVMDef(struct qemud_vm_def input = input->next; free(prev); } + while (serial) { + struct qemud_vm_chr_def *prev = serial; + serial = serial->next; + free(prev); + } + while (parallel) { + struct qemud_vm_chr_def *prev = parallel; + parallel = parallel->next; + free(prev); + } xmlFree(def->keymap); free(def); } @@ -945,6 +957,333 @@ static int qemudParseInterfaceXML(virCon } +/* Parse the XML definition for a character device + * @param net pre-allocated & zero'd net record + * @param node XML nodeset to parse for net definition + * @return 0 on success, -1 on failure + * + * The XML we're dealing with looks like + * + * <serial type="pty"> + * <source path="/dev/pts/3"/> + * <target port="1"/> + * </serial> + * + * <serial type="dev"> + * <source path="/dev/ttyS0"/> + * <target port="1"/> + * </serial> + * + * <serial type="tcp"> + * <source mode="connect" host="0.0.0.0" service="2445"/> + * <target port="1"/> + * </serial> + * + * <serial type="tcp"> + * <source mode="bind" host="0.0.0.0" service="2445"/> + * <target port="1"/> + * </serial> + * + * <serial type="udp"> + * <source mode="bind" host="0.0.0.0" service="2445"/> + * <source mode="connect" host="0.0.0.0" service="2445"/> + * <target port="1"/> + * </serial> + * + * <serial type="unix"> + * <source mode="bind" path="/tmp/foo"/> + * <target port="1"/> + * </serial> + * + */ +static int qemudParseCharXML(virConnectPtr conn, + struct qemud_vm_chr_def *chr, + int portNum, + xmlNodePtr node) { + xmlNodePtr cur; + xmlChar *type = NULL; + xmlChar *bindHost = NULL; + xmlChar *bindService = NULL; + xmlChar *connectHost = NULL; + xmlChar *connectService = NULL; + xmlChar *path = NULL; + xmlChar *mode = NULL; + xmlChar *wiremode = NULL; + int ret = -1; + + chr->srcType = QEMUD_CHR_SRC_TYPE_PTY; + type = xmlGetProp(node, BAD_CAST "type"); + if (type != NULL) { + if (xmlStrEqual(type, BAD_CAST "null")) + chr->srcType = QEMUD_CHR_SRC_TYPE_NULL; + else if (xmlStrEqual(type, BAD_CAST "vc")) + chr->srcType = QEMUD_CHR_SRC_TYPE_VC; + else if (xmlStrEqual(type, BAD_CAST "pty")) + chr->srcType = QEMUD_CHR_SRC_TYPE_PTY; + else if (xmlStrEqual(type, BAD_CAST "dev")) + chr->srcType = QEMUD_CHR_SRC_TYPE_DEV; + else if (xmlStrEqual(type, BAD_CAST "file")) + chr->srcType = QEMUD_CHR_SRC_TYPE_FILE; + else if (xmlStrEqual(type, BAD_CAST "pipe")) + chr->srcType = QEMUD_CHR_SRC_TYPE_PIPE; + else if (xmlStrEqual(type, BAD_CAST "stdio")) + chr->srcType = QEMUD_CHR_SRC_TYPE_STDIO; + else if (xmlStrEqual(type, BAD_CAST "udp")) + chr->srcType = QEMUD_CHR_SRC_TYPE_UDP; + else if (xmlStrEqual(type, BAD_CAST "tcp")) + chr->srcType = QEMUD_CHR_SRC_TYPE_TCP; + else if (xmlStrEqual(type, BAD_CAST "unix")) + chr->srcType = QEMUD_CHR_SRC_TYPE_UNIX; + else + chr->srcType = QEMUD_CHR_SRC_TYPE_NULL; + } + + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "source")) { + if (mode == NULL) + mode = xmlGetProp(cur, BAD_CAST "mode"); + + switch (chr->srcType) { + case QEMUD_CHR_SRC_TYPE_PTY: + case QEMUD_CHR_SRC_TYPE_DEV: + case QEMUD_CHR_SRC_TYPE_FILE: + case QEMUD_CHR_SRC_TYPE_PIPE: + case QEMUD_CHR_SRC_TYPE_UNIX: + if (path == NULL) + path = xmlGetProp(cur, BAD_CAST "path"); + + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + case QEMUD_CHR_SRC_TYPE_TCP: + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + + if (connectHost == NULL) + connectHost = xmlGetProp(cur, BAD_CAST "host"); + if (connectService == NULL) + connectService = xmlGetProp(cur, BAD_CAST "service"); + } else { + if (bindHost == NULL) + bindHost = xmlGetProp(cur, BAD_CAST "host"); + if (bindService == NULL) + bindService = xmlGetProp(cur, BAD_CAST "service"); + } + + if (chr->srcType == QEMUD_CHR_SRC_TYPE_TCP) + wiremode = xmlGetProp(cur, BAD_CAST "wiremode"); + + if (chr->srcType == QEMUD_CHR_SRC_TYPE_UDP) { + xmlFree(mode); + mode = NULL; + } + } + } + } + cur = cur->next; + } + + + chr->dstPort = portNum; + + switch (chr->srcType) { + case QEMUD_CHR_SRC_TYPE_NULL: + /* Nada */ + break; + + case QEMUD_CHR_SRC_TYPE_VC: + break; + + case QEMUD_CHR_SRC_TYPE_PTY: + /* @path attribute is an output only property - pty is auto-allocted */ + break; + + case QEMUD_CHR_SRC_TYPE_DEV: + case QEMUD_CHR_SRC_TYPE_FILE: + case QEMUD_CHR_SRC_TYPE_PIPE: + if (path == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source path attribute for char device")); + goto cleanup; + } + + strncpy(chr->srcData.file.path, (const char *)path, + sizeof(chr->srcData.file.path)); + NUL_TERMINATE(chr->srcData.file.path); + break; + + case QEMUD_CHR_SRC_TYPE_STDIO: + /* Nada */ + break; + + case QEMUD_CHR_SRC_TYPE_TCP: + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + if (connectHost == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source host attribute for char device")); + goto cleanup; + } + if (connectService == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source service attribute for char device")); + goto cleanup; + } + + strncpy(chr->srcData.tcp.host, (const char *)connectHost, + sizeof(chr->srcData.tcp.host)); + NUL_TERMINATE(chr->srcData.tcp.host); + strncpy(chr->srcData.tcp.service, (const char *)connectService, + sizeof(chr->srcData.tcp.service)); + NUL_TERMINATE(chr->srcData.tcp.service); + + chr->srcData.tcp.listen = 0; + } else { + if (bindHost == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source host attribute for char device")); + goto cleanup; + } + if (bindService == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source service attribute for char device")); + goto cleanup; + } + + strncpy(chr->srcData.tcp.host, (const char *)bindHost, + sizeof(chr->srcData.tcp.host)); + NUL_TERMINATE(chr->srcData.tcp.host); + strncpy(chr->srcData.tcp.service, (const char *)bindService, + sizeof(chr->srcData.tcp.service)); + NUL_TERMINATE(chr->srcData.tcp.service); + + chr->srcData.tcp.listen = 1; + } + if (wiremode != NULL && + STREQ((const char *)wiremode, "telnet")) + chr->srcData.tcp.wiremode = QEMUD_CHR_SRC_TCP_WIRE_MODE_TELNET; + else + chr->srcData.tcp.wiremode = QEMUD_CHR_SRC_TCP_WIRE_MODE_RAW; + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + if (connectService == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source service attribute for char device")); + goto cleanup; + } + + if (connectHost != NULL) { + strncpy(chr->srcData.udp.connectHost, (const char *)connectHost, + sizeof(chr->srcData.udp.connectHost)); + NUL_TERMINATE(chr->srcData.udp.connectHost); + } + strncpy(chr->srcData.udp.connectService, (const char *)connectService, + sizeof(chr->srcData.udp.connectService)); + NUL_TERMINATE(chr->srcData.udp.connectService); + + if (bindHost != NULL) { + strncpy(chr->srcData.udp.bindHost, (const char *)bindHost, + sizeof(chr->srcData.udp.bindHost)); + NUL_TERMINATE(chr->srcData.udp.bindHost); + } + if (bindService != NULL) { + strncpy(chr->srcData.udp.bindService, (const char *)bindService, + sizeof(chr->srcData.udp.bindService)); + NUL_TERMINATE(chr->srcData.udp.bindService); + } + break; + + case QEMUD_CHR_SRC_TYPE_UNIX: + if (path == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source path attribute for char device")); + goto cleanup; + } + + if (mode != NULL && + STRNEQ((const char *)mode, "connect")) + chr->srcData.nix.listen = 1; + else + chr->srcData.nix.listen = 0; + + strncpy(chr->srcData.nix.path, (const char *)path, + sizeof(chr->srcData.nix.path)); + NUL_TERMINATE(chr->srcData.nix.path); + break; + } + + ret = 0; + +cleanup: + xmlFree(mode); + xmlFree(wiremode); + xmlFree(type); + xmlFree(bindHost); + xmlFree(bindService); + xmlFree(connectHost); + xmlFree(connectService); + xmlFree(path); + + return ret; +} + + +static int qemudParseCharXMLDevices(virConnectPtr conn, + xmlXPathContextPtr ctxt, + const char *xpath, + unsigned int *ndevs, + struct qemud_vm_chr_def **devs) +{ + xmlXPathObjectPtr obj; + int i, ret = -1; + + obj = xmlXPathEval(BAD_CAST xpath, ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) { + struct qemud_vm_chr_def *prev = *devs; + if (ndevs == NULL && + obj->nodesetval->nodeNr > 1) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("too many character devices")); + goto cleanup; + } + + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + struct qemud_vm_chr_def *chr = calloc(1, sizeof(*chr)); + if (!chr) { + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, + "%s", + _("failed to allocate space for char device")); + goto cleanup; + } + + if (qemudParseCharXML(conn, chr, i, obj->nodesetval->nodeTab[i]) < 0) { + free(chr); + goto cleanup; + } + if (ndevs) + (*ndevs)++; + chr->next = NULL; + if (i == 0) { + *devs = chr; + } else { + prev->next = chr; + } + prev = chr; + } + } + + ret = 0; + +cleanup: + xmlXPathFreeObject(obj); + return ret; +} + + /* Parse the XML definition for a network interface */ static int qemudParseInputXML(virConnectPtr conn, struct qemud_vm_input_def *input, @@ -1423,6 +1762,45 @@ static struct qemud_vm_def *qemudParseXM } } xmlXPathFreeObject(obj); + obj = NULL; + + /* analysis of the character devices */ + if (qemudParseCharXMLDevices(conn, ctxt, + "/domain/devices/parallel", + &def->nparallels, + &def->parallels) < 0) + goto error; + if (qemudParseCharXMLDevices(conn, ctxt, + "/domain/devices/serial", + &def->nserials, + &def->serials) < 0) + goto error; + + /* + * If no serial devices were listed, then look for console + * devices which is the legacy syntax for the same thing + */ + if (def->nserials == 0) { + obj = xmlXPathEval(BAD_CAST "/domain/devices/console", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) { + struct qemud_vm_chr_def *chr = calloc(1, sizeof(*chr)); + if (!chr) { + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, + "%s", + _("failed to allocate space for char device")); + goto error; + } + + if (qemudParseCharXML(conn, chr, 0, obj->nodesetval->nodeTab[0]) < 0) { + free(chr); + goto error; + } + def->nserials = 1; + def->serials = chr; + } + xmlXPathFreeObject(obj); + } /* analysis of the network devices */ @@ -1617,6 +1995,78 @@ qemudNetworkIfaceConnect(virConnectPtr c return NULL; } +static int qemudBuildCommandLineChrDevStr(struct qemud_vm_chr_def *dev, + char *buf, + int buflen) +{ + switch (dev->srcType) { + case QEMUD_CHR_SRC_TYPE_NULL: + strncpy(buf, "null", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_VC: + strncpy(buf, "vc", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_PTY: + strncpy(buf, "pty", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_DEV: + if (snprintf(buf, buflen, "%s", + dev->srcData.file.path) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_FILE: + if (snprintf(buf, buflen, "file:%s", + dev->srcData.file.path) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_PIPE: + if (snprintf(buf, buflen, "pipe:%s", + dev->srcData.file.path) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_STDIO: + strncpy(buf, "stdio", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + if (snprintf(buf, buflen, "udp:%s:%s@%s:%s", + dev->srcData.udp.connectHost, + dev->srcData.udp.connectService, + dev->srcData.udp.bindHost, + dev->srcData.udp.bindService) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_TCP: + if (snprintf(buf, buflen, "%s:%s:%s%s", + dev->srcData.tcp.wiremode == QEMUD_CHR_SRC_TCP_WIRE_MODE_TELNET ? "telnet" : "tcp", + dev->srcData.tcp.host, + dev->srcData.tcp.service, + dev->srcData.tcp.listen ? ",listen" : "") >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_UNIX: + if (snprintf(buf, buflen, "unix:%s%s", + dev->srcData.nix.path, + dev->srcData.nix.listen ? ",listen" : "") >= buflen) + return -1; + break; + } + + return 0; +} + /* * Constructs a argv suitable for launching qemu with config defined * for a given virtual machine. @@ -1633,6 +2083,8 @@ int qemudBuildCommandLine(virConnectPtr 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 qemud_vm_chr_def *serial = vm->def->serials; + struct qemud_vm_chr_def *parallel = vm->def->parallels; struct utsname ut; int disableKQEMU = 0; @@ -1681,6 +2133,8 @@ int qemudBuildCommandLine(virConnectPtr (vm->def->nnets > 0 ? (4 * vm->def->nnets) : 2) + /* networks */ 1 + /* usb */ 2 * vm->def->ninputs + /* input devices */ + (vm->def->nserials > 0 ? (2 * vm->def->nserials) : 2) + /* character devices */ + (vm->def->nparallels > 0 ? (2 * vm->def->nparallels) : 2) + /* character devices */ 2 + /* memory*/ 2 + /* cpus */ 2 + /* boot device */ @@ -1913,6 +2367,48 @@ int qemudBuildCommandLine(virConnectPtr } } + if (!serial) { + if (!((*argv)[++n] = strdup("-serial"))) + goto no_memory; + if (!((*argv)[++n] = strdup("none"))) + goto no_memory; + } else { + while (serial) { + char buf[4096]; + + if (qemudBuildCommandLineChrDevStr(serial, buf, sizeof(buf)) < 0) + goto error; + + if (!((*argv)[++n] = strdup("-serial"))) + goto no_memory; + if (!((*argv)[++n] = strdup(buf))) + goto no_memory; + + serial = serial->next; + } + } + + if (!parallel) { + if (!((*argv)[++n] = strdup("-parallel"))) + goto no_memory; + if (!((*argv)[++n] = strdup("none"))) + goto no_memory; + } else { + while (parallel) { + char buf[4096]; + + if (qemudBuildCommandLineChrDevStr(parallel, buf, sizeof(buf)) < 0) + goto error; + + if (!((*argv)[++n] = strdup("-parallel"))) + goto no_memory; + if (!((*argv)[++n] = strdup(buf))) + goto no_memory; + + parallel = parallel->next; + } + } + if (!((*argv)[++n] = strdup("-usb"))) goto no_memory; while (input) { @@ -2838,6 +3334,125 @@ int qemudScanConfigs(struct qemud_driver return 0; } +static int qemudGenerateXMLChar(virBufferPtr buf, + const struct qemud_vm_chr_def *dev, + const char *type) +{ + const char *const types[] = { + "null", + "vc", + "pty", + "dev", + "file", + "pipe", + "stdio", + "udp", + "tcp", + "unix" + }; + /*verify(ARRAY_CARDINALITY(types) == QEMUD_CHR_SRC_TYPE_LAST);*/ + + if (dev->srcType < 0 || dev->srcType >= QEMUD_CHR_SRC_TYPE_LAST) + return -1; + + /* Compat with legacy <console tty='/dev/pts/5'/> syntax */ + if (STREQ(type, "console") && + dev->srcType == QEMUD_CHR_SRC_TYPE_PTY && + dev->srcData.file.path[0] != '\0') { + if (virBufferVSprintf(buf, " <%s type='%s' tty='%s'>\n", + type, types[dev->srcType], + dev->srcData.file.path) < 0) + return -1; + } else { + if (virBufferVSprintf(buf, " <%s type='%s'>\n", + type, types[dev->srcType]) < 0) + return -1; + } + + switch (dev->srcType) { + case QEMUD_CHR_SRC_TYPE_NULL: + case QEMUD_CHR_SRC_TYPE_VC: + case QEMUD_CHR_SRC_TYPE_STDIO: + /* nada */ + break; + + case QEMUD_CHR_SRC_TYPE_PTY: + case QEMUD_CHR_SRC_TYPE_DEV: + case QEMUD_CHR_SRC_TYPE_FILE: + case QEMUD_CHR_SRC_TYPE_PIPE: + if (dev->srcType != QEMUD_CHR_SRC_TYPE_PTY || + dev->srcData.file.path[0]) { + if (virBufferVSprintf(buf, " <source path='%s'/>\n", + dev->srcData.file.path) < 0) + return -1; + } + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + if (dev->srcData.udp.bindService[0] != '\0' && + dev->srcData.udp.bindHost[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='bind' host='%s' service='%s'/>\n", + dev->srcData.udp.bindHost, + dev->srcData.udp.bindService) < 0) + return -1; + } else if (dev->srcData.udp.bindHost[0] !='\0') { + if (virBufferVSprintf(buf, " <source mode='bind' host='%s'/>\n", + dev->srcData.udp.bindHost) < 0) + return -1; + } else if (dev->srcData.udp.bindService[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='bind' service='%s'/>\n", + dev->srcData.udp.bindService) < 0) + return -1; + } + + if (dev->srcData.udp.connectService[0] != '\0' && + dev->srcData.udp.connectHost[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='connect' host='%s' service='%s'/>\n", + dev->srcData.udp.connectHost, + dev->srcData.udp.connectService) < 0) + return -1; + } else if (dev->srcData.udp.connectHost[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='connect' host='%s'/>\n", + dev->srcData.udp.connectHost) < 0) + return -1; + } else if (dev->srcData.udp.connectService[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='connect' service='%s'/>\n", + dev->srcData.udp.connectService) < 0) + return -1; + } + + break; + + case QEMUD_CHR_SRC_TYPE_TCP: + if (virBufferVSprintf(buf, " <source mode='%s' host='%s' service='%s' wiremode='%s'/>\n", + dev->srcData.tcp.listen ? "bind" : "connect", + dev->srcData.tcp.host, + dev->srcData.tcp.service, + dev->srcData.tcp.wiremode == QEMUD_CHR_SRC_TCP_WIRE_MODE_TELNET + ? "telnet" : "raw") < 0) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_UNIX: + if (virBufferVSprintf(buf, " <source mode='%s' path='%s'/>\n", + dev->srcData.nix.listen ? "bind" : "connect", + dev->srcData.nix.path) < 0) + return -1; + break; + } + + if (virBufferVSprintf(buf, " <target port='%d'/>\n", + dev->dstPort) < 0) + return -1; + + if (virBufferVSprintf(buf, " </%s>\n", + type) < 0) + return -1; + + return 0; +} + + /* Generate an XML document describing the guest's configuration */ char *qemudGenerateXML(virConnectPtr conn, struct qemud_driver *driver ATTRIBUTE_UNUSED, @@ -2847,9 +3462,10 @@ char *qemudGenerateXML(virConnectPtr con virBufferPtr buf = 0; unsigned char *uuid; char uuidstr[VIR_UUID_STRING_BUFLEN]; - struct qemud_vm_disk_def *disk; - struct qemud_vm_net_def *net; - struct qemud_vm_input_def *input; + const struct qemud_vm_disk_def *disk; + const struct qemud_vm_net_def *net; + const struct qemud_vm_input_def *input; + const struct qemud_vm_chr_def *chr; const char *type = NULL; int n; @@ -3078,6 +3694,27 @@ char *qemudGenerateXML(virConnectPtr con net = net->next; } + chr = def->serials; + while (chr) { + if (qemudGenerateXMLChar(buf, chr, "serial") < 0) + goto no_memory; + + chr = chr->next; + } + + chr = def->parallels; + while (chr) { + if (qemudGenerateXMLChar(buf, chr, "parallel") < 0) + goto no_memory; + + chr = chr->next; + } + + /* First serial device is the primary console */ + if (def->nserials > 0 && + qemudGenerateXMLChar(buf, def->serials, "console") < 0) + goto no_memory; + input = def->inputs; while (input) { if (input->bus != QEMU_INPUT_BUS_PS2 && @@ -3125,9 +3762,6 @@ char *qemudGenerateXML(virConnectPtr con break; } - if (def->graphicsType == QEMUD_GRAPHICS_VNC) { - } - if (virBufferAddLit(buf, " </devices>\n") < 0) goto no_memory; Index: src/qemu_conf.h =================================================================== RCS file: /data/cvs/libvirt/src/qemu_conf.h,v retrieving revision 1.22 diff -u -p -r1.22 qemu_conf.h --- src/qemu_conf.h 10 Apr 2008 16:53:29 -0000 1.22 +++ src/qemu_conf.h 18 Apr 2008 20:01:37 -0000 @@ -119,6 +119,54 @@ struct qemud_vm_net_def { struct qemud_vm_net_def *next; }; +enum qemu_vm_chr_dst_type { + QEMUD_CHR_SRC_TYPE_NULL, + QEMUD_CHR_SRC_TYPE_VC, + QEMUD_CHR_SRC_TYPE_PTY, + QEMUD_CHR_SRC_TYPE_DEV, + QEMUD_CHR_SRC_TYPE_FILE, + QEMUD_CHR_SRC_TYPE_PIPE, + QEMUD_CHR_SRC_TYPE_STDIO, + QEMUD_CHR_SRC_TYPE_UDP, + QEMUD_CHR_SRC_TYPE_TCP, + QEMUD_CHR_SRC_TYPE_UNIX, + + QEMUD_CHR_SRC_TYPE_LAST, +}; + +enum { + QEMUD_CHR_SRC_TCP_WIRE_MODE_RAW, + QEMUD_CHR_SRC_TCP_WIRE_MODE_TELNET, +}; + +struct qemud_vm_chr_def { + int dstPort; + + int srcType; + union { + struct { + char path[PATH_MAX]; + } file; /* pty, file, pipe, or device */ + struct { + char host[BR_INET_ADDR_MAXLEN]; + char service[BR_INET_ADDR_MAXLEN]; + int listen; + int wiremode; + } tcp; + struct { + char bindHost[BR_INET_ADDR_MAXLEN]; + char bindService[BR_INET_ADDR_MAXLEN]; + char connectHost[BR_INET_ADDR_MAXLEN]; + char connectService[BR_INET_ADDR_MAXLEN]; + } udp; + struct { + char path[PATH_MAX]; + int listen; + } nix; + } srcData; + + struct qemud_vm_chr_def *next; +}; enum qemu_vm_input_type { QEMU_INPUT_TYPE_MOUSE, @@ -215,14 +263,20 @@ struct qemud_vm_def { char vncListen[BR_INET_ADDR_MAXLEN]; char *keymap; - int ndisks; + unsigned int ndisks; struct qemud_vm_disk_def *disks; - int nnets; + unsigned int nnets; struct qemud_vm_net_def *nets; - int ninputs; + unsigned int ninputs; struct qemud_vm_input_def *inputs; + + unsigned int nserials; + struct qemud_vm_chr_def *serials; + + unsigned int nparallels; + struct qemud_vm_chr_def *parallels; }; /* Guest VM runtime state */ -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Apr 18, 2008 at 09:25:28PM +0100, Daniel P. Berrange wrote:
This supports the serial/character devices in QEMU. It is complete except for fact that I don't extract the TTY path for type='pty'. This needs addressing before merging
This patch now includes the ability to extract the TTY path for serial and parallel devices, so we finally have 'virsh console' working for QEMU. THat said, plain QEMU/KVM has busted serial console which translates \r\n into \n\n, but I've sent a patch for that upstream http://lists.gnu.org/archive/html/qemu-devel/2008-04/msg00461.html internal.h | 4 qemu_conf.c | 648 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- qemu_conf.h | 60 +++++ qemu_driver.c | 77 +++++- 4 files changed, 761 insertions(+), 28 deletions(-) Dan. Index: src/internal.h =================================================================== RCS file: /data/cvs/libvirt/src/internal.h,v retrieving revision 1.69 diff -u -p -r1.69 internal.h --- src/internal.h 18 Apr 2008 09:26:45 -0000 1.69 +++ src/internal.h 24 Apr 2008 15:09:59 -0000 @@ -66,6 +66,10 @@ extern "C" { #define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) #define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) + +#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0) +#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) + /* If configured with --enable-debug=yes then library calls * are printed to stderr for debugging. */ Index: src/qemu_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_conf.c,v retrieving revision 1.48 diff -u -p -r1.48 qemu_conf.c --- src/qemu_conf.c 10 Apr 2008 16:54:54 -0000 1.48 +++ src/qemu_conf.c 24 Apr 2008 15:10:00 -0000 @@ -205,6 +205,8 @@ void qemudFreeVMDef(struct qemud_vm_def struct qemud_vm_disk_def *disk = def->disks; struct qemud_vm_net_def *net = def->nets; struct qemud_vm_input_def *input = def->inputs; + struct qemud_vm_chr_def *serial = def->serials; + struct qemud_vm_chr_def *parallel = def->parallels; while (disk) { struct qemud_vm_disk_def *prev = disk; @@ -221,6 +223,16 @@ void qemudFreeVMDef(struct qemud_vm_def input = input->next; free(prev); } + while (serial) { + struct qemud_vm_chr_def *prev = serial; + serial = serial->next; + free(prev); + } + while (parallel) { + struct qemud_vm_chr_def *prev = parallel; + parallel = parallel->next; + free(prev); + } xmlFree(def->keymap); free(def); } @@ -945,6 +957,333 @@ static int qemudParseInterfaceXML(virCon } +/* Parse the XML definition for a character device + * @param net pre-allocated & zero'd net record + * @param node XML nodeset to parse for net definition + * @return 0 on success, -1 on failure + * + * The XML we're dealing with looks like + * + * <serial type="pty"> + * <source path="/dev/pts/3"/> + * <target port="1"/> + * </serial> + * + * <serial type="dev"> + * <source path="/dev/ttyS0"/> + * <target port="1"/> + * </serial> + * + * <serial type="tcp"> + * <source mode="connect" host="0.0.0.0" service="2445"/> + * <target port="1"/> + * </serial> + * + * <serial type="tcp"> + * <source mode="bind" host="0.0.0.0" service="2445"/> + * <target port="1"/> + * </serial> + * + * <serial type="udp"> + * <source mode="bind" host="0.0.0.0" service="2445"/> + * <source mode="connect" host="0.0.0.0" service="2445"/> + * <target port="1"/> + * </serial> + * + * <serial type="unix"> + * <source mode="bind" path="/tmp/foo"/> + * <target port="1"/> + * </serial> + * + */ +static int qemudParseCharXML(virConnectPtr conn, + struct qemud_vm_chr_def *chr, + int portNum, + xmlNodePtr node) { + xmlNodePtr cur; + xmlChar *type = NULL; + xmlChar *bindHost = NULL; + xmlChar *bindService = NULL; + xmlChar *connectHost = NULL; + xmlChar *connectService = NULL; + xmlChar *path = NULL; + xmlChar *mode = NULL; + xmlChar *protocol = NULL; + int ret = -1; + + chr->srcType = QEMUD_CHR_SRC_TYPE_PTY; + type = xmlGetProp(node, BAD_CAST "type"); + if (type != NULL) { + if (xmlStrEqual(type, BAD_CAST "null")) + chr->srcType = QEMUD_CHR_SRC_TYPE_NULL; + else if (xmlStrEqual(type, BAD_CAST "vc")) + chr->srcType = QEMUD_CHR_SRC_TYPE_VC; + else if (xmlStrEqual(type, BAD_CAST "pty")) + chr->srcType = QEMUD_CHR_SRC_TYPE_PTY; + else if (xmlStrEqual(type, BAD_CAST "dev")) + chr->srcType = QEMUD_CHR_SRC_TYPE_DEV; + else if (xmlStrEqual(type, BAD_CAST "file")) + chr->srcType = QEMUD_CHR_SRC_TYPE_FILE; + else if (xmlStrEqual(type, BAD_CAST "pipe")) + chr->srcType = QEMUD_CHR_SRC_TYPE_PIPE; + else if (xmlStrEqual(type, BAD_CAST "stdio")) + chr->srcType = QEMUD_CHR_SRC_TYPE_STDIO; + else if (xmlStrEqual(type, BAD_CAST "udp")) + chr->srcType = QEMUD_CHR_SRC_TYPE_UDP; + else if (xmlStrEqual(type, BAD_CAST "tcp")) + chr->srcType = QEMUD_CHR_SRC_TYPE_TCP; + else if (xmlStrEqual(type, BAD_CAST "unix")) + chr->srcType = QEMUD_CHR_SRC_TYPE_UNIX; + else + chr->srcType = QEMUD_CHR_SRC_TYPE_NULL; + } + + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "source")) { + if (mode == NULL) + mode = xmlGetProp(cur, BAD_CAST "mode"); + + switch (chr->srcType) { + case QEMUD_CHR_SRC_TYPE_PTY: + case QEMUD_CHR_SRC_TYPE_DEV: + case QEMUD_CHR_SRC_TYPE_FILE: + case QEMUD_CHR_SRC_TYPE_PIPE: + case QEMUD_CHR_SRC_TYPE_UNIX: + if (path == NULL) + path = xmlGetProp(cur, BAD_CAST "path"); + + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + case QEMUD_CHR_SRC_TYPE_TCP: + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + + if (connectHost == NULL) + connectHost = xmlGetProp(cur, BAD_CAST "host"); + if (connectService == NULL) + connectService = xmlGetProp(cur, BAD_CAST "service"); + } else { + if (bindHost == NULL) + bindHost = xmlGetProp(cur, BAD_CAST "host"); + if (bindService == NULL) + bindService = xmlGetProp(cur, BAD_CAST "service"); + } + + if (chr->srcType == QEMUD_CHR_SRC_TYPE_UDP) { + xmlFree(mode); + mode = NULL; + } + } + } else if (xmlStrEqual(cur->name, BAD_CAST "protocol")) { + if (protocol == NULL) + protocol = xmlGetProp(cur, BAD_CAST "type"); + } + } + cur = cur->next; + } + + + chr->dstPort = portNum; + + switch (chr->srcType) { + case QEMUD_CHR_SRC_TYPE_NULL: + /* Nada */ + break; + + case QEMUD_CHR_SRC_TYPE_VC: + break; + + case QEMUD_CHR_SRC_TYPE_PTY: + /* @path attribute is an output only property - pty is auto-allocted */ + break; + + case QEMUD_CHR_SRC_TYPE_DEV: + case QEMUD_CHR_SRC_TYPE_FILE: + case QEMUD_CHR_SRC_TYPE_PIPE: + if (path == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source path attribute for char device")); + goto cleanup; + } + + strncpy(chr->srcData.file.path, (const char *)path, + sizeof(chr->srcData.file.path)); + NUL_TERMINATE(chr->srcData.file.path); + break; + + case QEMUD_CHR_SRC_TYPE_STDIO: + /* Nada */ + break; + + case QEMUD_CHR_SRC_TYPE_TCP: + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + if (connectHost == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source host attribute for char device")); + goto cleanup; + } + if (connectService == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source service attribute for char device")); + goto cleanup; + } + + strncpy(chr->srcData.tcp.host, (const char *)connectHost, + sizeof(chr->srcData.tcp.host)); + NUL_TERMINATE(chr->srcData.tcp.host); + strncpy(chr->srcData.tcp.service, (const char *)connectService, + sizeof(chr->srcData.tcp.service)); + NUL_TERMINATE(chr->srcData.tcp.service); + + chr->srcData.tcp.listen = 0; + } else { + if (bindHost == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source host attribute for char device")); + goto cleanup; + } + if (bindService == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source service attribute for char device")); + goto cleanup; + } + + strncpy(chr->srcData.tcp.host, (const char *)bindHost, + sizeof(chr->srcData.tcp.host)); + NUL_TERMINATE(chr->srcData.tcp.host); + strncpy(chr->srcData.tcp.service, (const char *)bindService, + sizeof(chr->srcData.tcp.service)); + NUL_TERMINATE(chr->srcData.tcp.service); + + chr->srcData.tcp.listen = 1; + } + if (protocol != NULL && + STREQ((const char *)protocol, "telnet")) + chr->srcData.tcp.protocol = QEMUD_CHR_SRC_TCP_PROTOCOL_TELNET; + else + chr->srcData.tcp.protocol = QEMUD_CHR_SRC_TCP_PROTOCOL_RAW; + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + if (connectService == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source service attribute for char device")); + goto cleanup; + } + + if (connectHost != NULL) { + strncpy(chr->srcData.udp.connectHost, (const char *)connectHost, + sizeof(chr->srcData.udp.connectHost)); + NUL_TERMINATE(chr->srcData.udp.connectHost); + } + strncpy(chr->srcData.udp.connectService, (const char *)connectService, + sizeof(chr->srcData.udp.connectService)); + NUL_TERMINATE(chr->srcData.udp.connectService); + + if (bindHost != NULL) { + strncpy(chr->srcData.udp.bindHost, (const char *)bindHost, + sizeof(chr->srcData.udp.bindHost)); + NUL_TERMINATE(chr->srcData.udp.bindHost); + } + if (bindService != NULL) { + strncpy(chr->srcData.udp.bindService, (const char *)bindService, + sizeof(chr->srcData.udp.bindService)); + NUL_TERMINATE(chr->srcData.udp.bindService); + } + break; + + case QEMUD_CHR_SRC_TYPE_UNIX: + if (path == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing source path attribute for char device")); + goto cleanup; + } + + if (mode != NULL && + STRNEQ((const char *)mode, "connect")) + chr->srcData.nix.listen = 1; + else + chr->srcData.nix.listen = 0; + + strncpy(chr->srcData.nix.path, (const char *)path, + sizeof(chr->srcData.nix.path)); + NUL_TERMINATE(chr->srcData.nix.path); + break; + } + + ret = 0; + +cleanup: + xmlFree(mode); + xmlFree(protocol); + xmlFree(type); + xmlFree(bindHost); + xmlFree(bindService); + xmlFree(connectHost); + xmlFree(connectService); + xmlFree(path); + + return ret; +} + + +static int qemudParseCharXMLDevices(virConnectPtr conn, + xmlXPathContextPtr ctxt, + const char *xpath, + unsigned int *ndevs, + struct qemud_vm_chr_def **devs) +{ + xmlXPathObjectPtr obj; + int i, ret = -1; + + obj = xmlXPathEval(BAD_CAST xpath, ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) { + struct qemud_vm_chr_def *prev = *devs; + if (ndevs == NULL && + obj->nodesetval->nodeNr > 1) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("too many character devices")); + goto cleanup; + } + + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + struct qemud_vm_chr_def *chr = calloc(1, sizeof(*chr)); + if (!chr) { + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, + "%s", + _("failed to allocate space for char device")); + goto cleanup; + } + + if (qemudParseCharXML(conn, chr, i, obj->nodesetval->nodeTab[i]) < 0) { + free(chr); + goto cleanup; + } + if (ndevs) + (*ndevs)++; + chr->next = NULL; + if (i == 0) { + *devs = chr; + } else { + prev->next = chr; + } + prev = chr; + } + } + + ret = 0; + +cleanup: + xmlXPathFreeObject(obj); + return ret; +} + + /* Parse the XML definition for a network interface */ static int qemudParseInputXML(virConnectPtr conn, struct qemud_vm_input_def *input, @@ -1423,6 +1762,45 @@ static struct qemud_vm_def *qemudParseXM } } xmlXPathFreeObject(obj); + obj = NULL; + + /* analysis of the character devices */ + if (qemudParseCharXMLDevices(conn, ctxt, + "/domain/devices/parallel", + &def->nparallels, + &def->parallels) < 0) + goto error; + if (qemudParseCharXMLDevices(conn, ctxt, + "/domain/devices/serial", + &def->nserials, + &def->serials) < 0) + goto error; + + /* + * If no serial devices were listed, then look for console + * devices which is the legacy syntax for the same thing + */ + if (def->nserials == 0) { + obj = xmlXPathEval(BAD_CAST "/domain/devices/console", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) { + struct qemud_vm_chr_def *chr = calloc(1, sizeof(*chr)); + if (!chr) { + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, + "%s", + _("failed to allocate space for char device")); + goto error; + } + + if (qemudParseCharXML(conn, chr, 0, obj->nodesetval->nodeTab[0]) < 0) { + free(chr); + goto error; + } + def->nserials = 1; + def->serials = chr; + } + xmlXPathFreeObject(obj); + } /* analysis of the network devices */ @@ -1617,6 +1995,78 @@ qemudNetworkIfaceConnect(virConnectPtr c return NULL; } +static int qemudBuildCommandLineChrDevStr(struct qemud_vm_chr_def *dev, + char *buf, + int buflen) +{ + switch (dev->srcType) { + case QEMUD_CHR_SRC_TYPE_NULL: + strncpy(buf, "null", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_VC: + strncpy(buf, "vc", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_PTY: + strncpy(buf, "pty", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_DEV: + if (snprintf(buf, buflen, "%s", + dev->srcData.file.path) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_FILE: + if (snprintf(buf, buflen, "file:%s", + dev->srcData.file.path) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_PIPE: + if (snprintf(buf, buflen, "pipe:%s", + dev->srcData.file.path) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_STDIO: + strncpy(buf, "stdio", buflen); + buf[buflen-1] = '\0'; + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + if (snprintf(buf, buflen, "udp:%s:%s@%s:%s", + dev->srcData.udp.connectHost, + dev->srcData.udp.connectService, + dev->srcData.udp.bindHost, + dev->srcData.udp.bindService) >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_TCP: + if (snprintf(buf, buflen, "%s:%s:%s%s", + dev->srcData.tcp.protocol == QEMUD_CHR_SRC_TCP_PROTOCOL_TELNET ? "telnet" : "tcp", + dev->srcData.tcp.host, + dev->srcData.tcp.service, + dev->srcData.tcp.listen ? ",listen" : "") >= buflen) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_UNIX: + if (snprintf(buf, buflen, "unix:%s%s", + dev->srcData.nix.path, + dev->srcData.nix.listen ? ",listen" : "") >= buflen) + return -1; + break; + } + + return 0; +} + /* * Constructs a argv suitable for launching qemu with config defined * for a given virtual machine. @@ -1633,6 +2083,8 @@ int qemudBuildCommandLine(virConnectPtr 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 qemud_vm_chr_def *serial = vm->def->serials; + struct qemud_vm_chr_def *parallel = vm->def->parallels; struct utsname ut; int disableKQEMU = 0; @@ -1681,6 +2133,8 @@ int qemudBuildCommandLine(virConnectPtr (vm->def->nnets > 0 ? (4 * vm->def->nnets) : 2) + /* networks */ 1 + /* usb */ 2 * vm->def->ninputs + /* input devices */ + (vm->def->nserials > 0 ? (2 * vm->def->nserials) : 2) + /* character devices */ + (vm->def->nparallels > 0 ? (2 * vm->def->nparallels) : 2) + /* character devices */ 2 + /* memory*/ 2 + /* cpus */ 2 + /* boot device */ @@ -1913,6 +2367,48 @@ int qemudBuildCommandLine(virConnectPtr } } + if (!serial) { + if (!((*argv)[++n] = strdup("-serial"))) + goto no_memory; + if (!((*argv)[++n] = strdup("none"))) + goto no_memory; + } else { + while (serial) { + char buf[4096]; + + if (qemudBuildCommandLineChrDevStr(serial, buf, sizeof(buf)) < 0) + goto error; + + if (!((*argv)[++n] = strdup("-serial"))) + goto no_memory; + if (!((*argv)[++n] = strdup(buf))) + goto no_memory; + + serial = serial->next; + } + } + + if (!parallel) { + if (!((*argv)[++n] = strdup("-parallel"))) + goto no_memory; + if (!((*argv)[++n] = strdup("none"))) + goto no_memory; + } else { + while (parallel) { + char buf[4096]; + + if (qemudBuildCommandLineChrDevStr(parallel, buf, sizeof(buf)) < 0) + goto error; + + if (!((*argv)[++n] = strdup("-parallel"))) + goto no_memory; + if (!((*argv)[++n] = strdup(buf))) + goto no_memory; + + parallel = parallel->next; + } + } + if (!((*argv)[++n] = strdup("-usb"))) goto no_memory; while (input) { @@ -2838,6 +3334,127 @@ int qemudScanConfigs(struct qemud_driver return 0; } +static int qemudGenerateXMLChar(virBufferPtr buf, + const struct qemud_vm_chr_def *dev, + const char *type) +{ + const char *const types[] = { + "null", + "vc", + "pty", + "dev", + "file", + "pipe", + "stdio", + "udp", + "tcp", + "unix" + }; + /*verify(ARRAY_CARDINALITY(types) == QEMUD_CHR_SRC_TYPE_LAST);*/ + + if (dev->srcType < 0 || dev->srcType >= QEMUD_CHR_SRC_TYPE_LAST) + return -1; + + /* Compat with legacy <console tty='/dev/pts/5'/> syntax */ + if (STREQ(type, "console") && + dev->srcType == QEMUD_CHR_SRC_TYPE_PTY && + dev->srcData.file.path[0] != '\0') { + if (virBufferVSprintf(buf, " <%s type='%s' tty='%s'>\n", + type, types[dev->srcType], + dev->srcData.file.path) < 0) + return -1; + } else { + if (virBufferVSprintf(buf, " <%s type='%s'>\n", + type, types[dev->srcType]) < 0) + return -1; + } + + switch (dev->srcType) { + case QEMUD_CHR_SRC_TYPE_NULL: + case QEMUD_CHR_SRC_TYPE_VC: + case QEMUD_CHR_SRC_TYPE_STDIO: + /* nada */ + break; + + case QEMUD_CHR_SRC_TYPE_PTY: + case QEMUD_CHR_SRC_TYPE_DEV: + case QEMUD_CHR_SRC_TYPE_FILE: + case QEMUD_CHR_SRC_TYPE_PIPE: + if (dev->srcType != QEMUD_CHR_SRC_TYPE_PTY || + dev->srcData.file.path[0]) { + if (virBufferVSprintf(buf, " <source path='%s'/>\n", + dev->srcData.file.path) < 0) + return -1; + } + break; + + case QEMUD_CHR_SRC_TYPE_UDP: + if (dev->srcData.udp.bindService[0] != '\0' && + dev->srcData.udp.bindHost[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='bind' host='%s' service='%s'/>\n", + dev->srcData.udp.bindHost, + dev->srcData.udp.bindService) < 0) + return -1; + } else if (dev->srcData.udp.bindHost[0] !='\0') { + if (virBufferVSprintf(buf, " <source mode='bind' host='%s'/>\n", + dev->srcData.udp.bindHost) < 0) + return -1; + } else if (dev->srcData.udp.bindService[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='bind' service='%s'/>\n", + dev->srcData.udp.bindService) < 0) + return -1; + } + + if (dev->srcData.udp.connectService[0] != '\0' && + dev->srcData.udp.connectHost[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='connect' host='%s' service='%s'/>\n", + dev->srcData.udp.connectHost, + dev->srcData.udp.connectService) < 0) + return -1; + } else if (dev->srcData.udp.connectHost[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='connect' host='%s'/>\n", + dev->srcData.udp.connectHost) < 0) + return -1; + } else if (dev->srcData.udp.connectService[0] != '\0') { + if (virBufferVSprintf(buf, " <source mode='connect' service='%s'/>\n", + dev->srcData.udp.connectService) < 0) + return -1; + } + + break; + + case QEMUD_CHR_SRC_TYPE_TCP: + if (virBufferVSprintf(buf, " <source mode='%s' host='%s' service='%s'/>\n", + dev->srcData.tcp.listen ? "bind" : "connect", + dev->srcData.tcp.host, + dev->srcData.tcp.service) < 0) + return -1; + if (virBufferVSprintf(buf, " <protocol type='%s'/>\n", + dev->srcData.tcp.protocol == QEMUD_CHR_SRC_TCP_PROTOCOL_TELNET + ? "telnet" : "raw") < 0) + return -1; + break; + + case QEMUD_CHR_SRC_TYPE_UNIX: + if (virBufferVSprintf(buf, " <source mode='%s' path='%s'/>\n", + dev->srcData.nix.listen ? "bind" : "connect", + dev->srcData.nix.path) < 0) + return -1; + break; + } + + if (virBufferVSprintf(buf, " <target port='%d'/>\n", + dev->dstPort) < 0) + return -1; + + if (virBufferVSprintf(buf, " </%s>\n", + type) < 0) + return -1; + + return 0; +} + + /* Generate an XML document describing the guest's configuration */ char *qemudGenerateXML(virConnectPtr conn, struct qemud_driver *driver ATTRIBUTE_UNUSED, @@ -2847,9 +3464,10 @@ char *qemudGenerateXML(virConnectPtr con virBufferPtr buf = 0; unsigned char *uuid; char uuidstr[VIR_UUID_STRING_BUFLEN]; - struct qemud_vm_disk_def *disk; - struct qemud_vm_net_def *net; - struct qemud_vm_input_def *input; + const struct qemud_vm_disk_def *disk; + const struct qemud_vm_net_def *net; + const struct qemud_vm_input_def *input; + const struct qemud_vm_chr_def *chr; const char *type = NULL; int n; @@ -3078,6 +3696,27 @@ char *qemudGenerateXML(virConnectPtr con net = net->next; } + chr = def->serials; + while (chr) { + if (qemudGenerateXMLChar(buf, chr, "serial") < 0) + goto no_memory; + + chr = chr->next; + } + + chr = def->parallels; + while (chr) { + if (qemudGenerateXMLChar(buf, chr, "parallel") < 0) + goto no_memory; + + chr = chr->next; + } + + /* First serial device is the primary console */ + if (def->nserials > 0 && + qemudGenerateXMLChar(buf, def->serials, "console") < 0) + goto no_memory; + input = def->inputs; while (input) { if (input->bus != QEMU_INPUT_BUS_PS2 && @@ -3125,9 +3764,6 @@ char *qemudGenerateXML(virConnectPtr con break; } - if (def->graphicsType == QEMUD_GRAPHICS_VNC) { - } - if (virBufferAddLit(buf, " </devices>\n") < 0) goto no_memory; Index: src/qemu_conf.h =================================================================== RCS file: /data/cvs/libvirt/src/qemu_conf.h,v retrieving revision 1.22 diff -u -p -r1.22 qemu_conf.h --- src/qemu_conf.h 10 Apr 2008 16:53:29 -0000 1.22 +++ src/qemu_conf.h 24 Apr 2008 15:10:00 -0000 @@ -119,6 +119,54 @@ struct qemud_vm_net_def { struct qemud_vm_net_def *next; }; +enum qemu_vm_chr_dst_type { + QEMUD_CHR_SRC_TYPE_NULL, + QEMUD_CHR_SRC_TYPE_VC, + QEMUD_CHR_SRC_TYPE_PTY, + QEMUD_CHR_SRC_TYPE_DEV, + QEMUD_CHR_SRC_TYPE_FILE, + QEMUD_CHR_SRC_TYPE_PIPE, + QEMUD_CHR_SRC_TYPE_STDIO, + QEMUD_CHR_SRC_TYPE_UDP, + QEMUD_CHR_SRC_TYPE_TCP, + QEMUD_CHR_SRC_TYPE_UNIX, + + QEMUD_CHR_SRC_TYPE_LAST, +}; + +enum { + QEMUD_CHR_SRC_TCP_PROTOCOL_RAW, + QEMUD_CHR_SRC_TCP_PROTOCOL_TELNET, +}; + +struct qemud_vm_chr_def { + int dstPort; + + int srcType; + union { + struct { + char path[PATH_MAX]; + } file; /* pty, file, pipe, or device */ + struct { + char host[BR_INET_ADDR_MAXLEN]; + char service[BR_INET_ADDR_MAXLEN]; + int listen; + int protocol; + } tcp; + struct { + char bindHost[BR_INET_ADDR_MAXLEN]; + char bindService[BR_INET_ADDR_MAXLEN]; + char connectHost[BR_INET_ADDR_MAXLEN]; + char connectService[BR_INET_ADDR_MAXLEN]; + } udp; + struct { + char path[PATH_MAX]; + int listen; + } nix; + } srcData; + + struct qemud_vm_chr_def *next; +}; enum qemu_vm_input_type { QEMU_INPUT_TYPE_MOUSE, @@ -215,14 +263,20 @@ struct qemud_vm_def { char vncListen[BR_INET_ADDR_MAXLEN]; char *keymap; - int ndisks; + unsigned int ndisks; struct qemud_vm_disk_def *disks; - int nnets; + unsigned int nnets; struct qemud_vm_net_def *nets; - int ninputs; + unsigned int ninputs; struct qemud_vm_input_def *inputs; + + unsigned int nserials; + struct qemud_vm_chr_def *serials; + + unsigned int nparallels; + struct qemud_vm_chr_def *parallels; }; /* Guest VM runtime state */ Index: src/qemu_driver.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_driver.c,v retrieving revision 1.67 diff -u -p -r1.67 qemu_driver.c --- src/qemu_driver.c 10 Apr 2008 16:54:54 -0000 1.67 +++ src/qemu_driver.c 24 Apr 2008 15:10:00 -0000 @@ -381,7 +381,6 @@ qemudReadMonitorOutput(virConnectPtr con const char *what) { #define MONITOR_TIMEOUT 3000 - int got = 0; buf[0] = '\0'; @@ -498,48 +497,88 @@ static int qemudOpenMonitor(virConnectPt return ret; } -static int qemudExtractMonitorPath(const char *haystack, char *path, int pathmax) { +static int qemudExtractMonitorPath(const char *haystack, + size_t *offset, + char *path, int pathmax) { static const char needle[] = "char device redirected to"; char *tmp; - if (!(tmp = strstr(haystack, needle))) + /* First look for our magic string */ + if (!(tmp = strstr(haystack + *offset, needle))) return -1; + /* Grab all the trailing data */ strncpy(path, tmp+sizeof(needle), pathmax-1); path[pathmax-1] = '\0'; - while (*path) { - /* - * The monitor path ends at first whitespace char - * so lets search for it & NULL terminate it there - */ - if (isspace(*path)) { - *path = '\0'; + /* + * And look for first whitespace character and nul terminate + * to mark end of the pty path + */ + tmp = path; + while (*tmp) { + if (isspace(*tmp)) { + *tmp = '\0'; + *offset += sizeof(needle) + strlen(path); return 0; } - path++; + tmp++; } /* * We found a path, but didn't find any whitespace, * so it must be still incomplete - we should at - * least see a \n + * least see a \n - indicate that we want to carry + * on trying again */ return -1; } static int -qemudOpenMonitorPath(virConnectPtr conn, - struct qemud_driver *driver, - struct qemud_vm *vm, - const char *output, - int fd ATTRIBUTE_UNUSED) +qemudFindCharDevicePTYs(virConnectPtr conn, + struct qemud_driver *driver, + struct qemud_vm *vm, + const char *output, + int fd ATTRIBUTE_UNUSED) { char monitor[PATH_MAX]; + size_t offset = 0; + struct qemud_vm_chr_def *chr; + + /* The order in which QEMU prints out the PTY paths is + the order in which it procsses its monitor, serial + and parallel device args. This code must match that + ordering.... */ - if (qemudExtractMonitorPath(output, monitor, sizeof(monitor)) < 0) + /* So first comes the monitor device */ + if (qemudExtractMonitorPath(output, &offset, monitor, sizeof(monitor)) < 0) return 1; /* keep reading */ + /* then the serial devices */ + chr = vm->def->serials; + while (chr) { + if (chr->srcType == QEMUD_CHR_SRC_TYPE_PTY) { + if (qemudExtractMonitorPath(output, &offset, + chr->srcData.file.path, + sizeof(chr->srcData.file.path)) < 0) + return 1; /* keep reading */ + } + chr = chr->next; + } + + /* and finally the parallel devices */ + chr = vm->def->parallels; + while (chr) { + if (chr->srcType == QEMUD_CHR_SRC_TYPE_PTY) { + if (qemudExtractMonitorPath(output, &offset, + chr->srcData.file.path, + sizeof(chr->srcData.file.path)) < 0) + return 1; /* keep reading */ + } + chr = chr->next; + } + + /* Got them all, so now open the monitor console */ return qemudOpenMonitor(conn, driver, vm, monitor); } @@ -550,7 +589,7 @@ static int qemudWaitForMonitor(virConnec int ret = qemudReadMonitorOutput(conn, driver, vm, vm->stderr, buf, sizeof(buf), - qemudOpenMonitorPath, + qemudFindCharDevicePTYs, "console"); buf[sizeof(buf)-1] = '\0'; -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Fri, Apr 18, 2008 at 09:25:28PM +0100, Daniel P. Berrange wrote:
This supports the serial/character devices in QEMU. It is complete except for fact that I don't extract the TTY path for type='pty'. This needs addressing before merging
This patch now includes the ability to extract the TTY path for serial and parallel devices, so we finally have 'virsh console' working for QEMU. THat said, plain QEMU/KVM has busted serial console which translates \r\n into \n\n, but I've sent a patch for that upstream
Nice! ...
Index: src/qemu_conf.c =================================================================== ... +static int qemudGenerateXMLChar(virBufferPtr buf, + const struct qemud_vm_chr_def *dev, + const char *type) +{ + const char *const types[] = { + "null", + "vc", + "pty", + "dev", + "file", + "pipe", + "stdio", + "udp", + "tcp", + "unix" + }; + /*verify(ARRAY_CARDINALITY(types) == QEMUD_CHR_SRC_TYPE_LAST);*/
A couple days ago I relaxed the copyright on the gnulib module to LGPLv2+, so you can go ahead and uncomment that, #include "verify.h", and add "verify" to the list in bootstrap.
Index: src/qemu_driver.c =================================================================== ... -static int qemudExtractMonitorPath(const char *haystack, char *path, int pathmax) { +static int qemudExtractMonitorPath(const char *haystack, + size_t *offset, + char *path, int pathmax) {
Thanks for shortening long lines ;-)
static const char needle[] = "char device redirected to"; char *tmp;
- if (!(tmp = strstr(haystack, needle))) + /* First look for our magic string */ + if (!(tmp = strstr(haystack + *offset, needle))) return -1;
+ /* Grab all the trailing data */ strncpy(path, tmp+sizeof(needle), pathmax-1);
That should be sizeof(needle)-1. Otherwise, if someone nasty gave you input ending with "char device redirected to", the strncpy above would start reading just past the NUL at the end of "haystack".
path[pathmax-1] = '\0';
- while (*path) { - /* - * The monitor path ends at first whitespace char - * so lets search for it & NULL terminate it there - */ - if (isspace(*path)) { - *path = '\0'; + /* + * And look for first whitespace character and nul terminate + * to mark end of the pty path + */ + tmp = path; + while (*tmp) { + if (isspace(*tmp)) {
Since "tmp" has type "char", this causes trouble in an environment where "char" is a signed type. When *tmp is larger than 127, it gets sign-extended, and isspace can misbehave on the large negative number (isspace is not defined for such values). Instead, do it like this: if (isspace(*(unsigned char *)tmp)) { or better, using the to_uchar function (from coreutils): if (isspace(to_uchar(tmp))) { /* Convert a possibly-signed character to an unsigned character. This is a bit safer than casting to unsigned char, since it catches some type errors that the cast doesn't. */ static inline unsigned char to_uchar (char ch) { return ch; } I just happened upon this one, but have audited the rest of the code for similar problems. To get an idea of the size of this task, I got the list of is* functions from the man page and did this: (tolower and toupper have the same limitation) re=$(man isspace|grep is.....,.is|sed 's/ -.*//'|tr -s ', \n' \| \ |sed 's/^|//;s/|$//') git grep -E "\b($re|tolower|toupper)\b" Here's the output: ChangeLog: Unlike in qemud.c, here we allow trailing "isspace", and in ChangeLog: * src/virsh.c: Remove use of _GNU_SOURCE / isblank. src/nodeinfo.c: while (*buf && isspace(*buf)) src/nodeinfo.c: while (*buf && isspace(*buf)) src/nodeinfo.c: && (*p == '\0' || *p == '.' || isspace(*p))) src/nodeinfo.c: while (*buf && isspace(*buf)) src/nodeinfo.c: && (*p == '\0' || isspace(*p)) src/qemu_driver.c: if (isspace(*path)) { src/sexpr.c: while (*ptr && !isspace(*ptr) && *ptr != ')' && *ptr != ' src/stats_linux.c: if (!isdigit(path[4]) || path[4] == '0' || src/stats_linux.c: if (p && (!isdigit(*p) || *p == '0' || src/stats_linux.c: if (!isdigit(path[3]) || path[3] == '0' || src/util.c:#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) src/util.c: while (*p == '0' && isxdigit (p[1])) src/util.c: while (*q == '0' && isxdigit (q[1])) src/util.c: if (!isxdigit(*str)) src/virsh.c: if (!isdigit (cpulist[i])) { src/virsh.c: else if (!isdigit (cpulist[i])) { src/virsh.c: && isalnum((unsigned char) *(p + 2))) { So I've just posted a patch to fix those.

On Thu, Apr 24, 2008 at 10:01:29PM +0200, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
static const char needle[] = "char device redirected to"; char *tmp;
- if (!(tmp = strstr(haystack, needle))) + /* First look for our magic string */ + if (!(tmp = strstr(haystack + *offset, needle))) return -1;
+ /* Grab all the trailing data */ strncpy(path, tmp+sizeof(needle), pathmax-1);
That should be sizeof(needle)-1. Otherwise, if someone nasty gave you input ending with "char device redirected to", the strncpy above would start reading just past the NUL at the end of "haystack".
Fixed this.
path[pathmax-1] = '\0';
- while (*path) { - /* - * The monitor path ends at first whitespace char - * so lets search for it & NULL terminate it there - */ - if (isspace(*path)) { - *path = '\0'; + /* + * And look for first whitespace character and nul terminate + * to mark end of the pty path + */ + tmp = path; + while (*tmp) { + if (isspace(*tmp)) {
Since "tmp" has type "char", this causes trouble in an environment where "char" is a signed type. When *tmp is larger than 127, it gets sign-extended, and isspace can misbehave on the large negative number (isspace is not defined for such values). Instead, do it like this:
if (isspace(*(unsigned char *)tmp)) {
or better, using the to_uchar function (from coreutils):
if (isspace(to_uchar(tmp))) {
Fixed this when merging with your to_uchar() changes. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

This patch updates Xen HVM to allow use of serial ¶llel ports, though XenD limits you to single one of each even though QEMU supports many. It also updates the <console> tag to support new syntax extensions. xend_internal.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- xend_internal.h | 9 + xm_internal.c | 55 +++++++++--- xml.c | 217 +++++++++++++++++++++++++++++++++++++++++++++-- xml.h | 4 5 files changed, 519 insertions(+), 22 deletions(-) Dan. Index: src/xend_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.c,v retrieving revision 1.180 diff -u -p -r1.180 xend_internal.c --- src/xend_internal.c 10 Apr 2008 16:54:54 -0000 1.180 +++ src/xend_internal.c 18 Apr 2008 20:01:37 -0000 @@ -1376,6 +1376,233 @@ xend_parse_sexp_desc_os(virConnectPtr xe return(0); } + +int +xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty) +{ + const char *type; + int telnet = 0; + char *bindPort = NULL; + char *bindHost = NULL; + char *connectPort = NULL; + char *connectHost = NULL; + char *path = NULL; + + if (value[0] == '/') { + type = "dev"; + } else if (STREQLEN(value, "null", 4)) { + type = "null"; + value = NULL; + } else if (STREQLEN(value, "vc", 2)) { + type = "vc"; + value = NULL; + } else if (STREQLEN(value, "pty", 3)) { + type = "pty"; + value = NULL; + } else if (STREQLEN(value, "stdio", 5)) { + type = "stdio"; + value = NULL; + } else if (STREQLEN(value, "file:", 5)) { + type = "file"; + value += 5; + } else if (STREQLEN(value, "pipe:", 5)) { + type = "pipe"; + value += 5; + } else if (STREQLEN(value, "tcp:", 4)) { + type = "tcp"; + value += 4; + } else if (STREQLEN(value, "telnet:", 4)) { + type = "tcp"; + value += 7; + telnet = 1; + } else if (STREQLEN(value, "udp:", 4)) { + type = "udp"; + value += 4; + } else if (STREQLEN(value, "unix:", 5)) { + type = "unix"; + value += 5; + } else { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("Unknown char device type")); + return -1; + } + + /* Compat with legacy <console tty='/dev/pts/5'/> syntax */ + if (STREQ(devtype, "console") && + STREQ(type, "pty") && + tty != NULL) { + if (virBufferVSprintf(buf, " <%s type='%s' tty='%s'>\n", + devtype, type, tty) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, " <%s type='%s'>\n", + devtype, type) < 0) + goto no_memory; + } + + if (STREQ(type, "null") || + STREQ(type, "vc") || + STREQ(type, "stdio")) { + /* no source needed */ + } else if (STREQ(type, "pty")) { + if (tty && + virBufferVSprintf(buf, " <source path='%s'/>\n", + tty) < 0) + goto no_memory; + } else if (STREQ(type, "file") || + STREQ(type, "pipe")) { + if (virBufferVSprintf(buf, " <source path='%s'/>\n", + value) < 0) + goto no_memory; + } else if (STREQ(type, "tcp")) { + const char *offset = strchr(value, ':'); + const char *offset2; + const char *mode, *wire; + + if (offset == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("malformed char device string")); + goto error; + } + + if (offset != value && + (bindHost = strndup(value, offset - value)) == NULL) + goto no_memory; + + offset2 = strchr(offset, ','); + if (offset2 == NULL) + bindPort = strdup(offset+1); + else + bindPort = strndup(offset+1, offset2-(offset+1)); + if (bindPort == NULL) + goto no_memory; + + if (offset2 && strstr(offset2, ",listen")) + mode = "bind"; + else + mode = "connect"; + wire = telnet ? "telnet":"raw"; + + if (bindHost) { + if (virBufferVSprintf(buf, + " <source mode='%s' host='%s' service='%s' wiremode='%s'/>\n", + mode, bindHost, bindPort, wire) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, + " <source mode='%s' service='%s' wiremode='%s'/>\n", + mode, bindPort, wire) < 0) + goto no_memory; + } + } else if (STREQ(type, "udp")) { + const char *offset = strchr(value, ':'); + const char *offset2, *offset3; + + if (offset == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("malformed char device string")); + goto error; + } + + if (offset != value && + (connectHost = strndup(value, offset - value)) == NULL) + goto no_memory; + + offset2 = strchr(offset, '@'); + if (offset2 != NULL) { + if ((connectPort = strndup(offset + 1, offset2-(offset+1))) == NULL) + goto no_memory; + + offset3 = strchr(offset2, ':'); + if (offset3 == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("malformed char device string")); + goto error; + } + + if (offset3 > (offset2 + 1) && + (bindHost = strndup(offset2 + 1, offset3 - (offset2+1))) == NULL) + goto no_memory; + + if ((bindPort = strdup(offset3 + 1)) == NULL) + goto no_memory; + } else { + if ((connectPort = strdup(offset + 1)) == NULL) + goto no_memory; + } + + if (connectPort) { + if (connectHost) { + if (virBufferVSprintf(buf, + " <source mode='connect' host='%s' service='%s'/>\n", + connectHost, connectPort) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, + " <source mode='connect' service='%s'/>\n", + connectPort) < 0) + goto no_memory; + } + } + if (bindPort) { + if (bindHost) { + if (virBufferVSprintf(buf, + " <source mode='bind' host='%s' service='%s'/>\n", + bindHost, bindPort) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, + " <source mode='bind' service='%s'/>\n", + bindPort) < 0) + goto no_memory; + } + } + + } else if (STREQ(type, "unix")) { + const char *offset = strchr(value, ','); + int dolisten = 0; + if (offset) + path = strndup(value, (offset - value)); + else + path = strdup(value); + if (path == NULL) + goto no_memory; + + if (strstr(offset, ",listen") != NULL) + dolisten = 1; + + if (virBufferVSprintf(buf, " <source mode='%s' path='%s'/>\n", + dolisten ? "bind" : "connect", path) < 0) { + free(path); + goto no_memory; + } + + free(path); + } + + if (virBufferVSprintf(buf, " <target port='%d'/>\n", + portNum) < 0) + goto no_memory; + + if (virBufferVSprintf(buf, " </%s>\n", + devtype) < 0) + goto no_memory; + + return 0; + +no_memory: + virXendError(conn, VIR_ERR_NO_MEMORY, + _("no memory for char device config")); + +error: + return -1; +} + /** * xend_parse_sexp_desc: * @conn: the connection associated with the XML @@ -1828,10 +2055,33 @@ xend_parse_sexp_desc(virConnectPtr conn, } tty = xenStoreDomainGetConsolePath(conn, domid); - if (tty) { - virBufferVSprintf(&buf, " <console tty='%s'/>\n", tty); - free(tty); + if (hvm) { + tmp = sexpr_node(root, "domain/image/hvm/serial"); + if (tmp && STRNEQ(tmp, "none")) { + if (xend_parse_sexp_desc_char(conn, &buf, "serial", 0, tmp, tty) < 0) + goto error; + /* Add back-compat <console/> tag for primary console */ + if (xend_parse_sexp_desc_char(conn, &buf, "console", 0, tmp, tty) < 0) + goto error; + } + tmp = sexpr_node(root, "domain/image/hvm/parallel"); + if (tmp && STRNEQ(tmp, "none")) { + /* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */ + if (xend_parse_sexp_desc_char(conn, &buf, "parallel", 0, tmp, NULL) < 0) + goto error; + } + } else { + /* Paravirt always has a console */ + if (tty) { + virBufferVSprintf(&buf, " <console type='pty' tty='%s'>\n", tty); + virBufferVSprintf(&buf, " <source path='%s'/>\n", tty); + } else { + virBufferAddLit(&buf, " <console type='pty'>\n"); + } + virBufferAddLit(&buf, " <target port='0'/>\n"); + virBufferAddLit(&buf, " </console>\n"); } + free(tty); virBufferAddLit(&buf, " </devices>\n"); virBufferAddLit(&buf, "</domain>\n"); Index: src/xend_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.h,v retrieving revision 1.40 diff -u -p -r1.40 xend_internal.h --- src/xend_internal.h 10 Apr 2008 16:54:54 -0000 1.40 +++ src/xend_internal.h 18 Apr 2008 20:01:37 -0000 @@ -20,12 +20,12 @@ #include "libvirt/libvirt.h" #include "capabilities.h" +#include "buf.h" #ifdef __cplusplus extern "C" { #endif - /** * \brief Setup the connection to a xend instance via TCP * \param host The host name to connect to @@ -180,6 +180,13 @@ char *xenDaemonDomainDumpXMLByName(virCo */ int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer); + int xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty); + char *xend_parse_domain_sexp(virConnectPtr conn, char *root, int xendConfigVersion); /* refactored ones */ Index: src/xm_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xm_internal.c,v retrieving revision 1.70 diff -u -p -r1.70 xm_internal.c --- src/xm_internal.c 10 Apr 2008 16:54:54 -0000 1.70 +++ src/xm_internal.c 18 Apr 2008 20:01:37 -0000 @@ -1025,11 +1025,22 @@ char *xenXMDomainFormatXML(virConnectPtr } if (hvm) { - if (xenXMConfigGetString(conf, "serial", &str) == 0 && !strcmp(str, "pty")) { - virBufferAddLit(buf, " <console/>\n"); + if (xenXMConfigGetString(conf, "parallel", &str) == 0) { + if (STRNEQ(str, "none")) + xend_parse_sexp_desc_char(conn, buf, "parallel", 0, str, NULL); + } + if (xenXMConfigGetString(conf, "serial", &str) == 0) { + if (STRNEQ(str, "none")) { + xend_parse_sexp_desc_char(conn, buf, "serial", 0, str, NULL); + /* Add back-compat console tag for primary console */ + xend_parse_sexp_desc_char(conn, buf, "console", 0, str, NULL); + } } - } else { /* Paravirt implicitly always has a console */ - virBufferAddLit(buf, " <console/>\n"); + } else { + /* Paravirt implicitly always has a single console */ + virBufferAddLit(buf, " <console type='pty'>\n"); + virBufferAddLit(buf, " <target port='0'/>\n"); + virBufferAddLit(buf, " </console>\n"); } virBufferAddLit(buf, " </devices>\n"); @@ -2267,14 +2278,38 @@ virConfPtr xenXMParseXMLToConfig(virConn obj = NULL; if (hvm) { - obj = xmlXPathEval(BAD_CAST "count(/domain/devices/console) > 0", ctxt); - if ((obj != NULL) && (obj->type == XPATH_BOOLEAN) && - (obj->boolval)) { - if (xenXMConfigSetString(conf, "serial", "pty") < 0) + xmlNodePtr cur; + cur = virXPathNode("/domain/devices/parallel[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) { + goto error; + } + + if (xenXMConfigSetString(conf, "parallel", scratch) < 0) + goto error; + } else { + if (xenXMConfigSetString(conf, "parallel", "none") < 0) goto error; } - xmlXPathFreeObject(obj); - obj = NULL; + + cur = virXPathNode("/domain/devices/serial[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (xenXMConfigSetString(conf, "serial", scratch) < 0) + goto error; + } else { + if (virXPathBoolean("count(/domain/devices/console) > 0", ctxt)) { + if (xenXMConfigSetString(conf, "serial", "pty") < 0) + goto error; + } else { + if (xenXMConfigSetString(conf, "serial", "none") < 0) + goto error; + } + } } xmlFreeDoc(doc); Index: src/xml.c =================================================================== RCS file: /data/cvs/libvirt/src/xml.c,v retrieving revision 1.117 diff -u -p -r1.117 xml.c --- src/xml.c 10 Apr 2008 16:54:54 -0000 1.117 +++ src/xml.c 18 Apr 2008 20:01:37 -0000 @@ -673,6 +673,178 @@ virDomainParseXMLGraphicsDescVFB(virConn } +int +virDomainParseXMLOSDescHVMChar(virConnectPtr conn, + char *buf, + size_t buflen, + xmlNodePtr node) +{ + xmlChar *type = NULL; + xmlChar *path = NULL; + xmlChar *bindHost = NULL; + xmlChar *bindService = NULL; + xmlChar *connectHost = NULL; + xmlChar *connectService = NULL; + xmlChar *mode = NULL; + xmlChar *wiremode = NULL; + xmlNodePtr cur; + + type = xmlGetProp(node, BAD_CAST "type"); + + if (type != NULL) { + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "source")) { + if (mode == NULL) + mode = xmlGetProp(cur, BAD_CAST "mode"); + + if (STREQ((const char *)type, "dev") || + STREQ((const char *)type, "file") || + STREQ((const char *)type, "pipe") || + STREQ((const char *)type, "unix")) { + if (path == NULL) + path = xmlGetProp(cur, BAD_CAST "path"); + + } else if (STREQ((const char *)type, "udp") || + STREQ((const char *)type, "tcp")) { + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + + if (connectHost == NULL) + connectHost = xmlGetProp(cur, BAD_CAST "host"); + if (connectService == NULL) + connectService = xmlGetProp(cur, BAD_CAST "service"); + } else { + if (bindHost == NULL) + bindHost = xmlGetProp(cur, BAD_CAST "host"); + if (bindService == NULL) + bindService = xmlGetProp(cur, BAD_CAST "service"); + } + + if (STREQ((const char*)type, "tcp")) + wiremode = xmlGetProp(cur, BAD_CAST "wiremode"); + + if (STREQ((const char*)type, "udp")) { + xmlFree(mode); + mode = NULL; + } + } + } + } + cur = cur->next; + } + } + + if (type == NULL || + STREQ((const char *)type, "pty")) { + strncpy(buf, "pty", buflen); + } else if (STREQ((const char *)type, "null") || + STREQ((const char *)type, "stdio") || + STREQ((const char *)type, "vc")) { + snprintf(buf, buflen, "%s", type); + } else if (STREQ((const char *)type, "file") || + STREQ((const char *)type, "dev") || + STREQ((const char *)type, "pipe")) { + if (path == NULL) { + virXMLError(conn, VIR_ERR_XML_ERROR, + _("Missing source path attribute for char device"), 0); + goto cleanup; + } + + if (STREQ((const char *)type, "dev")) + strncpy(buf, (const char *)path, buflen); + else + snprintf(buf, buflen, "%s:%s", type, path); + } else if (STREQ((const char *)type, "tcp")) { + int telnet = 0; + if (wiremode != NULL && + STREQ((const char *)wiremode, "telnet")) + telnet = 1; + + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + if (connectHost == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source host attribute for char device"), 0); + goto cleanup; + } + if (connectService == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source service attribute for char device"), 0); + goto cleanup; + } + + snprintf(buf, buflen, "%s:%s:%s", + (telnet ? "telnet" : "tcp"), + connectHost, connectService); + } else { + if (bindHost == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source host attribute for char device"), 0); + goto cleanup; + } + if (bindService == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source service attribute for char device"), 0); + goto cleanup; + } + + snprintf(buf, buflen, "%s:%s:%s,listen", + (telnet ? "telnet" : "tcp"), + bindHost, bindService); + } + } else if (STREQ((const char *)type, "udp")) { + if (connectService == NULL) { + virXMLError(conn, VIR_ERR_XML_ERROR, + _("Missing source service attribute for char device"), 0); + goto cleanup; + } + + snprintf(buf, buflen, "udp:%s:%s@%s:%s", + connectHost ? (const char *)connectHost : "", + connectService, + bindHost ? (const char *)bindHost : "", + bindService ? (const char *)bindService : ""); + } else if (STREQ((const char *)type, "unix")) { + if (path == NULL) { + virXMLError(conn, VIR_ERR_XML_ERROR, + _("Missing source path attribute for char device"), 0); + goto cleanup; + } + + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + snprintf(buf, buflen, "%s:%s", type, path); + } else { + snprintf(buf, buflen, "%s:%s,listen", type, path); + } + } + buf[buflen-1] = '\0'; + + xmlFree(mode); + xmlFree(wiremode); + xmlFree(type); + xmlFree(bindHost); + xmlFree(bindService); + xmlFree(connectHost); + xmlFree(connectService); + xmlFree(path); + + return 0; + +cleanup: + xmlFree(mode); + xmlFree(wiremode); + xmlFree(type); + xmlFree(bindHost); + xmlFree(bindService); + xmlFree(connectHost); + xmlFree(connectService); + xmlFree(path); + return -1; +} + /** * virDomainParseXMLOSDescHVM: * @conn: pointer to the hypervisor connection @@ -877,24 +1049,53 @@ virDomainParseXMLOSDescHVM(virConnectPtr nodes = NULL; } - - res = virXPathBoolean("count(domain/devices/console) > 0", ctxt); - if (res < 0) { - virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0); - goto error; + cur = virXPathNode("/domain/devices/parallel[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (virBufferVSprintf(buf, "(parallel %s)", scratch) < 0) + goto no_memory; + } else { + if (virBufferAddLit(buf, "(parallel none)") < 0) + goto no_memory; } - if (res) { - virBufferAddLit(buf, "(serial pty)"); + + cur = virXPathNode("/domain/devices/serial[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (virBufferVSprintf(buf, "(serial %s)", scratch) < 0) + goto no_memory; + } else { + res = virXPathBoolean("count(domain/devices/console) > 0", ctxt); + if (res < 0) { + virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0); + goto error; + } + if (res) { + if (virBufferAddLit(buf, "(serial pty)") < 0) + goto no_memory; + } else { + if (virBufferAddLit(buf, "(serial none)") < 0) + goto no_memory; + } } str = virXPathString("string(/domain/clock/@offset)", ctxt); if (str != NULL && !strcmp(str, "localtime")) { - virBufferAddLit(buf, "(localtime 1)"); + if (virBufferAddLit(buf, "(localtime 1)") < 0) + goto no_memory; } free(str); return (0); +no_memory: + virXMLError(conn, VIR_ERR_XML_ERROR, + "cannot allocate memory for buffer", 0); + error: free(nodes); return (-1); Index: src/xml.h =================================================================== RCS file: /data/cvs/libvirt/src/xml.h,v retrieving revision 1.23 diff -u -p -r1.23 xml.h --- src/xml.h 10 Apr 2008 16:54:54 -0000 1.23 +++ src/xml.h 18 Apr 2008 20:01:37 -0000 @@ -44,6 +44,10 @@ char * virSaveCpuSet (virConnec char * virConvertCpuSet(virConnectPtr conn, const char *str, int maxcpu); +int virDomainParseXMLOSDescHVMChar(virConnectPtr conn, + char *buf, + size_t buflen, + xmlNodePtr node); char * virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name, -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Apr 18, 2008 at 09:27:05PM +0100, Daniel P. Berrange wrote:
This patch updates Xen HVM to allow use of serial ¶llel ports, though XenD limits you to single one of each even though QEMU supports many. It also updates the <console> tag to support new syntax extensions.
This version fixes a few memory leaks in the previous code... xend_internal.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- xend_internal.h | 9 + xm_internal.c | 55 +++++++++-- xml.c | 217 ++++++++++++++++++++++++++++++++++++++++++++- xml.h | 4 5 files changed, 529 insertions(+), 22 deletions(-) Dan. Index: src/xend_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.c,v retrieving revision 1.180 diff -u -p -r1.180 xend_internal.c --- src/xend_internal.c 10 Apr 2008 16:54:54 -0000 1.180 +++ src/xend_internal.c 24 Apr 2008 15:10:00 -0000 @@ -1376,6 +1376,243 @@ xend_parse_sexp_desc_os(virConnectPtr xe return(0); } + +int +xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty) +{ + const char *type; + int telnet = 0; + char *bindPort = NULL; + char *bindHost = NULL; + char *connectPort = NULL; + char *connectHost = NULL; + char *path = NULL; + int ret = -1; + + if (value[0] == '/') { + type = "dev"; + } else if (STREQLEN(value, "null", 4)) { + type = "null"; + value = NULL; + } else if (STREQLEN(value, "vc", 2)) { + type = "vc"; + value = NULL; + } else if (STREQLEN(value, "pty", 3)) { + type = "pty"; + value = NULL; + } else if (STREQLEN(value, "stdio", 5)) { + type = "stdio"; + value = NULL; + } else if (STREQLEN(value, "file:", 5)) { + type = "file"; + value += 5; + } else if (STREQLEN(value, "pipe:", 5)) { + type = "pipe"; + value += 5; + } else if (STREQLEN(value, "tcp:", 4)) { + type = "tcp"; + value += 4; + } else if (STREQLEN(value, "telnet:", 4)) { + type = "tcp"; + value += 7; + telnet = 1; + } else if (STREQLEN(value, "udp:", 4)) { + type = "udp"; + value += 4; + } else if (STREQLEN(value, "unix:", 5)) { + type = "unix"; + value += 5; + } else { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("Unknown char device type")); + return -1; + } + + /* Compat with legacy <console tty='/dev/pts/5'/> syntax */ + if (STREQ(devtype, "console") && + STREQ(type, "pty") && + tty != NULL) { + if (virBufferVSprintf(buf, " <%s type='%s' tty='%s'>\n", + devtype, type, tty) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, " <%s type='%s'>\n", + devtype, type) < 0) + goto no_memory; + } + + if (STREQ(type, "null") || + STREQ(type, "vc") || + STREQ(type, "stdio")) { + /* no source needed */ + } else if (STREQ(type, "pty")) { + if (tty && + virBufferVSprintf(buf, " <source path='%s'/>\n", + tty) < 0) + goto no_memory; + } else if (STREQ(type, "file") || + STREQ(type, "pipe")) { + if (virBufferVSprintf(buf, " <source path='%s'/>\n", + value) < 0) + goto no_memory; + } else if (STREQ(type, "tcp")) { + const char *offset = strchr(value, ':'); + const char *offset2; + const char *mode, *protocol; + + if (offset == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("malformed char device string")); + goto error; + } + + if (offset != value && + (bindHost = strndup(value, offset - value)) == NULL) + goto no_memory; + + offset2 = strchr(offset, ','); + if (offset2 == NULL) + bindPort = strdup(offset+1); + else + bindPort = strndup(offset+1, offset2-(offset+1)); + if (bindPort == NULL) + goto no_memory; + + if (offset2 && strstr(offset2, ",listen")) + mode = "bind"; + else + mode = "connect"; + protocol = telnet ? "telnet":"raw"; + + if (bindHost) { + if (virBufferVSprintf(buf, + " <source mode='%s' host='%s' service='%s'/>\n", + mode, bindHost, bindPort) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, + " <source mode='%s' service='%s'/>\n", + mode, bindPort) < 0) + goto no_memory; + } + if (virBufferVSprintf(buf, + " <protocol type='%s'/>\n", + protocol) < 0) + goto no_memory; + } else if (STREQ(type, "udp")) { + const char *offset = strchr(value, ':'); + const char *offset2, *offset3; + + if (offset == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("malformed char device string")); + goto error; + } + + if (offset != value && + (connectHost = strndup(value, offset - value)) == NULL) + goto no_memory; + + offset2 = strchr(offset, '@'); + if (offset2 != NULL) { + if ((connectPort = strndup(offset + 1, offset2-(offset+1))) == NULL) + goto no_memory; + + offset3 = strchr(offset2, ':'); + if (offset3 == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("malformed char device string")); + goto error; + } + + if (offset3 > (offset2 + 1) && + (bindHost = strndup(offset2 + 1, offset3 - (offset2+1))) == NULL) + goto no_memory; + + if ((bindPort = strdup(offset3 + 1)) == NULL) + goto no_memory; + } else { + if ((connectPort = strdup(offset + 1)) == NULL) + goto no_memory; + } + + if (connectPort) { + if (connectHost) { + if (virBufferVSprintf(buf, + " <source mode='connect' host='%s' service='%s'/>\n", + connectHost, connectPort) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, + " <source mode='connect' service='%s'/>\n", + connectPort) < 0) + goto no_memory; + } + } + if (bindPort) { + if (bindHost) { + if (virBufferVSprintf(buf, + " <source mode='bind' host='%s' service='%s'/>\n", + bindHost, bindPort) < 0) + goto no_memory; + } else { + if (virBufferVSprintf(buf, + " <source mode='bind' service='%s'/>\n", + bindPort) < 0) + goto no_memory; + } + } + + } else if (STREQ(type, "unix")) { + const char *offset = strchr(value, ','); + int dolisten = 0; + if (offset) + path = strndup(value, (offset - value)); + else + path = strdup(value); + if (path == NULL) + goto no_memory; + + if (strstr(offset, ",listen") != NULL) + dolisten = 1; + + if (virBufferVSprintf(buf, " <source mode='%s' path='%s'/>\n", + dolisten ? "bind" : "connect", path) < 0) + goto no_memory; + } + + if (virBufferVSprintf(buf, " <target port='%d'/>\n", + portNum) < 0) + goto no_memory; + + if (virBufferVSprintf(buf, " </%s>\n", + devtype) < 0) + goto no_memory; + + ret = 0; + + if (ret == -1) { +no_memory: + virXendError(conn, VIR_ERR_NO_MEMORY, + _("no memory for char device config")); + } + +error: + + free(path); + free(bindHost); + free(bindPort); + free(connectHost); + free(connectPort); + + return ret; +} + /** * xend_parse_sexp_desc: * @conn: the connection associated with the XML @@ -1828,10 +2065,33 @@ xend_parse_sexp_desc(virConnectPtr conn, } tty = xenStoreDomainGetConsolePath(conn, domid); - if (tty) { - virBufferVSprintf(&buf, " <console tty='%s'/>\n", tty); - free(tty); + if (hvm) { + tmp = sexpr_node(root, "domain/image/hvm/serial"); + if (tmp && STRNEQ(tmp, "none")) { + if (xend_parse_sexp_desc_char(conn, &buf, "serial", 0, tmp, tty) < 0) + goto error; + /* Add back-compat <console/> tag for primary console */ + if (xend_parse_sexp_desc_char(conn, &buf, "console", 0, tmp, tty) < 0) + goto error; + } + tmp = sexpr_node(root, "domain/image/hvm/parallel"); + if (tmp && STRNEQ(tmp, "none")) { + /* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */ + if (xend_parse_sexp_desc_char(conn, &buf, "parallel", 0, tmp, NULL) < 0) + goto error; + } + } else { + /* Paravirt always has a console */ + if (tty) { + virBufferVSprintf(&buf, " <console type='pty' tty='%s'>\n", tty); + virBufferVSprintf(&buf, " <source path='%s'/>\n", tty); + } else { + virBufferAddLit(&buf, " <console type='pty'>\n"); + } + virBufferAddLit(&buf, " <target port='0'/>\n"); + virBufferAddLit(&buf, " </console>\n"); } + free(tty); virBufferAddLit(&buf, " </devices>\n"); virBufferAddLit(&buf, "</domain>\n"); Index: src/xend_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.h,v retrieving revision 1.40 diff -u -p -r1.40 xend_internal.h --- src/xend_internal.h 10 Apr 2008 16:54:54 -0000 1.40 +++ src/xend_internal.h 24 Apr 2008 15:10:00 -0000 @@ -20,12 +20,12 @@ #include "libvirt/libvirt.h" #include "capabilities.h" +#include "buf.h" #ifdef __cplusplus extern "C" { #endif - /** * \brief Setup the connection to a xend instance via TCP * \param host The host name to connect to @@ -180,6 +180,13 @@ char *xenDaemonDomainDumpXMLByName(virCo */ int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer); + int xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty); + char *xend_parse_domain_sexp(virConnectPtr conn, char *root, int xendConfigVersion); /* refactored ones */ Index: src/xm_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xm_internal.c,v retrieving revision 1.70 diff -u -p -r1.70 xm_internal.c --- src/xm_internal.c 10 Apr 2008 16:54:54 -0000 1.70 +++ src/xm_internal.c 24 Apr 2008 15:10:01 -0000 @@ -1025,11 +1025,22 @@ char *xenXMDomainFormatXML(virConnectPtr } if (hvm) { - if (xenXMConfigGetString(conf, "serial", &str) == 0 && !strcmp(str, "pty")) { - virBufferAddLit(buf, " <console/>\n"); + if (xenXMConfigGetString(conf, "parallel", &str) == 0) { + if (STRNEQ(str, "none")) + xend_parse_sexp_desc_char(conn, buf, "parallel", 0, str, NULL); + } + if (xenXMConfigGetString(conf, "serial", &str) == 0) { + if (STRNEQ(str, "none")) { + xend_parse_sexp_desc_char(conn, buf, "serial", 0, str, NULL); + /* Add back-compat console tag for primary console */ + xend_parse_sexp_desc_char(conn, buf, "console", 0, str, NULL); + } } - } else { /* Paravirt implicitly always has a console */ - virBufferAddLit(buf, " <console/>\n"); + } else { + /* Paravirt implicitly always has a single console */ + virBufferAddLit(buf, " <console type='pty'>\n"); + virBufferAddLit(buf, " <target port='0'/>\n"); + virBufferAddLit(buf, " </console>\n"); } virBufferAddLit(buf, " </devices>\n"); @@ -2267,14 +2278,38 @@ virConfPtr xenXMParseXMLToConfig(virConn obj = NULL; if (hvm) { - obj = xmlXPathEval(BAD_CAST "count(/domain/devices/console) > 0", ctxt); - if ((obj != NULL) && (obj->type == XPATH_BOOLEAN) && - (obj->boolval)) { - if (xenXMConfigSetString(conf, "serial", "pty") < 0) + xmlNodePtr cur; + cur = virXPathNode("/domain/devices/parallel[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) { + goto error; + } + + if (xenXMConfigSetString(conf, "parallel", scratch) < 0) + goto error; + } else { + if (xenXMConfigSetString(conf, "parallel", "none") < 0) goto error; } - xmlXPathFreeObject(obj); - obj = NULL; + + cur = virXPathNode("/domain/devices/serial[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (xenXMConfigSetString(conf, "serial", scratch) < 0) + goto error; + } else { + if (virXPathBoolean("count(/domain/devices/console) > 0", ctxt)) { + if (xenXMConfigSetString(conf, "serial", "pty") < 0) + goto error; + } else { + if (xenXMConfigSetString(conf, "serial", "none") < 0) + goto error; + } + } } xmlFreeDoc(doc); Index: src/xml.c =================================================================== RCS file: /data/cvs/libvirt/src/xml.c,v retrieving revision 1.117 diff -u -p -r1.117 xml.c --- src/xml.c 10 Apr 2008 16:54:54 -0000 1.117 +++ src/xml.c 24 Apr 2008 15:10:01 -0000 @@ -673,6 +673,178 @@ virDomainParseXMLGraphicsDescVFB(virConn } +int +virDomainParseXMLOSDescHVMChar(virConnectPtr conn, + char *buf, + size_t buflen, + xmlNodePtr node) +{ + xmlChar *type = NULL; + xmlChar *path = NULL; + xmlChar *bindHost = NULL; + xmlChar *bindService = NULL; + xmlChar *connectHost = NULL; + xmlChar *connectService = NULL; + xmlChar *mode = NULL; + xmlChar *protocol = NULL; + xmlNodePtr cur; + + type = xmlGetProp(node, BAD_CAST "type"); + + if (type != NULL) { + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "source")) { + if (mode == NULL) + mode = xmlGetProp(cur, BAD_CAST "mode"); + + if (STREQ((const char *)type, "dev") || + STREQ((const char *)type, "file") || + STREQ((const char *)type, "pipe") || + STREQ((const char *)type, "unix")) { + if (path == NULL) + path = xmlGetProp(cur, BAD_CAST "path"); + + } else if (STREQ((const char *)type, "udp") || + STREQ((const char *)type, "tcp")) { + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + + if (connectHost == NULL) + connectHost = xmlGetProp(cur, BAD_CAST "host"); + if (connectService == NULL) + connectService = xmlGetProp(cur, BAD_CAST "service"); + } else { + if (bindHost == NULL) + bindHost = xmlGetProp(cur, BAD_CAST "host"); + if (bindService == NULL) + bindService = xmlGetProp(cur, BAD_CAST "service"); + } + + if (STREQ((const char*)type, "udp")) { + xmlFree(mode); + mode = NULL; + } + } + } else if (xmlStrEqual(cur->name, BAD_CAST "protocol")) { + if (protocol == NULL) + protocol = xmlGetProp(cur, BAD_CAST "type"); + } + } + cur = cur->next; + } + } + + if (type == NULL || + STREQ((const char *)type, "pty")) { + strncpy(buf, "pty", buflen); + } else if (STREQ((const char *)type, "null") || + STREQ((const char *)type, "stdio") || + STREQ((const char *)type, "vc")) { + snprintf(buf, buflen, "%s", type); + } else if (STREQ((const char *)type, "file") || + STREQ((const char *)type, "dev") || + STREQ((const char *)type, "pipe")) { + if (path == NULL) { + virXMLError(conn, VIR_ERR_XML_ERROR, + _("Missing source path attribute for char device"), 0); + goto cleanup; + } + + if (STREQ((const char *)type, "dev")) + strncpy(buf, (const char *)path, buflen); + else + snprintf(buf, buflen, "%s:%s", type, path); + } else if (STREQ((const char *)type, "tcp")) { + int telnet = 0; + if (protocol != NULL && + STREQ((const char *)protocol, "telnet")) + telnet = 1; + + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + if (connectHost == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source host attribute for char device"), 0); + goto cleanup; + } + if (connectService == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source service attribute for char device"), 0); + goto cleanup; + } + + snprintf(buf, buflen, "%s:%s:%s", + (telnet ? "telnet" : "tcp"), + connectHost, connectService); + } else { + if (bindHost == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source host attribute for char device"), 0); + goto cleanup; + } + if (bindService == NULL) { + virXMLError(conn, VIR_ERR_INTERNAL_ERROR, + _("Missing source service attribute for char device"), 0); + goto cleanup; + } + + snprintf(buf, buflen, "%s:%s:%s,listen", + (telnet ? "telnet" : "tcp"), + bindHost, bindService); + } + } else if (STREQ((const char *)type, "udp")) { + if (connectService == NULL) { + virXMLError(conn, VIR_ERR_XML_ERROR, + _("Missing source service attribute for char device"), 0); + goto cleanup; + } + + snprintf(buf, buflen, "udp:%s:%s@%s:%s", + connectHost ? (const char *)connectHost : "", + connectService, + bindHost ? (const char *)bindHost : "", + bindService ? (const char *)bindService : ""); + } else if (STREQ((const char *)type, "unix")) { + if (path == NULL) { + virXMLError(conn, VIR_ERR_XML_ERROR, + _("Missing source path attribute for char device"), 0); + goto cleanup; + } + + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + snprintf(buf, buflen, "%s:%s", type, path); + } else { + snprintf(buf, buflen, "%s:%s,listen", type, path); + } + } + buf[buflen-1] = '\0'; + + xmlFree(mode); + xmlFree(protocol); + xmlFree(type); + xmlFree(bindHost); + xmlFree(bindService); + xmlFree(connectHost); + xmlFree(connectService); + xmlFree(path); + + return 0; + +cleanup: + xmlFree(mode); + xmlFree(protocol); + xmlFree(type); + xmlFree(bindHost); + xmlFree(bindService); + xmlFree(connectHost); + xmlFree(connectService); + xmlFree(path); + return -1; +} + /** * virDomainParseXMLOSDescHVM: * @conn: pointer to the hypervisor connection @@ -877,24 +1049,53 @@ virDomainParseXMLOSDescHVM(virConnectPtr nodes = NULL; } - - res = virXPathBoolean("count(domain/devices/console) > 0", ctxt); - if (res < 0) { - virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0); - goto error; + cur = virXPathNode("/domain/devices/parallel[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (virBufferVSprintf(buf, "(parallel %s)", scratch) < 0) + goto no_memory; + } else { + if (virBufferAddLit(buf, "(parallel none)") < 0) + goto no_memory; } - if (res) { - virBufferAddLit(buf, "(serial pty)"); + + cur = virXPathNode("/domain/devices/serial[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (virBufferVSprintf(buf, "(serial %s)", scratch) < 0) + goto no_memory; + } else { + res = virXPathBoolean("count(domain/devices/console) > 0", ctxt); + if (res < 0) { + virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0); + goto error; + } + if (res) { + if (virBufferAddLit(buf, "(serial pty)") < 0) + goto no_memory; + } else { + if (virBufferAddLit(buf, "(serial none)") < 0) + goto no_memory; + } } str = virXPathString("string(/domain/clock/@offset)", ctxt); if (str != NULL && !strcmp(str, "localtime")) { - virBufferAddLit(buf, "(localtime 1)"); + if (virBufferAddLit(buf, "(localtime 1)") < 0) + goto no_memory; } free(str); return (0); +no_memory: + virXMLError(conn, VIR_ERR_XML_ERROR, + _("cannot allocate memory for buffer"), 0); + error: free(nodes); return (-1); Index: src/xml.h =================================================================== RCS file: /data/cvs/libvirt/src/xml.h,v retrieving revision 1.23 diff -u -p -r1.23 xml.h --- src/xml.h 10 Apr 2008 16:54:54 -0000 1.23 +++ src/xml.h 24 Apr 2008 15:10:01 -0000 @@ -44,6 +44,10 @@ char * virSaveCpuSet (virConnec char * virConvertCpuSet(virConnectPtr conn, const char *str, int maxcpu); +int virDomainParseXMLOSDescHVMChar(virConnectPtr conn, + char *buf, + size_t buflen, + xmlNodePtr node); char * virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name, -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Fri, Apr 18, 2008 at 09:27:05PM +0100, Daniel P. Berrange wrote:
This patch updates Xen HVM to allow use of serial ¶llel ports, though XenD limits you to single one of each even though QEMU supports many. It also updates the <console> tag to support new syntax extensions.
This version fixes a few memory leaks in the previous code...
Hi Dan,
Index: src/xend_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.c,v retrieving revision 1.180 diff -u -p -r1.180 xend_internal.c --- src/xend_internal.c 10 Apr 2008 16:54:54 -0000 1.180 +++ src/xend_internal.c 24 Apr 2008 15:10:00 -0000 @@ -1376,6 +1376,243 @@ xend_parse_sexp_desc_os(virConnectPtr xe return(0); }
+ +int +xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty) +{ + const char *type; + int telnet = 0; + char *bindPort = NULL; + char *bindHost = NULL; + char *connectPort = NULL; + char *connectHost = NULL; + char *path = NULL; + int ret = -1; + + if (value[0] == '/') { + type = "dev"; + } else if (STREQLEN(value, "null", 4)) { + type = "null"; + value = NULL; + } else if (STREQLEN(value, "vc", 2)) { + type = "vc"; + value = NULL; + } else if (STREQLEN(value, "pty", 3)) { + type = "pty"; + value = NULL; + } else if (STREQLEN(value, "stdio", 5)) { + type = "stdio"; + value = NULL; + } else if (STREQLEN(value, "file:", 5)) { + type = "file"; + value += 5; + } else if (STREQLEN(value, "pipe:", 5)) { + type = "pipe"; + value += 5; + } else if (STREQLEN(value, "tcp:", 4)) { + type = "tcp"; + value += 4; + } else if (STREQLEN(value, "telnet:", 4)) {
That "4" should be 7. It'd be nice to avoid the riskily redundant length, by using a STR* macro that requires a literal string S as argument #2, and uses sizeof(S)-1 as the length argument. This code could be factored even more with a loop. The only special cases would be value[0]=='/' and "telnet:" having type of "tcp" and setting telnet=1.
+ type = "tcp"; + value += 7; + telnet = 1; + } else if (STREQLEN(value, "udp:", 4)) { + type = "udp"; + value += 4; + } else if (STREQLEN(value, "unix:", 5)) { + type = "unix"; + value += 5; + } else { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("Unknown char device type")); + return -1; + } +
...
+ } else if (STREQ(type, "unix")) { + const char *offset = strchr(value, ','); + int dolisten = 0; + if (offset) + path = strndup(value, (offset - value)); + else + path = strdup(value); + if (path == NULL) + goto no_memory; + + if (strstr(offset, ",listen") != NULL)
If the strchr call above finds no comma, then "offset" will be NULL and strstr call will segfault. ...
+ tmp = sexpr_node(root, "domain/image/hvm/parallel"); + if (tmp && STRNEQ(tmp, "none")) { + /* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */ + if (xend_parse_sexp_desc_char(conn, &buf, "parallel", 0, tmp, NULL) < 0) + goto error; + } + } else { + /* Paravirt always has a console */ + if (tty) { + virBufferVSprintf(&buf, " <console type='pty' tty='%s'>\n", tty); + virBufferVSprintf(&buf, " <source path='%s'/>\n", tty); + } else { + virBufferAddLit(&buf, " <console type='pty'>\n"); + } + virBufferAddLit(&buf, " <target port='0'/>\n"); + virBufferAddLit(&buf, " </console>\n"); } + free(tty);
virBufferAddLit(&buf, " </devices>\n"); virBufferAddLit(&buf, "</domain>\n");
All of the virBufferAddLit and virBufferVSprintf calls above can fail with ENOMEM. I see that there are *many* more virBufferAddLit and virBufferVSprintf calls that ignore their return values (over 300), so maybe I'm missing something.
Index: src/xend_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.h,v retrieving revision 1.40 diff -u -p -r1.40 xend_internal.h --- src/xend_internal.h 10 Apr 2008 16:54:54 -0000 1.40 +++ src/xend_internal.h 24 Apr 2008 15:10:00 -0000 @@ -20,12 +20,12 @@
#include "libvirt/libvirt.h" #include "capabilities.h" +#include "buf.h"
#ifdef __cplusplus extern "C" { #endif
- /** * \brief Setup the connection to a xend instance via TCP * \param host The host name to connect to @@ -180,6 +180,13 @@ char *xenDaemonDomainDumpXMLByName(virCo */ int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
+ int xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty); + char *xend_parse_domain_sexp(virConnectPtr conn, char *root, int xendConfigVersion);
/* refactored ones */ Index: src/xm_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xm_internal.c,v retrieving revision 1.70 diff -u -p -r1.70 xm_internal.c --- src/xm_internal.c 10 Apr 2008 16:54:54 -0000 1.70 +++ src/xm_internal.c 24 Apr 2008 15:10:01 -0000 @@ -1025,11 +1025,22 @@ char *xenXMDomainFormatXML(virConnectPtr }
if (hvm) { - if (xenXMConfigGetString(conf, "serial", &str) == 0 && !strcmp(str, "pty")) { - virBufferAddLit(buf, " <console/>\n"); + if (xenXMConfigGetString(conf, "parallel", &str) == 0) { + if (STRNEQ(str, "none")) + xend_parse_sexp_desc_char(conn, buf, "parallel", 0, str, NULL); + } + if (xenXMConfigGetString(conf, "serial", &str) == 0) { + if (STRNEQ(str, "none")) { + xend_parse_sexp_desc_char(conn, buf, "serial", 0, str, NULL); + /* Add back-compat console tag for primary console */ + xend_parse_sexp_desc_char(conn, buf, "console", 0, str, NULL); + } } - } else { /* Paravirt implicitly always has a console */ - virBufferAddLit(buf, " <console/>\n"); + } else { + /* Paravirt implicitly always has a single console */ + virBufferAddLit(buf, " <console type='pty'>\n"); + virBufferAddLit(buf, " <target port='0'/>\n"); + virBufferAddLit(buf, " </console>\n"); }
virBufferAddLit(buf, " </devices>\n"); @@ -2267,14 +2278,38 @@ virConfPtr xenXMParseXMLToConfig(virConn obj = NULL;
if (hvm) { - obj = xmlXPathEval(BAD_CAST "count(/domain/devices/console) > 0", ctxt); - if ((obj != NULL) && (obj->type == XPATH_BOOLEAN) && - (obj->boolval)) { - if (xenXMConfigSetString(conf, "serial", "pty") < 0) + xmlNodePtr cur; + cur = virXPathNode("/domain/devices/parallel[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) { + goto error; + } + + if (xenXMConfigSetString(conf, "parallel", scratch) < 0) + goto error; + } else { + if (xenXMConfigSetString(conf, "parallel", "none") < 0) goto error; } - xmlXPathFreeObject(obj); - obj = NULL; + + cur = virXPathNode("/domain/devices/serial[1]", ctxt); + if (cur != NULL) { + char scratch[PATH_MAX]; + if (virDomainParseXMLOSDescHVMChar(conn, scratch, sizeof(scratch), cur) < 0) + goto error; + if (xenXMConfigSetString(conf, "serial", scratch) < 0) + goto error; + } else { + if (virXPathBoolean("count(/domain/devices/console) > 0", ctxt)) { + if (xenXMConfigSetString(conf, "serial", "pty") < 0) + goto error; + } else { + if (xenXMConfigSetString(conf, "serial", "none") < 0) + goto error; + } + } }
xmlFreeDoc(doc); Index: src/xml.c =================================================================== RCS file: /data/cvs/libvirt/src/xml.c,v retrieving revision 1.117 diff -u -p -r1.117 xml.c --- src/xml.c 10 Apr 2008 16:54:54 -0000 1.117 +++ src/xml.c 24 Apr 2008 15:10:01 -0000 @@ -673,6 +673,178 @@ virDomainParseXMLGraphicsDescVFB(virConn }
+int +virDomainParseXMLOSDescHVMChar(virConnectPtr conn, + char *buf, + size_t buflen, + xmlNodePtr node) +{ + xmlChar *type = NULL;
Can you use "const char *" above, instead of "xmlChar *"? If so, that'd let you remove most of those risky and ugly (const char*) casts below. Ditto for all of these others.
+ xmlChar *path = NULL; + xmlChar *bindHost = NULL; + xmlChar *bindService = NULL; + xmlChar *connectHost = NULL; + xmlChar *connectService = NULL; + xmlChar *mode = NULL; + xmlChar *protocol = NULL; + xmlNodePtr cur; + + type = xmlGetProp(node, BAD_CAST "type"); + + if (type != NULL) { + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "source")) { + if (mode == NULL) + mode = xmlGetProp(cur, BAD_CAST "mode"); + + if (STREQ((const char *)type, "dev") || + STREQ((const char *)type, "file") || + STREQ((const char *)type, "pipe") || + STREQ((const char *)type, "unix")) { + if (path == NULL) + path = xmlGetProp(cur, BAD_CAST "path"); + + } else if (STREQ((const char *)type, "udp") || + STREQ((const char *)type, "tcp")) { + if (mode == NULL || + STREQ((const char *)mode, "connect")) { + + if (connectHost == NULL) + connectHost = xmlGetProp(cur, BAD_CAST "host"); + if (connectService == NULL) + connectService = xmlGetProp(cur, BAD_CAST "service"); + } else { + if (bindHost == NULL) + bindHost = xmlGetProp(cur, BAD_CAST "host"); + if (bindService == NULL) + bindService = xmlGetProp(cur, BAD_CAST "service"); + } + + if (STREQ((const char*)type, "udp")) { + xmlFree(mode); + mode = NULL; + } + } + } else if (xmlStrEqual(cur->name, BAD_CAST "protocol")) { + if (protocol == NULL) + protocol = xmlGetProp(cur, BAD_CAST "type"); + } + } + cur = cur->next; + } + } + + if (type == NULL || + STREQ((const char *)type, "pty")) { + strncpy(buf, "pty", buflen); + } else if (STREQ((const char *)type, "null") || + STREQ((const char *)type, "stdio") || + STREQ((const char *)type, "vc")) { + snprintf(buf, buflen, "%s", type); + } else if (STREQ((const char *)type, "file") || + STREQ((const char *)type, "dev") || + STREQ((const char *)type, "pipe")) { ...

On Thu, Apr 24, 2008 at 10:42:34PM +0200, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Fri, Apr 18, 2008 at 09:27:05PM +0100, Daniel P. Berrange wrote:
This patch updates Xen HVM to allow use of serial ¶llel ports, though XenD limits you to single one of each even though QEMU supports many. It also updates the <console> tag to support new syntax extensions.
This version fixes a few memory leaks in the previous code...
Hi Dan,
Index: src/xend_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.c,v retrieving revision 1.180 diff -u -p -r1.180 xend_internal.c --- src/xend_internal.c 10 Apr 2008 16:54:54 -0000 1.180 +++ src/xend_internal.c 24 Apr 2008 15:10:00 -0000 @@ -1376,6 +1376,243 @@ xend_parse_sexp_desc_os(virConnectPtr xe return(0); }
+ +int +xend_parse_sexp_desc_char(virConnectPtr conn, + virBufferPtr buf, + const char *devtype, + int portNum, + const char *value, + const char *tty) +{ + const char *type; + int telnet = 0; + char *bindPort = NULL; + char *bindHost = NULL; + char *connectPort = NULL; + char *connectHost = NULL; + char *path = NULL; + int ret = -1; + + if (value[0] == '/') { + type = "dev"; + } else if (STREQLEN(value, "null", 4)) { + type = "null"; + value = NULL; + } else if (STREQLEN(value, "vc", 2)) { + type = "vc"; + value = NULL; + } else if (STREQLEN(value, "pty", 3)) { + type = "pty"; + value = NULL; + } else if (STREQLEN(value, "stdio", 5)) { + type = "stdio"; + value = NULL; + } else if (STREQLEN(value, "file:", 5)) { + type = "file"; + value += 5; + } else if (STREQLEN(value, "pipe:", 5)) { + type = "pipe"; + value += 5; + } else if (STREQLEN(value, "tcp:", 4)) { + type = "tcp"; + value += 4; + } else if (STREQLEN(value, "telnet:", 4)) {
That "4" should be 7.
It'd be nice to avoid the riskily redundant length, by using a STR* macro that requires a literal string S as argument #2, and uses sizeof(S)-1 as the length argument.
I'll see about adding a suitable macro for that.
+ } else if (STREQ(type, "unix")) { + const char *offset = strchr(value, ','); + int dolisten = 0; + if (offset) + path = strndup(value, (offset - value)); + else + path = strdup(value); + if (path == NULL) + goto no_memory; + + if (strstr(offset, ",listen") != NULL)
If the strchr call above finds no comma, then "offset" will be NULL and strstr call will segfault.
Yes, that needs a check for offset != NULL in the conditional before strstr.
virBufferAddLit(&buf, " </devices>\n"); virBufferAddLit(&buf, "</domain>\n");
All of the virBufferAddLit and virBufferVSprintf calls above can fail with ENOMEM. I see that there are *many* more virBufferAddLit and virBufferVSprintf calls that ignore their return values (over 300), so maybe I'm missing something.
Yes, the entire set of Xen drivers is basically fubar wrt to checking virBufferXXX return values. I felt that needed addresing independantly changing everything in one go, so didn't try to address that in this patch.
+int +virDomainParseXMLOSDescHVMChar(virConnectPtr conn, + char *buf, + size_t buflen, + xmlNodePtr node) +{ + xmlChar *type = NULL;
Can you use "const char *" above, instead of "xmlChar *"? If so, that'd let you remove most of those risky and ugly (const char*) casts below.
That'd just mean I needed to cast the to const char * and back to xmlChar * in different places. eg all the xmlGetProp and xmlFree calls. Its pretty unpleasant either way around, so I kept the style the rest of the file uses. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Apr 24, 2008 at 10:14:49PM +0100, Daniel P. Berrange wrote:
On Thu, Apr 24, 2008 at 10:42:34PM +0200, Jim Meyering wrote:
All of the virBufferAddLit and virBufferVSprintf calls above can fail with ENOMEM. I see that there are *many* more virBufferAddLit and virBufferVSprintf calls that ignore their return values (over 300), so maybe I'm missing something.
Yes, the entire set of Xen drivers is basically fubar wrt to checking virBufferXXX return values. I felt that needed addresing independantly changing everything in one go, so didn't try to address that in this patch.
Maybe the best is to store in the buffer the fact that there have been an error at some point, and check that value before extracting the content in a single place, that would make the code cleaner, and makes harder to miss one test. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Fri, Apr 25, 2008 at 03:11:44AM -0400, Daniel Veillard wrote:
On Thu, Apr 24, 2008 at 10:14:49PM +0100, Daniel P. Berrange wrote:
On Thu, Apr 24, 2008 at 10:42:34PM +0200, Jim Meyering wrote:
All of the virBufferAddLit and virBufferVSprintf calls above can fail with ENOMEM. I see that there are *many* more virBufferAddLit and virBufferVSprintf calls that ignore their return values (over 300), so maybe I'm missing something.
Yes, the entire set of Xen drivers is basically fubar wrt to checking virBufferXXX return values. I felt that needed addresing independantly changing everything in one go, so didn't try to address that in this patch.
Maybe the best is to store in the buffer the fact that there have been an error at some point, and check that value before extracting the content in a single place, that would make the code cleaner, and makes harder to miss one test.
So we've two options: - Make all the virBuffer* functions be void, and keep an internal error flag to be checked at the end - Annotate all the virBuffer* functions with __attribute((warn_unused_result)) which forces the caller to check the return value I'm acutally inclined to go for the former, since it'll let us remove a large number of 'goto no_memory' statements giving clearer code I think I'd also like to mak the virBuffer struct private, so people can't access the data field directly - force them to go via an API to get hold of the internal char * - this lets us ensure they don't access the data if an error has occurred. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Fri, Apr 25, 2008 at 03:11:44AM -0400, Daniel Veillard wrote:
On Thu, Apr 24, 2008 at 10:14:49PM +0100, Daniel P. Berrange wrote:
On Thu, Apr 24, 2008 at 10:42:34PM +0200, Jim Meyering wrote:
All of the virBufferAddLit and virBufferVSprintf calls above can fail with ENOMEM. I see that there are *many* more virBufferAddLit and virBufferVSprintf calls that ignore their return values (over 300), so maybe I'm missing something.
Yes, the entire set of Xen drivers is basically fubar wrt to checking virBufferXXX return values. I felt that needed addresing independantly changing everything in one go, so didn't try to address that in this patch.
Maybe the best is to store in the buffer the fact that there have been an error at some point, and check that value before extracting the content in a single place, that would make the code cleaner, and makes harder to miss one test.
So we've two options:
- Make all the virBuffer* functions be void, and keep an internal error flag to be checked at the end
- Annotate all the virBuffer* functions with __attribute((warn_unused_result)) which forces the caller to check the return value
I'm acutally inclined to go for the former, since it'll let us remove a large number of 'goto no_memory' statements giving clearer code
I agree.
I think I'd also like to mak the virBuffer struct private, so people can't access the data field directly - force them to go via an API to get hold of the internal char * - this lets us ensure they don't access the data if an error has occurred.
Sounds good. As a second step, I guess. If we're revamping, then it'd be good to move away from the pointer-hiding typedef in the current implementation: typedef virBuffer *virBufferPtr; That makes it hard to declare such a parameter const, as it will have to be in the string-extracting or error-state-querying functions. The alternative is to use e.g., typedef const virBuffer *virBufferConstPtr; but that's far less readable and doesn't scale well.

On Thu, Apr 24, 2008 at 10:42:34PM +0200, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
+ if (value[0] == '/') { + type = "dev"; + } else if (STREQLEN(value, "null", 4)) { + type = "null"; + value = NULL; + } else if (STREQLEN(value, "vc", 2)) { + type = "vc"; + value = NULL; + } else if (STREQLEN(value, "pty", 3)) { + type = "pty"; + value = NULL; + } else if (STREQLEN(value, "stdio", 5)) { + type = "stdio"; + value = NULL; + } else if (STREQLEN(value, "file:", 5)) { + type = "file"; + value += 5; + } else if (STREQLEN(value, "pipe:", 5)) { + type = "pipe"; + value += 5; + } else if (STREQLEN(value, "tcp:", 4)) { + type = "tcp"; + value += 4; + } else if (STREQLEN(value, "telnet:", 4)) {
That "4" should be 7.
It'd be nice to avoid the riskily redundant length, by using a STR* macro that requires a literal string S as argument #2, and uses sizeof(S)-1 as the length argument.
I defined a new convenience function STRPREFIX(str, prefix) which applies strlen(prefix) so we avoid the hardcoding. I didn't use sizeof(prefix) because someone might pass a non-literal string as the prefix and thta would endup as sizeof(char*) rather than the real length.
+ } else if (STREQ(type, "unix")) { + const char *offset = strchr(value, ','); + int dolisten = 0; + if (offset) + path = strndup(value, (offset - value)); + else + path = strdup(value); + if (path == NULL) + goto no_memory; + + if (strstr(offset, ",listen") != NULL)
If the strchr call above finds no comma, then "offset" will be NULL and strstr call will segfault.
Fix this to chcek offset for NULL.
+ tmp = sexpr_node(root, "domain/image/hvm/parallel"); + if (tmp && STRNEQ(tmp, "none")) { + /* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */ + if (xend_parse_sexp_desc_char(conn, &buf, "parallel", 0, tmp, NULL) < 0) + goto error; + } + } else { + /* Paravirt always has a console */ + if (tty) { + virBufferVSprintf(&buf, " <console type='pty' tty='%s'>\n", tty); + virBufferVSprintf(&buf, " <source path='%s'/>\n", tty); + } else { + virBufferAddLit(&buf, " <console type='pty'>\n"); + } + virBufferAddLit(&buf, " <target port='0'/>\n"); + virBufferAddLit(&buf, " </console>\n"); } + free(tty);
virBufferAddLit(&buf, " </devices>\n"); virBufferAddLit(&buf, "</domain>\n");
All of the virBufferAddLit and virBufferVSprintf calls above can fail with ENOMEM. I see that there are *many* more virBufferAddLit and virBufferVSprintf calls that ignore their return values (over 300), so maybe I'm missing something.
As discussed, posted new API to make virBuffer* safer. Regards, Daniel -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Thu, Apr 24, 2008 at 10:42:34PM +0200, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote: ... It'd be nice to avoid the riskily redundant length, by using a STR* macro that requires a literal string S as argument #2, and uses sizeof(S)-1 as the length argument.
I defined a new convenience function STRPREFIX(str, prefix) which applies strlen(prefix) so we avoid the hardcoding. I didn't use sizeof(prefix) because someone might pass a non-literal string as the prefix and thta would endup as sizeof(char*) rather than the real length.
FYI, with a macro, you can ensure it's a literal by concatenating the empty string, e.g., #define virBufferAddLit(buf_, literal_string_) \ __virBufferAdd (buf_, "" literal_string_ "", sizeof literal_string_ - 1) but maybe it's not worth being tricky when compilers are smart enough to convert strlen("literal") to 7.

This patch updates the QEMU test suites to use the new virtTestDifference function, and include tests for the serial/parallel device options. qemuxml2argvdata/qemuxml2argv-boot-cdrom.args | 2 qemuxml2argvdata/qemuxml2argv-boot-floppy.args | 2 qemuxml2argvdata/qemuxml2argv-boot-network.args | 2 qemuxml2argvdata/qemuxml2argv-clock-localtime.args | 2 qemuxml2argvdata/qemuxml2argv-clock-utc.args | 2 qemuxml2argvdata/qemuxml2argv-console-compat.args | 1 qemuxml2argvdata/qemuxml2argv-console-compat.xml | 28 ++++ qemuxml2argvdata/qemuxml2argv-disk-cdrom.args | 2 qemuxml2argvdata/qemuxml2argv-disk-floppy.args | 2 qemuxml2argvdata/qemuxml2argv-disk-many.args | 2 qemuxml2argvdata/qemuxml2argv-graphics-sdl.args | 2 qemuxml2argvdata/qemuxml2argv-graphics-vnc.args | 2 qemuxml2argvdata/qemuxml2argv-input-usbmouse.args | 2 qemuxml2argvdata/qemuxml2argv-input-usbtablet.args | 2 qemuxml2argvdata/qemuxml2argv-minimal.args | 2 qemuxml2argvdata/qemuxml2argv-misc-acpi.args | 2 qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args | 2 qemuxml2argvdata/qemuxml2argv-net-user.args | 2 qemuxml2argvdata/qemuxml2argv-parallel-tcp.args | 1 qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 26 ++++ qemuxml2argvdata/qemuxml2argv-serial-dev.args | 1 qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 30 ++++ qemuxml2argvdata/qemuxml2argv-serial-file.args | 1 qemuxml2argvdata/qemuxml2argv-serial-file.xml | 30 ++++ qemuxml2argvdata/qemuxml2argv-serial-many.args | 1 qemuxml2argvdata/qemuxml2argv-serial-many.xml | 32 +++++ qemuxml2argvdata/qemuxml2argv-serial-pty.args | 1 qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 28 ++++ qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args | 1 qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml | 30 ++++ qemuxml2argvdata/qemuxml2argv-serial-tcp.args | 1 qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 30 ++++ qemuxml2argvdata/qemuxml2argv-serial-udp.args | 1 qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 32 +++++ qemuxml2argvdata/qemuxml2argv-serial-unix.args | 1 qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 30 ++++ qemuxml2argvdata/qemuxml2argv-serial-vc.args | 1 qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 28 ++++ qemuxml2argvtest.c | 121 ++++++------------- qemuxml2xmltest.c | 117 ++++++------------ 40 files changed, 437 insertions(+), 168 deletions(-) Dan. Index: tests/qemuxml2argvtest.c =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvtest.c,v retrieving revision 1.14 diff -u -p -r1.14 qemuxml2argvtest.c --- tests/qemuxml2argvtest.c 10 Apr 2008 16:53:29 -0000 1.14 +++ tests/qemuxml2argvtest.c 18 Apr 2008 20:01:37 -0000 @@ -15,7 +15,7 @@ #include "qemu_conf.h" static char *progname; -static char *abs_top_srcdir; +static char *abs_srcdir; static struct qemud_driver driver; #define MAX_FILE 4096 @@ -71,11 +71,8 @@ static int testCompareXMLToArgvFiles(con tmp++; } - if (strcmp(expectargv, actualargv)) { - if (getenv("DEBUG_TESTS")) { - printf("Expect %4d '%s'\n", (int)strlen(expectargv), expectargv); - printf("Actual %4d '%s'\n", (int)strlen(actualargv), actualargv); - } + if (STRNEQ(expectargv, actualargv)) { + virtTestDifference(stderr, expectargv, actualargv); goto fail; } @@ -100,10 +97,10 @@ static int testCompareXMLToArgvFiles(con static int testCompareXMLToArgvHelper(const void *data) { char xml[PATH_MAX]; char args[PATH_MAX]; - snprintf(xml, PATH_MAX, "%s/tests/qemuxml2argvdata/qemuxml2argv-%s.xml", - abs_top_srcdir, (const char*)data); - snprintf(args, PATH_MAX, "%s/tests/qemuxml2argvdata/qemuxml2argv-%s.args", - abs_top_srcdir, (const char*)data); + snprintf(xml, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml", + abs_srcdir, (const char*)data); + snprintf(args, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.args", + abs_srcdir, (const char*)data); return testCompareXMLToArgvFiles(xml, args); } @@ -113,6 +110,7 @@ int main(int argc, char **argv) { int ret = 0; + char cwd[PATH_MAX]; progname = argv[0]; @@ -121,76 +119,45 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } - abs_top_srcdir = getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - return 1; + abs_srcdir = getenv("abs_srcdir"); + if (!abs_srcdir) + abs_srcdir = getcwd(cwd, sizeof(cwd)); driver.caps = qemudCapsInit(); - if (virtTestRun("QEMU XML-2-ARGV minimal", - 1, testCompareXMLToArgvHelper, "minimal") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Boot CDROM", - 1, testCompareXMLToArgvHelper, "boot-cdrom") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Boot Network", - 1, testCompareXMLToArgvHelper, "boot-network") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Boot Floppy", - 1, testCompareXMLToArgvHelper, "boot-floppy") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Clock UTC", - 1, testCompareXMLToArgvHelper, "clock-utc") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Clock Localtime", - 1, testCompareXMLToArgvHelper, "clock-localtime") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Disk CDROM", - 1, testCompareXMLToArgvHelper, "disk-cdrom") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Disk Floppy", - 1, testCompareXMLToArgvHelper, "disk-floppy") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Disk Many", - 1, testCompareXMLToArgvHelper, "disk-many") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Graphics VNC", - 1, testCompareXMLToArgvHelper, "graphics-vnc") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Graphics SDL", - 1, testCompareXMLToArgvHelper, "graphics-sdl") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Input USB Mouse", - 1, testCompareXMLToArgvHelper, "input-usbmouse") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Input USB Tablet", - 1, testCompareXMLToArgvHelper, "input-usbtablet") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Misc ACPI", - 1, testCompareXMLToArgvHelper, "misc-acpi") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Misc No Reboot", - 1, testCompareXMLToArgvHelper, "misc-no-reboot") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Net User", - 1, testCompareXMLToArgvHelper, "net-user") < 0) - ret = -1; - +#define DO_TEST(name) \ + if (virtTestRun("QEMU XML-2-ARGV " name, \ + 1, testCompareXMLToArgvHelper, (name)) < 0) \ + ret = -1 + + DO_TEST("minimal"); + DO_TEST("boot-cdrom"); + DO_TEST("boot-network"); + DO_TEST("boot-floppy"); + DO_TEST("clock-utc"); + DO_TEST("clock-localtime"); + DO_TEST("disk-cdrom"); + DO_TEST("disk-floppy"); + DO_TEST("disk-many"); + DO_TEST("graphics-vnc"); + DO_TEST("graphics-sdl"); + DO_TEST("input-usbmouse"); + DO_TEST("input-usbtablet"); + DO_TEST("misc-acpi"); + DO_TEST("misc-no-reboot"); + DO_TEST("net-user"); + + DO_TEST("serial-vc"); + DO_TEST("serial-pty"); + DO_TEST("serial-dev"); + DO_TEST("serial-file"); + DO_TEST("serial-unix"); + DO_TEST("serial-tcp"); + DO_TEST("serial-udp"); + DO_TEST("serial-tcp-telnet"); + DO_TEST("serial-many"); + DO_TEST("parallel-tcp"); + DO_TEST("console-compat"); virCapabilitiesFree(driver.caps); Index: tests/qemuxml2xmltest.c =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2xmltest.c,v retrieving revision 1.12 diff -u -p -r1.12 qemuxml2xmltest.c --- tests/qemuxml2xmltest.c 10 Apr 2008 16:53:29 -0000 1.12 +++ tests/qemuxml2xmltest.c 18 Apr 2008 20:01:37 -0000 @@ -15,7 +15,7 @@ #include "qemu_conf.h" static char *progname; -static char *abs_top_srcdir; +static char *abs_srcdir; static struct qemud_driver driver; #define MAX_FILE 4096 @@ -47,11 +47,8 @@ static int testCompareXMLToXMLFiles(cons if (!(actual = qemudGenerateXML(NULL, &driver, &vm, vmdef, 0))) goto fail; - if (strcmp(xmlData, actual)) { - if (getenv("DEBUG_TESTS")) { - printf("Expect %4d '%s'\n", (int)strlen(xmlData), xmlData); - printf("Actual %4d '%s'\n", (int)strlen(actual), actual); - } + if (STRNEQ(xmlData, actual)) { + virtTestDifference(stderr, xmlData, actual); goto fail; } @@ -66,8 +63,8 @@ static int testCompareXMLToXMLFiles(cons static int testCompareXMLToXMLHelper(const void *data) { char xml[PATH_MAX]; - snprintf(xml, PATH_MAX, "%s/tests/qemuxml2argvdata/qemuxml2argv-%s.xml", - abs_top_srcdir, (const char*)data); + snprintf(xml, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml", + abs_srcdir, (const char*)data); return testCompareXMLToXMLFiles(xml); } @@ -76,6 +73,7 @@ int main(int argc, char **argv) { int ret = 0; + char cwd[PATH_MAX]; progname = argv[0]; @@ -84,76 +82,45 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } - abs_top_srcdir = getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - return 1; - + abs_srcdir = getenv("abs_srcdir"); + if (!abs_srcdir) + abs_srcdir = getcwd(cwd, sizeof(cwd)); driver.caps = qemudCapsInit(); - if (virtTestRun("QEMU XML-2-ARGV minimal", - 1, testCompareXMLToXMLHelper, "minimal") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Boot CDROM", - 1, testCompareXMLToXMLHelper, "boot-cdrom") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Boot Network", - 1, testCompareXMLToXMLHelper, "boot-network") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Boot Floppy", - 1, testCompareXMLToXMLHelper, "boot-floppy") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Clock UTC", - 1, testCompareXMLToXMLHelper, "clock-utc") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Clock Localtime", - 1, testCompareXMLToXMLHelper, "clock-localtime") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Disk CDROM", - 1, testCompareXMLToXMLHelper, "disk-cdrom") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Disk Floppy", - 1, testCompareXMLToXMLHelper, "disk-floppy") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Disk Many", - 1, testCompareXMLToXMLHelper, "disk-many") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Graphics VNC", - 1, testCompareXMLToXMLHelper, "graphics-vnc") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Graphics SDL", - 1, testCompareXMLToXMLHelper, "graphics-sdl") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Input USB Mouse", - 1, testCompareXMLToXMLHelper, "input-usbmouse") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Input USB Tablet", - 1, testCompareXMLToXMLHelper, "input-usbtablet") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Misc ACPI", - 1, testCompareXMLToXMLHelper, "misc-acpi") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Misc No Reboot", - 1, testCompareXMLToXMLHelper, "misc-no-reboot") < 0) - ret = -1; - - if (virtTestRun("QEMU XML-2-ARGV Net User", - 1, testCompareXMLToXMLHelper, "net-user") < 0) - ret = -1; +#define DO_TEST(name) \ + if (virtTestRun("QEMU XML-2-XML " name, \ + 1, testCompareXMLToXMLHelper, (name)) < 0) \ + ret = -1 + + DO_TEST("minimal"); + DO_TEST("boot-cdrom"); + DO_TEST("boot-network"); + DO_TEST("boot-floppy"); + DO_TEST("clock-utc"); + DO_TEST("clock-localtime"); + DO_TEST("disk-cdrom"); + DO_TEST("disk-floppy"); + DO_TEST("disk-many"); + DO_TEST("graphics-vnc"); + DO_TEST("graphics-sdl"); + DO_TEST("input-usbmouse"); + DO_TEST("input-usbtablet"); + DO_TEST("misc-acpi"); + DO_TEST("misc-no-reboot"); + DO_TEST("net-user"); + + DO_TEST("serial-vc"); + DO_TEST("serial-pty"); + DO_TEST("serial-dev"); + DO_TEST("serial-file"); + DO_TEST("serial-unix"); + DO_TEST("serial-tcp"); + DO_TEST("serial-udp"); + DO_TEST("serial-tcp-telnet"); + DO_TEST("serial-many"); + DO_TEST("parallel-tcp"); + DO_TEST("console-compat"); virCapabilitiesFree(driver.caps); Index: tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-boot-cdrom.args --- tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom /dev/cdrom -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom /dev/cdrom -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-boot-floppy.args --- tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot a -hda /dev/HostVG/QEMUGuest1 -fda /tmp/firmware.img -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot a -hda /dev/HostVG/QEMUGuest1 -fda /tmp/firmware.img -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-boot-network.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-boot-network.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-boot-network.args --- tests/qemuxml2argvdata/qemuxml2argv-boot-network.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-boot-network.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot n -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot n -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-clock-localtime.args --- tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -localtime -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -localtime -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-clock-utc.args --- tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-console-compat.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-console-compat.args diff -N tests/qemuxml2argvdata/qemuxml2argv-console-compat.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-console-compat.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-disk-cdrom.args --- tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-disk-floppy.args --- tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -fda /dev/fd0 -fdb /tmp/firmware.img -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -fda /dev/fd0 -fdb /tmp/firmware.img -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-disk-many.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-disk-many.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-disk-many.args --- tests/qemuxml2argvdata/qemuxml2argv-disk-many.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-disk-many.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -hdb /dev/HostVG/QEMUGuest2 -hdc /tmp/data.img -hdd /tmp/logs.img -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -hdb /dev/HostVG/QEMUGuest2 -hdc /tmp/data.img -hdd /tmp/logs.img -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-graphics-sdl.args --- tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args,v retrieving revision 1.1 diff -u -p -r1.1 qemuxml2argv-graphics-vnc.args --- tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args 18 Jul 2007 21:34:22 -0000 1.1 +++ tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb -vnc 127.0.0.1:3 \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3 \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-input-usbmouse.args --- tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb -usbdevice mouse \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice mouse \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-input-usbtablet.args --- tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb -usbdevice tablet \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice tablet \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-minimal.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-minimal.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-minimal.args --- tests/qemuxml2argvdata/qemuxml2argv-minimal.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-minimal.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-misc-acpi.args --- tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-misc-no-reboot.args --- tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-reboot -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-reboot -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-net-user.args =================================================================== RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-net-user.args,v retrieving revision 1.2 diff -u -p -r1.2 qemuxml2argv-net-user.args --- tests/qemuxml2argvdata/qemuxml2argv-net-user.args 24 Jul 2007 14:30:06 -0000 1.2 +++ tests/qemuxml2argvdata/qemuxml2argv-net-user.args 18 Apr 2008 20:01:37 -0000 @@ -1 +1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0 -net user,vlan=0 -usb \ No newline at end of file +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0 -net user,vlan=0 -serial none -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args diff -N tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel tcp:127.0.0.1:9999,listen -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,26 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <parallel type='tcp'> + <source mode='bind' host='127.0.0.1' service='9999' wiremode='raw'/> + <target port='0'/> + </parallel> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial /dev/ttyS2 -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='dev'> + <source path='/dev/ttyS2'/> + <target port='0'/> + </serial> + <console type='dev'> + <source path='/dev/ttyS2'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-file.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-file.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-file.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-file.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial file:/tmp/serial.log -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </serial> + <console type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-many.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-many.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-many.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-many.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -serial file:/tmp/serial.log -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='pty'> + <target port='0'/> + </serial> + <serial type='file'> + <source path='/tmp/serial.log'/> + <target port='1'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial telnet:127.0.0.1:9999,listen -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='tcp'> + <source mode='bind' host='127.0.0.1' service='9999' wiremode='telnet'/> + <target port='0'/> + </serial> + <console type='tcp'> + <source mode='bind' host='127.0.0.1' service='9999' wiremode='telnet'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial tcp:127.0.0.1:9999 -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='tcp'> + <source mode='connect' host='127.0.0.1' service='9999' wiremode='raw'/> + <target port='0'/> + </serial> + <console type='tcp'> + <source mode='connect' host='127.0.0.1' service='9999' wiremode='raw'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial udp:127.0.0.1:9998@127.0.0.1:9999 -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='udp'> + <source mode='bind' host='127.0.0.1' service='9999'/> + <source mode='connect' host='127.0.0.1' service='9998'/> + <target port='0'/> + </serial> + <console type='udp'> + <source mode='bind' host='127.0.0.1' service='9999'/> + <source mode='connect' host='127.0.0.1' service='9998'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial unix:/tmp/serial.sock -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='unix'> + <source mode='connect' path='/tmp/serial.sock'/> + <target port='0'/> + </serial> + <console type='unix'> + <source mode='connect' path='/tmp/serial.sock'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial vc -parallel none -usb \ No newline at end of file Index: tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml =================================================================== RCS file: tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml diff -N tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda'/> + </disk> + <serial type='vc'> + <target port='0'/> + </serial> + <console type='vc'> + <target port='0'/> + </console> + </devices> +</domain> -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

This patch updates the Xen test suite to cover the new serial and paralle device syntax extensions sexpr2xmldata/sexpr2xml-curmem.xml | 3 sexpr2xmldata/sexpr2xml-disk-block-shareable.xml | 3 sexpr2xmldata/sexpr2xml-disk-block.xml | 3 sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml | 3 sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml | 3 sexpr2xmldata/sexpr2xml-disk-file.xml | 3 sexpr2xmldata/sexpr2xml-fv-kernel.xml | 6 sexpr2xmldata/sexpr2xml-fv-parallel-tcp.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 44 ++ sexpr2xmldata/sexpr2xml-fv-serial-file.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-null.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 46 ++ sexpr2xmldata/sexpr2xml-fv-serial-pipe.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-pty.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 46 ++ sexpr2xmldata/sexpr2xml-fv-serial-stdio.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 46 ++ sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-tcp.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-udp.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 50 ++ sexpr2xmldata/sexpr2xml-fv-serial-unix.sexpr | 1 sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 48 ++ sexpr2xmldata/sexpr2xml-net-bridged.xml | 3 sexpr2xmldata/sexpr2xml-net-routed.xml | 3 sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 6 sexpr2xmldata/sexpr2xml-pv-bootloader.xml | 3 sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 3 sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml | 3 sexpr2xmldata/sexpr2xml-pv.xml | 3 sexpr2xmltest.c | 319 ++++-------------- xmconfigdata/test-fullvirt-localtime.cfg | 2 xmconfigdata/test-fullvirt-new-cdrom.cfg | 2 xmconfigdata/test-fullvirt-old-cdrom.cfg | 2 xmconfigdata/test-fullvirt-parallel-tcp.cfg | 25 + xmconfigdata/test-fullvirt-parallel-tcp.xml | 45 ++ xmconfigdata/test-fullvirt-serial-file.cfg | 25 + xmconfigdata/test-fullvirt-serial-file.xml | 49 ++ xmconfigdata/test-fullvirt-serial-null.cfg | 25 + xmconfigdata/test-fullvirt-serial-null.xml | 47 ++ xmconfigdata/test-fullvirt-serial-pipe.cfg | 25 + xmconfigdata/test-fullvirt-serial-pipe.xml | 49 ++ xmconfigdata/test-fullvirt-serial-pty.cfg | 25 + xmconfigdata/test-fullvirt-serial-pty.xml | 47 ++ xmconfigdata/test-fullvirt-serial-stdio.cfg | 25 + xmconfigdata/test-fullvirt-serial-stdio.xml | 47 ++ xmconfigdata/test-fullvirt-serial-tcp-telnet.cfg | 25 + xmconfigdata/test-fullvirt-serial-tcp-telnet.xml | 49 ++ xmconfigdata/test-fullvirt-serial-tcp.cfg | 25 + xmconfigdata/test-fullvirt-serial-tcp.xml | 49 ++ xmconfigdata/test-fullvirt-serial-udp.cfg | 25 + xmconfigdata/test-fullvirt-serial-udp.xml | 51 ++ xmconfigdata/test-fullvirt-serial-unix.cfg | 25 + xmconfigdata/test-fullvirt-serial-unix.xml | 49 ++ xmconfigdata/test-fullvirt-usbmouse.cfg | 2 xmconfigdata/test-fullvirt-usbtablet.cfg | 2 xmconfigdata/test-fullvirt-utc.cfg | 2 xmconfigdata/test-paravirt-new-pvfb.xml | 4 xmconfigdata/test-paravirt-old-pvfb.xml | 4 xmconfigtest.c | 18 - xml2sexprdata/xml2sexpr-fv-kernel.sexpr | 2 xml2sexprdata/xml2sexpr-fv-localtime.sexpr | 2 xml2sexprdata/xml2sexpr-fv-parallel-tcp.sexpr | 1 xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-file.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-file.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-null.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-null.xml | 39 ++ xml2sexprdata/xml2sexpr-fv-serial-pipe.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-pipe.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-pty.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-pty.xml | 39 ++ xml2sexprdata/xml2sexpr-fv-serial-stdio.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-stdio.xml | 39 ++ xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-tcp.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-tcp.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-udp.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-udp.xml | 41 ++ xml2sexprdata/xml2sexpr-fv-serial-unix.sexpr | 1 xml2sexprdata/xml2sexpr-fv-serial-unix.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr | 2 xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr | 2 xml2sexprdata/xml2sexpr-fv-utc.sexpr | 2 xml2sexprdata/xml2sexpr-fv-v2.sexpr | 2 xml2sexprdata/xml2sexpr-fv-vncunused.sexpr | 2 xml2sexprdata/xml2sexpr-fv.sexpr | 2 xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr | 2 xml2sexprtest.c | 364 ++++----------------- 94 files changed, 1861 insertions(+), 548 deletions(-) Dan. Index: tests/sexpr2xmltest.c =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v retrieving revision 1.25 diff -u -p -r1.25 sexpr2xmltest.c --- tests/sexpr2xmltest.c 10 Apr 2008 16:54:54 -0000 1.25 +++ tests/sexpr2xmltest.c 18 Apr 2008 20:01:37 -0000 @@ -2,6 +2,7 @@ #include <stdio.h> #include <string.h> +#include <unistd.h> #ifdef WITH_XEN @@ -11,11 +12,11 @@ #include "testutils.h" static char *progname; -static char *abs_top_srcdir; +static char *abs_srcdir; #define MAX_FILE 4096 -static int testCompareFiles(const char *xml_rel, const char *sexpr_rel, +static int testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion) { char xmlData[MAX_FILE]; char sexprData[MAX_FILE]; @@ -23,28 +24,23 @@ static int testCompareFiles(const char * char *xmlPtr = &(xmlData[0]); char *sexprPtr = &(sexprData[0]); int ret = -1; - char xml[PATH_MAX]; - char sexpr[PATH_MAX]; - snprintf(xml, sizeof xml - 1, "%s/tests/%s", abs_top_srcdir, xml_rel); - snprintf(sexpr, sizeof sexpr - 1, "%s/tests/%s", abs_top_srcdir, sexpr_rel); - - if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) - goto fail; + if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) { + printf("Missing %s\n", xml); + goto fail; + } - if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0) - goto fail; + if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0) { + printf("Missing %s\n", sexpr); + goto fail; + } if (!(gotxml = xend_parse_domain_sexp(NULL, sexprData, xendConfigVersion))) goto fail; - if (strcmp(xmlData, gotxml)) { - if (getenv("DEBUG_TESTS")) { - printf("In test file %s -> %s:\n", sexpr, xml); - printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData); - printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml); - } - goto fail; + if (STRNEQ(xmlData, gotxml)) { + virtTestDifference(stderr, xmlData, gotxml); + goto fail; } ret = 0; @@ -55,139 +51,21 @@ static int testCompareFiles(const char * return ret; } -static int testComparePVversion1(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-pv.xml", - "sexpr2xmldata/sexpr2xml-pv.sexpr", - 1); -} - -static int testCompareFVversion1(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-fv.xml", - "sexpr2xmldata/sexpr2xml-fv.sexpr", - 1); -} - -static int testComparePVversion2(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-pv.xml", - "sexpr2xmldata/sexpr2xml-pv.sexpr", - 2); -} - -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(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-vfb-new.xml", - "sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr", - 3); -} - - -static int testCompareFVversion2(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-v2.xml", - "sexpr2xmldata/sexpr2xml-fv-v2.sexpr", - 2); -} - -static int testComparePVBootloader(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-bootloader.xml", - "sexpr2xmldata/sexpr2xml-pv-bootloader.sexpr", - 2); -} - -static int testCompareDiskFile(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-file.xml", - "sexpr2xmldata/sexpr2xml-disk-file.sexpr", - 1); -} - -static int testCompareDiskBlock(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-block.xml", - "sexpr2xmldata/sexpr2xml-disk-block.sexpr", - 1); -} - -static int testCompareDiskShareable(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-block-shareable.xml", - "sexpr2xmldata/sexpr2xml-disk-block-shareable.sexpr", - 1); -} - -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(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(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-curmem.xml", - "sexpr2xmldata/sexpr2xml-curmem.sexpr", - 1); -} - - -static int testCompareNetRouted(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-net-routed.xml", - "sexpr2xmldata/sexpr2xml-net-routed.sexpr", - 1); -} - -static int testCompareNetBridged(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-net-bridged.xml", - "sexpr2xmldata/sexpr2xml-net-bridged.sexpr", - 1); -} - -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 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(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-localtime.xml", - "sexpr2xmldata/sexpr2xml-fv-localtime.sexpr", - 1); -} - -static int testCompareFVKernel(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-kernel.xml", - "sexpr2xmldata/sexpr2xml-fv-kernel.sexpr", - 1); -} - -static int testCompareFVLegacyVFB(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml", - "sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr", - 4); +struct testInfo { + const char *input; + const char *output; + int version; +}; + +static int testCompareHelper(const void *data) { + const struct testInfo *info = data; + char xml[PATH_MAX]; + char args[PATH_MAX]; + snprintf(xml, PATH_MAX, "%s/sexpr2xmldata/sexpr2xml-%s.xml", + abs_srcdir, info->input); + snprintf(args, PATH_MAX, "%s/sexpr2xmldata/sexpr2xml-%s.sexpr", + abs_srcdir, info->output); + return testCompareFiles(xml, args, info->version); } @@ -195,6 +73,7 @@ int main(int argc, char **argv) { int ret = 0; + char cwd[PATH_MAX]; progname = argv[0]; @@ -203,98 +82,58 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } - abs_top_srcdir = getenv("abs_top_srcdir"); - if (!abs_top_srcdir) { - fprintf(stderr, "missing enviroment variable abs_top_srcdir\n"); + abs_srcdir = getenv("abs_srcdir"); + if (!abs_srcdir) + abs_srcdir = getcwd(cwd, sizeof(cwd)); + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); exit(EXIT_FAILURE); } - if (virtTestRun("SEXPR-2-XML PV config (version 1)", - 1, testComparePVversion1, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML FV config (version 1)", - 1, testCompareFVversion1, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML PV config (version 2)", - 1, testComparePVversion2, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML PV config (Orig VFB)", - 1, testComparePVOrigVFB, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML PV config (New VFB)", - 1, testComparePVNewVFB, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML FV config (version 2)", - 1, testCompareFVversion2, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML PV config bootloader", - 1, testComparePVBootloader, NULL) != 0) - 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 Block shareable", - 1, testCompareDiskShareable, 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; - - if (virtTestRun("SEXPR-2-XML Resized memory config", - 1, testCompareResizedMemory, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML net routed", - 1, testCompareNetRouted, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML net bridged", - 1, testCompareNetBridged, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML no source CDRom", - 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; - - if (virtTestRun("SEXPR-2-XML clock Localtime", - 1, testCompareFVclockLocaltime, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML FV kernel", - 1, testCompareFVKernel, NULL) != 0) - ret = -1; - - if (virtTestRun("SEXPR-2-XML FV legacy VFB", - 1, testCompareFVLegacyVFB, NULL) != 0) - ret = -1; +#define DO_TEST(in, out, version) \ + do { \ + struct testInfo info = { in, out, version }; \ + if (virtTestRun("Xen SEXPR-2-XML " in " -> " out, \ + 1, testCompareHelper, &info) < 0) \ + ret = -1; \ + } while (0) + + DO_TEST("pv", "pv", 1); + DO_TEST("fv", "fv", 1); + DO_TEST("pv", "pv", 2); + DO_TEST("fv-v2", "fv-v2", 2); + DO_TEST("pv-vfb-orig", "pv-vfb-orig", 2); + DO_TEST("pv-vfb-new", "pv-vfb-new", 3); + DO_TEST("pv-bootloader", "pv-bootloader", 1); + + DO_TEST("disk-file", "disk-file", 2); + DO_TEST("disk-block", "disk-block", 2); + DO_TEST("disk-block-shareable", "disk-block-shareable", 2); + DO_TEST("disk-drv-blktap-raw", "disk-drv-blktap-raw", 2); + DO_TEST("disk-drv-blktap-qcow", "disk-drv-blktap-qcow", 2); + + DO_TEST("curmem", "curmem", 1); + DO_TEST("net-routed", "net-routed", 2); + DO_TEST("net-bridged", "net-bridged", 2); + DO_TEST("no-source-cdrom", "no-source-cdrom", 1); + + DO_TEST("fv-utc", "fv-utc", 1); + DO_TEST("fv-localtime", "fv-localtime", 1); + DO_TEST("fv-usbmouse", "fv-usbmouse", 1); + DO_TEST("fv-usbmouse", "fv-usbmouse", 1); + DO_TEST("fv-kernel", "fv-kernel", 1); + + DO_TEST("fv-serial-null", "fv-serial-null", 1); + DO_TEST("fv-serial-file", "fv-serial-file", 1); + DO_TEST("fv-serial-stdio", "fv-serial-stdio", 1); + DO_TEST("fv-serial-pty", "fv-serial-pty", 1); + DO_TEST("fv-serial-pipe", "fv-serial-pipe", 1); + DO_TEST("fv-serial-tcp", "fv-serial-tcp", 1); + DO_TEST("fv-serial-udp", "fv-serial-udp", 1); + DO_TEST("fv-serial-tcp-telnet", "fv-serial-tcp-telnet", 1); + DO_TEST("fv-serial-unix", "fv-serial-unix", 1); + DO_TEST("fv-parallel-tcp", "fv-parallel-tcp", 1); exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); } Index: tests/xmconfigtest.c =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigtest.c,v retrieving revision 1.14 diff -u -p -r1.14 xmconfigtest.c --- tests/xmconfigtest.c 18 Apr 2008 15:28:33 -0000 1.14 +++ tests/xmconfigtest.c 18 Apr 2008 20:01:37 -0000 @@ -128,11 +128,8 @@ static int testCompareFormatXML(const ch if (!(gotxml = xenXMDomainFormatXML(conn, conf))) goto fail; - if (strcmp(xmlData, gotxml)) { - if (getenv("DEBUG_TESTS")) { - printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData); - printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml); - } + if (STRNEQ(xmlData, gotxml)) { + virtTestDifference(stderr, xmlData, gotxml); goto fail; } @@ -211,6 +208,17 @@ main(int argc, char **argv) DO_TEST("fullvirt-localtime", 2); DO_TEST("fullvirt-usbtablet", 2); DO_TEST("fullvirt-usbmouse", 2); + DO_TEST("fullvirt-serial-file", 2); + DO_TEST("fullvirt-serial-null", 2); + DO_TEST("fullvirt-serial-pipe", 2); + DO_TEST("fullvirt-serial-pty", 2); + DO_TEST("fullvirt-serial-stdio", 2); + DO_TEST("fullvirt-serial-tcp", 2); + DO_TEST("fullvirt-serial-tcp-telnet", 2); + DO_TEST("fullvirt-serial-udp", 2); + DO_TEST("fullvirt-serial-unix", 2); + + DO_TEST("fullvirt-parallel-tcp", 2); exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); } Index: tests/xml2sexprtest.c =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v retrieving revision 1.24 diff -u -p -r1.24 xml2sexprtest.c --- tests/xml2sexprtest.c 10 Apr 2008 16:54:54 -0000 1.24 +++ tests/xml2sexprtest.c 18 Apr 2008 20:01:37 -0000 @@ -6,6 +6,7 @@ #include <string.h> #include <sys/types.h> #include <fcntl.h> +#include <unistd.h> #if WITH_XEN @@ -14,11 +15,11 @@ #include "testutils.h" static char *progname; -static char *abs_top_srcdir; +static char *abs_srcdir; #define MAX_FILE 4096 -static int testCompareFiles(const char *xml_rel, const char *sexpr_rel, +static int testCompareFiles(const char *xml, const char *sexpr, const char *name, int xendConfigVersion) { char xmlData[MAX_FILE]; char sexprData[MAX_FILE]; @@ -27,11 +28,6 @@ static int testCompareFiles(const char * char *xmlPtr = &(xmlData[0]); char *sexprPtr = &(sexprData[0]); int ret = -1; - char xml[PATH_MAX]; - char sexpr[PATH_MAX]; - - snprintf(xml, sizeof xml - 1, "%s/tests/%s", abs_top_srcdir, xml_rel); - snprintf(sexpr, sizeof sexpr - 1, "%s/tests/%s", abs_top_srcdir, sexpr_rel); if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) goto fail; @@ -42,11 +38,8 @@ static int testCompareFiles(const char * 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 (STRNEQ(sexprData, gotsexpr)) { + virtTestDifference(stderr, sexprData, gotsexpr); goto fail; } @@ -65,302 +58,89 @@ static int testCompareFiles(const char * return ret; } -static int testComparePVversion1(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-pv.xml", - "xml2sexprdata/xml2sexpr-pv.sexpr", - "pvtest", - 1); -} - -static int testCompareFVversion1(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv.xml", - "xml2sexprdata/xml2sexpr-fv.sexpr", - "fvtest", - 1); -} - -static int testComparePVversion2(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-pv.xml", - "xml2sexprdata/xml2sexpr-pv.sexpr", - "pvtest", - 2); -} - -static int testCompareFVversion2(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv.xml", - "xml2sexprdata/xml2sexpr-fv-v2.sexpr", - "fvtest", - 2); -} - -static int testCompareFVversion2VNC(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv-vncunused.xml", - "xml2sexprdata/xml2sexpr-fv-vncunused.sexpr", - "fvtest", - 2); -} - -static int testComparePVOrigVFB(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-pv-vfb-orig.xml", - "xml2sexprdata/xml2sexpr-pv-vfb-orig.sexpr", - "pvtest", - 2); -} - - -static int testComparePVNewVFB(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-pv-vfb-new.xml", - "xml2sexprdata/xml2sexpr-pv-vfb-new.sexpr", - "pvtest", - 3); -} - -static int testComparePVBootloader(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-pv-bootloader.xml", - "xml2sexprdata/xml2sexpr-pv-bootloader.sexpr", - "pvtest", - 1); -} - -static int testCompareDiskFile(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-file.xml", - "xml2sexprdata/xml2sexpr-disk-file.sexpr", - "pvtest", - 2); -} - -static int testCompareDiskBlock(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-block.xml", - "xml2sexprdata/xml2sexpr-disk-block.sexpr", - "pvtest", - 2); -} - -static int testCompareDiskShareable(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-block-shareable.xml", - "xml2sexprdata/xml2sexpr-disk-block-shareable.sexpr", - "pvtest", - 2); -} - -static int testCompareDiskDrvLoop(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-loop.xml", - "xml2sexprdata/xml2sexpr-disk-drv-loop.sexpr", - "pvtest", - 2); +struct testInfo { + const char *input; + const char *output; + const char *name; + int version; +}; + +static int testCompareHelper(const void *data) { + const struct testInfo *info = data; + char xml[PATH_MAX]; + char args[PATH_MAX]; + snprintf(xml, PATH_MAX, "%s/xml2sexprdata/xml2sexpr-%s.xml", + abs_srcdir, info->input); + snprintf(args, PATH_MAX, "%s/xml2sexprdata/xml2sexpr-%s.sexpr", + abs_srcdir, info->output); + return testCompareFiles(xml, args, info->name, info->version); } -static int testCompareDiskDrvBlkback(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blkback.xml", - "xml2sexprdata/xml2sexpr-disk-drv-blkback.sexpr", - "pvtest", - 2); -} - -static int testCompareDiskDrvBlktap(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blktap.xml", - "xml2sexprdata/xml2sexpr-disk-drv-blktap.sexpr", - "pvtest", - 2); -} - -static int testCompareDiskDrvBlktapQcow(const 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(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml", - "xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.sexpr", - "pvtest", - 2); -} - -static int testCompareMemoryResize(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-curmem.xml", - "xml2sexprdata/xml2sexpr-curmem.sexpr", - "rhel5", - 2); -} - -static int testCompareNetRouted(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-net-routed.xml", - "xml2sexprdata/xml2sexpr-net-routed.sexpr", - "pvtest", - 2); -} - -static int testCompareNetBridged(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-net-bridged.xml", - "xml2sexprdata/xml2sexpr-net-bridged.sexpr", - "pvtest", - 2); -} - -static int testCompareNoSourceCDRom(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-no-source-cdrom.xml", - "xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr", - "test", - 2); -} - -static int testCompareFVclockUTC(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv-utc.xml", - "xml2sexprdata/xml2sexpr-fv-utc.sexpr", - "fvtest", - 1); -} - -static int testCompareFVclockLocaltime(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv-localtime.xml", - "xml2sexprdata/xml2sexpr-fv-localtime.sexpr", - "fvtest", - 1); -} - - -static int testCompareFVInputUSBMouse(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv-usbmouse.xml", - "xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr", - "fvtest", - 1); -} - -static int testCompareFVInputUSBTablet(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv-usbtablet.xml", - "xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr", - "fvtest", - 1); -} - -static int testCompareFVKernel(const void *data ATTRIBUTE_UNUSED) { - return testCompareFiles("xml2sexprdata/xml2sexpr-fv-kernel.xml", - "xml2sexprdata/xml2sexpr-fv-kernel.sexpr", - "fvtest", - 1); -} - - int main(int argc, char **argv) { int ret = 0; + char cwd[PATH_MAX]; progname = argv[0]; - abs_top_srcdir = getenv("abs_top_srcdir"); - if (!abs_top_srcdir) { - fprintf(stderr, "missing enviroment variable abs_top_srcdir\n"); - exit(EXIT_FAILURE); - } - + abs_srcdir = getenv("abs_srcdir"); + if (!abs_srcdir) + abs_srcdir = getcwd(cwd, sizeof(cwd)); if (argc > 1) { fprintf(stderr, "Usage: %s\n", progname); exit(EXIT_FAILURE); } - if (virtTestRun("XML-2-SEXPR PV config (format 1)", - 1, testComparePVversion1, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR FV config (format 1)", - 1, testCompareFVversion1, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR PV config (format 2)", - 1, testComparePVversion2, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR FV config (format 2)", - 1, testCompareFVversion2, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR FV config (format 2, VNC unused)", - 1, testCompareFVversion2VNC, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR PV config (Orig VFB)", - 1, testComparePVOrigVFB, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR PV config (New VFB)", - 1, testComparePVNewVFB, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR PV config with bootloader", - 1, testComparePVBootloader, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR Disk File", - 1, testCompareDiskFile, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR Disk Block", - 1, testCompareDiskBlock, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR Disk Shareable", - 1, testCompareDiskShareable, 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; - - if (virtTestRun("XML-2-SEXPR Memory Resize", - 1, testCompareMemoryResize, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR Net Routed", - 1, testCompareNetRouted, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR Net Bridged", - 1, testCompareNetBridged, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR No Source CDRom", - 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; - - if (virtTestRun("XML-2-SEXPR clock Localtime", - 1, testCompareFVclockLocaltime, NULL) != 0) - ret = -1; - - if (virtTestRun("XML-2-SEXPR FV kernel", - 1, testCompareFVKernel, NULL) != 0) - ret = -1; +#define DO_TEST(in, out, name, version) \ + do { \ + struct testInfo info = { in, out, name, version }; \ + if (virtTestRun("Xen XML-2-SEXPR " in " -> " out, \ + 1, testCompareHelper, &info) < 0) \ + ret = -1; \ + } while (0) + + DO_TEST("pv", "pv", "pvtest", 1); + DO_TEST("fv", "fv", "fvtest", 1); + DO_TEST("pv", "pv", "pvtest", 2); + DO_TEST("fv", "fv-v2", "fvtest", 2); + DO_TEST("fv-vncunused", "fv-vncunused", "fvtest", 2); + DO_TEST("pv-vfb-orig", "pv-vfb-orig", "pvtest", 2); + DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3); + DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1); + + DO_TEST("disk-file", "disk-file", "pvtest", 2); + DO_TEST("disk-block", "disk-block", "pvtest", 2); + DO_TEST("disk-block-shareable", "disk-block-shareable", "pvtest", 2); + DO_TEST("disk-drv-loop", "disk-drv-loop", "pvtest", 2); + DO_TEST("disk-drv-blkback", "disk-drv-blkback", "pvtest", 2); + DO_TEST("disk-drv-blktap", "disk-drv-blktap", "pvtest", 2); + DO_TEST("disk-drv-blktap-raw", "disk-drv-blktap-raw", "pvtest", 2); + DO_TEST("disk-drv-blktap-qcow", "disk-drv-blktap-qcow", "pvtest", 2); + + DO_TEST("curmem", "curmem", "rhel5", 2); + DO_TEST("net-routed", "net-routed", "pvtest", 2); + DO_TEST("net-bridged", "net-bridged", "pvtest", 2); + DO_TEST("no-source-cdrom", "no-source-cdrom", "test", 2); + + DO_TEST("fv-utc", "fv-utc", "fvtest", 1); + DO_TEST("fv-localtime", "fv-localtime", "fvtest", 1); + DO_TEST("fv-usbmouse", "fv-usbmouse", "fvtest", 1); + DO_TEST("fv-usbmouse", "fv-usbmouse", "fvtest", 1); + DO_TEST("fv-kernel", "fv-kernel", "fvtest", 1); + + DO_TEST("fv-serial-null", "fv-serial-null", "fvtest", 1); + DO_TEST("fv-serial-file", "fv-serial-file", "fvtest", 1); + DO_TEST("fv-serial-stdio", "fv-serial-stdio", "fvtest", 1); + DO_TEST("fv-serial-pty", "fv-serial-pty", "fvtest", 1); + DO_TEST("fv-serial-pipe", "fv-serial-pipe", "fvtest", 1); + DO_TEST("fv-serial-tcp", "fv-serial-tcp", "fvtest", 1); + DO_TEST("fv-serial-udp", "fv-serial-udp", "fvtest", 1); + DO_TEST("fv-serial-tcp-telnet", "fv-serial-tcp-telnet", "fvtest", 1); + DO_TEST("fv-serial-unix", "fv-serial-unix", "fvtest", 1); + DO_TEST("fv-parallel-tcp", "fv-parallel-tcp", "fvtest", 1); exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); } Index: tests/sexpr2xmldata/sexpr2xml-curmem.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-curmem.xml,v retrieving revision 1.4 diff -u -p -r1.4 sexpr2xml-curmem.xml --- tests/sexpr2xmldata/sexpr2xml-curmem.xml 21 Aug 2007 08:54:07 -0000 1.4 +++ tests/sexpr2xmldata/sexpr2xml-curmem.xml 18 Apr 2008 20:01:37 -0000 @@ -28,5 +28,8 @@ </disk> <input type='mouse' bus='xen'/> <graphics type='vnc' port='5905'/> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml,v retrieving revision 1.1 diff -u -p -r1.1 sexpr2xml-disk-block-shareable.xml --- tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml 20 Nov 2007 10:05:45 -0000 1.1 +++ tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml 18 Apr 2008 20:01:37 -0000 @@ -21,5 +21,8 @@ <mac address='00:16:3e:23:9e:eb'/> <script path='vif-bridge'/> </interface> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-disk-block.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-disk-block.xml,v retrieving revision 1.2 diff -u -p -r1.2 sexpr2xml-disk-block.xml --- tests/sexpr2xmldata/sexpr2xml-disk-block.xml 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/sexpr2xmldata/sexpr2xml-disk-block.xml 18 Apr 2008 20:01:37 -0000 @@ -18,5 +18,8 @@ <source dev='/dev/MainVG/GuestVG'/> <target dev='xvda'/> </disk> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml,v retrieving revision 1.2 diff -u -p -r1.2 sexpr2xml-disk-drv-blktap-qcow.xml --- tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml 18 Apr 2008 20:01:37 -0000 @@ -18,5 +18,8 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml,v retrieving revision 1.2 diff -u -p -r1.2 sexpr2xml-disk-drv-blktap-raw.xml --- tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml 18 Apr 2008 20:01:37 -0000 @@ -18,5 +18,8 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-disk-file.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-disk-file.xml,v retrieving revision 1.2 diff -u -p -r1.2 sexpr2xml-disk-file.xml --- tests/sexpr2xmldata/sexpr2xml-disk-file.xml 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/sexpr2xmldata/sexpr2xml-disk-file.xml 18 Apr 2008 20:01:37 -0000 @@ -18,5 +18,8 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml,v retrieving revision 1.1 diff -u -p -r1.1 sexpr2xml-fv-kernel.xml --- tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml 5 Feb 2008 16:21:25 -0000 1.1 +++ tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml 18 Apr 2008 20:01:37 -0000 @@ -22,5 +22,11 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel tcp:localhost:9999)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,44 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <parallel type='tcp'> + <source mode='connect' host='localhost' service='9999' wiremode='raw'/> + <target port='0'/> + </parallel> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-file.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-file.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-file.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-file.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial file:/tmp/serial.log)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,48 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </serial> + <console type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-null.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-null.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-null.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-null.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial null)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,46 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='null'> + <target port='0'/> + </serial> + <console type='null'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial pipe:/tmp/serial.pipe)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,48 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='pipe'> + <source path='/tmp/serial.pipe'/> + <target port='0'/> + </serial> + <console type='pipe'> + <source path='/tmp/serial.pipe'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial pty)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,46 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial stdio)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,46 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='stdio'> + <target port='0'/> + </serial> + <console type='stdio'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial telnet:localhost:9999,listen)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,48 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='tcp'> + <source mode='bind' host='localhost' service='9999' wiremode='telnet'/> + <target port='0'/> + </serial> + <console type='tcp'> + <source mode='bind' host='localhost' service='9999' wiremode='telnet'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial tcp:localhost:9999,listen)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1,48 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='tcp'> + <source mode='bind' host='localhost' service='9999' wiremode='raw'/> + <target port='0'/> + </serial> + <console type='tcp'> + <source mode='bind' host='localhost' service='9999' wiremode='raw'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.sexpr 18 Apr 2008 20:01:37 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial udp:localhost:9998@localhost:9999)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,50 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='udp'> + <source mode='connect' host='localhost' service='9998'/> + <source mode='bind' host='localhost' service='9999'/> + <target port='0'/> + </serial> + <console type='udp'> + <source mode='connect' host='localhost' service='9998'/> + <source mode='bind' host='localhost' service='9999'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.sexpr =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.sexpr diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.sexpr 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1 @@ +(domain (domid 1)(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial unix:/tmp/serial.sock,listen)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml =================================================================== RCS file: tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml diff -N tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,48 @@ +<domain type='xen' id='1'> + <name>fvtest</name> + <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</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'/> + <target dev='vif1.0'/> + <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='ps2'/> + <graphics type='vnc' port='5901'/> + <serial type='unix'> + <source mode='bind' path='/tmp/serial.sock'/> + <target port='0'/> + </serial> + <console type='unix'> + <source mode='bind' path='/tmp/serial.sock'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/sexpr2xmldata/sexpr2xml-net-bridged.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml,v retrieving revision 1.3 diff -u -p -r1.3 sexpr2xml-net-bridged.xml --- tests/sexpr2xmldata/sexpr2xml-net-bridged.xml 21 Aug 2007 08:54:07 -0000 1.3 +++ tests/sexpr2xmldata/sexpr2xml-net-bridged.xml 18 Apr 2008 20:01:38 -0000 @@ -24,5 +24,8 @@ <mac address='00:11:22:33:44:55'/> <script path='vif-bridge'/> </interface> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-net-routed.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-net-routed.xml,v retrieving revision 1.3 diff -u -p -r1.3 sexpr2xml-net-routed.xml --- tests/sexpr2xmldata/sexpr2xml-net-routed.xml 21 Aug 2007 08:54:07 -0000 1.3 +++ tests/sexpr2xmldata/sexpr2xml-net-routed.xml 18 Apr 2008 20:01:38 -0000 @@ -24,5 +24,8 @@ <ip address='172.14.5.6'/> <script path='vif-routed'/> </interface> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml,v retrieving revision 1.8 diff -u -p -r1.8 sexpr2xml-no-source-cdrom.xml --- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml 30 Sep 2007 15:36:47 -0000 1.8 +++ tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml 18 Apr 2008 20:01:38 -0000 @@ -36,5 +36,11 @@ </disk> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5906'/> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml,v retrieving revision 1.2 diff -u -p -r1.2 sexpr2xml-pv-bootloader.xml --- tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml 18 Apr 2008 20:01:38 -0000 @@ -14,5 +14,8 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml,v retrieving revision 1.5 diff -u -p -r1.5 sexpr2xml-pv-vfb-new.xml --- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml 9 Aug 2007 20:19:12 -0000 1.5 +++ tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml 18 Apr 2008 20:01:38 -0000 @@ -20,5 +20,8 @@ </disk> <input type='mouse' bus='xen'/> <graphics type='vnc' port='-1' listen='0.0.0.0' keymap='ja'/> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml,v retrieving revision 1.5 diff -u -p -r1.5 sexpr2xml-pv-vfb-orig.xml --- tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml 9 Aug 2007 20:19:12 -0000 1.5 +++ tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml 18 Apr 2008 20:01:38 -0000 @@ -20,5 +20,8 @@ </disk> <input type='mouse' bus='xen'/> <graphics type='vnc' port='-1' listen='0.0.0.0' keymap='ja'/> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/sexpr2xmldata/sexpr2xml-pv.xml =================================================================== RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-pv.xml,v retrieving revision 1.3 diff -u -p -r1.3 sexpr2xml-pv.xml --- tests/sexpr2xmldata/sexpr2xml-pv.xml 9 Aug 2007 20:19:12 -0000 1.3 +++ tests/sexpr2xmldata/sexpr2xml-pv.xml 18 Apr 2008 20:01:38 -0000 @@ -18,5 +18,8 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/xmconfigdata/test-fullvirt-localtime.cfg =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-localtime.cfg,v retrieving revision 1.2 diff -u -p -r1.2 test-fullvirt-localtime.cfg --- tests/xmconfigdata/test-fullvirt-localtime.cfg 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/xmconfigdata/test-fullvirt-localtime.cfg 18 Apr 2008 20:01:38 -0000 @@ -21,3 +21,5 @@ 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" ] +parallel = "none" +serial = "none" Index: tests/xmconfigdata/test-fullvirt-new-cdrom.cfg =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-new-cdrom.cfg,v retrieving revision 1.4 diff -u -p -r1.4 test-fullvirt-new-cdrom.cfg --- tests/xmconfigdata/test-fullvirt-new-cdrom.cfg 9 Aug 2007 20:19:12 -0000 1.4 +++ tests/xmconfigdata/test-fullvirt-new-cdrom.cfg 18 Apr 2008 20:01:38 -0000 @@ -21,3 +21,5 @@ 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" ] +parallel = "none" +serial = "none" Index: tests/xmconfigdata/test-fullvirt-old-cdrom.cfg =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-old-cdrom.cfg,v retrieving revision 1.4 diff -u -p -r1.4 test-fullvirt-old-cdrom.cfg --- tests/xmconfigdata/test-fullvirt-old-cdrom.cfg 9 Aug 2007 20:19:12 -0000 1.4 +++ tests/xmconfigdata/test-fullvirt-old-cdrom.cfg 18 Apr 2008 20:01:38 -0000 @@ -22,3 +22,5 @@ vnclisten = "127.0.0.1" vncpasswd = "123poi" disk = [ "phy:/dev/HostVG/XenGuest2,ioemu:hda,w" ] vif = [ "mac=00:16:3E:66:92:9C,bridge=xenbr0,type=ioemu" ] +parallel = "none" +serial = "none" Index: tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg diff -N tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "tcp:127.0.0.1:7777" +serial = "none" Index: tests/xmconfigdata/test-fullvirt-parallel-tcp.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-parallel-tcp.xml diff -N tests/xmconfigdata/test-fullvirt-parallel-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-parallel-tcp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,45 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <parallel type='tcp'> + <source mode='connect' host='127.0.0.1' service='7777' wiremode='raw'/> + <target port='0'/> + </parallel> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-file.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-file.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-file.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-file.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "file:/tmp/serial.log" Index: tests/xmconfigdata/test-fullvirt-serial-file.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-file.xml diff -N tests/xmconfigdata/test-fullvirt-serial-file.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-file.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,49 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </serial> + <console type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-null.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-null.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-null.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-null.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "null" Index: tests/xmconfigdata/test-fullvirt-serial-null.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-null.xml diff -N tests/xmconfigdata/test-fullvirt-serial-null.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-null.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,47 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='null'> + <target port='0'/> + </serial> + <console type='null'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-pipe.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-pipe.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-pipe.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-pipe.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "pipe:/tmp/serial.pipe" Index: tests/xmconfigdata/test-fullvirt-serial-pipe.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-pipe.xml diff -N tests/xmconfigdata/test-fullvirt-serial-pipe.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-pipe.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,49 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='pipe'> + <source path='/tmp/serial.pipe'/> + <target port='0'/> + </serial> + <console type='pipe'> + <source path='/tmp/serial.pipe'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-pty.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-pty.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-pty.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-pty.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "pty" Index: tests/xmconfigdata/test-fullvirt-serial-pty.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-pty.xml diff -N tests/xmconfigdata/test-fullvirt-serial-pty.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-pty.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,47 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-stdio.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-stdio.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-stdio.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-stdio.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "stdio" Index: tests/xmconfigdata/test-fullvirt-serial-stdio.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-stdio.xml diff -N tests/xmconfigdata/test-fullvirt-serial-stdio.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-stdio.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,47 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='stdio'> + <target port='0'/> + </serial> + <console type='stdio'> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "telnet:127.0.0.1:9999,listen" Index: tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml diff -N tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,49 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='tcp'> + <source mode='bind' host='127.0.0.1' service='9999' wiremode='telnet'/> + <target port='0'/> + </serial> + <console type='tcp'> + <source mode='bind' host='127.0.0.1' service='9999' wiremode='telnet'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-tcp.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-tcp.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-tcp.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-tcp.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "tcp:127.0.0.1:7777" Index: tests/xmconfigdata/test-fullvirt-serial-tcp.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-tcp.xml diff -N tests/xmconfigdata/test-fullvirt-serial-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-tcp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,49 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='tcp'> + <source mode='connect' host='127.0.0.1' service='7777' wiremode='raw'/> + <target port='0'/> + </serial> + <console type='tcp'> + <source mode='connect' host='127.0.0.1' service='7777' wiremode='raw'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-udp.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-udp.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-udp.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-udp.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "udp:127.0.0.1:9999@0.0.0.0:99998" Index: tests/xmconfigdata/test-fullvirt-serial-udp.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-udp.xml diff -N tests/xmconfigdata/test-fullvirt-serial-udp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-udp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,51 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='udp'> + <source mode='connect' host='127.0.0.1' service='9999'/> + <source mode='bind' host='0.0.0.0' service='99998'/> + <target port='0'/> + </serial> + <console type='udp'> + <source mode='connect' host='127.0.0.1' service='9999'/> + <source mode='bind' host='0.0.0.0' service='99998'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-serial-unix.cfg =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-unix.cfg diff -N tests/xmconfigdata/test-fullvirt-serial-unix.cfg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-unix.cfg 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,25 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +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" +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" ] +parallel = "none" +serial = "unix:/tmp/serial.sock,listen" Index: tests/xmconfigdata/test-fullvirt-serial-unix.xml =================================================================== RCS file: tests/xmconfigdata/test-fullvirt-serial-unix.xml diff -N tests/xmconfigdata/test-fullvirt-serial-unix.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xmconfigdata/test-fullvirt-serial-unix.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,49 @@ +<domain type='xen'> + <name>XenGuest2</name> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</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='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> + <serial type='unix'> + <source mode='bind' path='/tmp/serial.sock'/> + <target port='0'/> + </serial> + <console type='unix'> + <source mode='bind' path='/tmp/serial.sock'/> + <target port='0'/> + </console> + </devices> +</domain> Index: tests/xmconfigdata/test-fullvirt-usbmouse.cfg =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-usbmouse.cfg,v retrieving revision 1.2 diff -u -p -r1.2 test-fullvirt-usbmouse.cfg --- tests/xmconfigdata/test-fullvirt-usbmouse.cfg 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/xmconfigdata/test-fullvirt-usbmouse.cfg 18 Apr 2008 20:01:38 -0000 @@ -22,3 +22,5 @@ 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" ] +parallel = "none" +serial = "none" Index: tests/xmconfigdata/test-fullvirt-usbtablet.cfg =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-usbtablet.cfg,v retrieving revision 1.2 diff -u -p -r1.2 test-fullvirt-usbtablet.cfg --- tests/xmconfigdata/test-fullvirt-usbtablet.cfg 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/xmconfigdata/test-fullvirt-usbtablet.cfg 18 Apr 2008 20:01:38 -0000 @@ -22,3 +22,5 @@ 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" ] +parallel = "none" +serial = "none" Index: tests/xmconfigdata/test-fullvirt-utc.cfg =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-utc.cfg,v retrieving revision 1.2 diff -u -p -r1.2 test-fullvirt-utc.cfg --- tests/xmconfigdata/test-fullvirt-utc.cfg 9 Aug 2007 20:19:12 -0000 1.2 +++ tests/xmconfigdata/test-fullvirt-utc.cfg 18 Apr 2008 20:01:38 -0000 @@ -21,3 +21,5 @@ 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" ] +parallel = "none" +serial = "none" Index: tests/xmconfigdata/test-paravirt-new-pvfb.xml =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-paravirt-new-pvfb.xml,v retrieving revision 1.3 diff -u -p -r1.3 test-paravirt-new-pvfb.xml --- tests/xmconfigdata/test-paravirt-new-pvfb.xml 9 Aug 2007 20:19:12 -0000 1.3 +++ tests/xmconfigdata/test-paravirt-new-pvfb.xml 18 Apr 2008 20:01:38 -0000 @@ -20,6 +20,8 @@ </interface> <input type='mouse' bus='xen'/> <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> - <console/> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/xmconfigdata/test-paravirt-old-pvfb.xml =================================================================== RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-paravirt-old-pvfb.xml,v retrieving revision 1.3 diff -u -p -r1.3 test-paravirt-old-pvfb.xml --- tests/xmconfigdata/test-paravirt-old-pvfb.xml 9 Aug 2007 20:19:12 -0000 1.3 +++ tests/xmconfigdata/test-paravirt-old-pvfb.xml 18 Apr 2008 20:01:38 -0000 @@ -20,6 +20,8 @@ </interface> <input type='mouse' bus='xen'/> <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/> - <console/> + <console type='pty'> + <target port='0'/> + </console> </devices> </domain> Index: tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr,v retrieving revision 1.1 diff -u -p -r1.1 xml2sexpr-fv-kernel.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr 5 Feb 2008 16:21:25 -0000 1.1 +++ tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr 18 Apr 2008 20:01:38 -0000 @@ -1 +1 @@ -(vm (name 'fvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (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_... ')(loader '/usr/lib/xen/boot/hvmloader')(vcpus 2)(boot c)(usb 1)(serial pty)))(device (vbd (dev 'ioemu:xvda')(uname 'file:/root/some.img')(mode 'w')))) \ No newline at end of file +(vm (name 'fvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (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_... ')(loader '/usr/lib/xen/boot/hvmloader')(vcpus 2)(boot c)(usb 1)(parallel none)(serial pty)))(device (vbd (dev 'ioemu:xvda')(uname 'file:/root/some.img')(mode 'w')))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr,v retrieving revision 1.3 diff -u -p -r1.3 xml2sexpr-fv-localtime.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr 5 Feb 2008 16:21:25 -0000 1.3 +++ tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(localtime 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)(localtime 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel tcp:localhost:9999)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,40 @@ +<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> + <parallel type='tcp'> + <source mode='connect' host='localhost' service='9999' wiremode='raw'/> + <target port='0'/> + </parallel> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-file.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-file.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-file.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-file.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial file:/tmp/serial.log)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-file.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-file.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-file.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-file.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,40 @@ +<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> + <serial type='file'> + <source path='/tmp/serial.log'/> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-null.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-null.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-null.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-null.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial null)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-null.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-null.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-null.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-null.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,39 @@ +<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> + <serial type='null'> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial pipe:/tmp/serial.pipe)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,40 @@ +<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> + <serial type='pipe'> + <source path='/tmp/serial.pipe'/> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-pty.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-pty.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-pty.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-pty.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial pty)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-pty.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-pty.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-pty.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-pty.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,39 @@ +<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> + <serial type='pty'> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial stdio)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,39 @@ +<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> + <serial type='stdio'> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial telnet:localhost:9999,listen)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,40 @@ +<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> + <serial type='tcp'> + <source mode='bind' host='localhost' service='9999' wiremode='telnet'/> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial tcp:localhost:9999,listen)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,40 @@ +<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> + <serial type='tcp'> + <source mode='bind' host='localhost' service='9999' wiremode='raw'/> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-udp.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-udp.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-udp.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-udp.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial udp:localhost:9998@localhost:9999)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-udp.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-udp.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-udp.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-udp.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,41 @@ +<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> + <serial type='udp'> + <source mode='connect' host='localhost' service='9998'/> + <source mode='bind' host='localhost' service='9999'/> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-serial-unix.sexpr =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-unix.sexpr diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-unix.sexpr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-unix.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial unix:/tmp/serial.sock,listen)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-serial-unix.xml =================================================================== RCS file: tests/xml2sexprdata/xml2sexpr-fv-serial-unix.xml diff -N tests/xml2sexprdata/xml2sexpr-fv-serial-unix.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/xml2sexprdata/xml2sexpr-fv-serial-unix.xml 18 Apr 2008 20:01:38 -0000 @@ -0,0 +1,40 @@ +<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> + <serial type='unix'> + <source mode='bind' path='/tmp/serial.sock'/> + <target port='0'/> + </serial> + <graphics type='vnc' port='5917' keymap='ja'/> + </devices> +</domain> + Index: tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr,v retrieving revision 1.2 diff -u -p -r1.2 xml2sexpr-fv-usbmouse.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr 5 Feb 2008 16:21:25 -0000 1.2 +++ tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice mouse)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice mouse)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr,v retrieving revision 1.2 diff -u -p -r1.2 xml2sexpr-fv-usbtablet.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr 5 Feb 2008 16:21:25 -0000 1.2 +++ tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice tablet)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice tablet)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr,v retrieving revision 1.3 diff -u -p -r1.3 xml2sexpr-fv-utc.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr 5 Feb 2008 16:21:25 -0000 1.3 +++ tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr,v retrieving revision 1.7 diff -u -p -r1.7 xml2sexpr-fv-v2.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr 5 Feb 2008 16:21:25 -0000 1.7 +++ tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr,v retrieving revision 1.6 diff -u -p -r1.6 xml2sexpr-fv-vncunused.sexpr --- tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr 5 Feb 2008 16:21:25 -0000 1.6 +++ tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-fv.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv.sexpr,v retrieving revision 1.4 diff -u -p -r1.4 xml2sexpr-fv.sexpr --- tests/xml2sexprdata/xml2sexpr-fv.sexpr 5 Feb 2008 16:21:25 -0000 1.4 +++ tests/xml2sexprdata/xml2sexpr-fv.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(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)))) \ No newline at end of file Index: tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr =================================================================== RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr,v retrieving revision 1.3 diff -u -p -r1.3 xml2sexpr-no-source-cdrom.sexpr --- tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr 5 Feb 2008 16:21:25 -0000 1.3 +++ tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr 18 Apr 2008 20:01:38 -0000 @@ -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')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(usb 1)(device_model '/usr/lib/xen/bin/qemu-dm')(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)))) \ No newline at end of file +(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')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib/xen/bin/qemu-dm')(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)))) \ No newline at end of file -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
This patch updates the Xen test suite to cover the new serial and paralle device syntax extensions
Looks good.
sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 44 ++ sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 46 ++ sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 46 ++ sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 46 ++ sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 48 ++ sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 50 ++ sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 48 ++ xmconfigdata/test-fullvirt-parallel-tcp.xml | 45 ++ xmconfigdata/test-fullvirt-serial-file.xml | 49 ++ xmconfigdata/test-fullvirt-serial-null.xml | 47 ++ xmconfigdata/test-fullvirt-serial-pipe.xml | 49 ++ xmconfigdata/test-fullvirt-serial-pty.xml | 47 ++ xmconfigdata/test-fullvirt-serial-stdio.xml | 47 ++ xmconfigdata/test-fullvirt-serial-tcp-telnet.xml | 49 ++ xmconfigdata/test-fullvirt-serial-tcp.xml | 49 ++ xmconfigdata/test-fullvirt-serial-udp.xml | 51 ++ xmconfigdata/test-fullvirt-serial-unix.xml | 49 ++ xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-file.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-null.xml | 39 ++ xml2sexprdata/xml2sexpr-fv-serial-pipe.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-pty.xml | 39 ++ xml2sexprdata/xml2sexpr-fv-serial-stdio.xml | 39 ++ xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-tcp.xml | 40 ++ xml2sexprdata/xml2sexpr-fv-serial-udp.xml | 41 ++ xml2sexprdata/xml2sexpr-fv-serial-unix.xml | 40 ++
I noticed that there's a huge amount of duplication in these new .xml files. Each typically differs in just a single attribute or two from one or more others. Eventually, it'd be good for maintainability to factor out some sort of template(s) and store in version control only the pieces that say how to change a template into the desired expected output file.

On Fri, Apr 18, 2008 at 09:20:40PM +0100, Daniel P. Berrange wrote:
This patch series adds support for serial & parallel devices to the QEMU driver, and updates the Xen driver to support new syntax for HVM guests too.
The following syntax is used. Anywhere you see 'serial', you can equally use 'console' or 'parallel'.
The 'serial' is for real serial devices only, likewise 'parallel' is for parallel port devices only. 'console' tag is for paravirtualized consoles. IF there is no paravirt console, then the first serial device (if any) is also duplicated as a 'console' tag. This provides backwards compatability with existing syntax. [...] This is sufficient flexibility to represent all QEMU character device modes, Xen paravirt console, LXC container fake console and the Solaris LDoms console, and VMWare serial devices.
This series of patches updates the Xen and QEMU drivers, and their test suites. A later patch will also update the LXC driver to this new syntax.
Fine by me, let's push this, feedback may lead to a bit of tweaking of the code but it will be easier to deal with as diff from CVS than on this patchset.
I was going to document this all in the format.html page, but looking at the content there it needs a complete re-write. The split between Xen and QEMU formats is pointless because they share 95% of the their config. Both the Xen and QEMU descriptions are outdated, and the Xen PV vs HVM split is also less than useful since they have much more commmonaility now. I intend to re-write it to describe each element / attribute in turn, and then at the end provide some example configs for each driver.
If we can achieve this then that means we should also be able to maintain the relaxng schemas, ship it with the distribution and even pissibly add a checking rule as part of virsh. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering