[libvirt] PATCH: Support initial boot time CPU affinity mask

The XML format allows for an initial CPU mask to be specified for a guests vCPUs. eg with this XML: <vcpu cpuset='1-4,8-20,525'>1</vcpu> Since we have CPU pinning support from my previous patch, adding in the initial pinning is fairly easy. We first pass the '-S' arg to QEMU when forking it. This causes it to initialize, but not start the CPUs in the guest. We then set the affinity mask for all its CPUs, and then send the 'cont' command to the monitor to start execution. src/qemu_conf.c | 44 +++++++ src/qemu_conf.h | 3 src/qemu_driver.c | 77 +++++++++---- src/xml.c | 5 src/xml.h | 4 tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args | 2 tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args | 2 tests/qemuxml2argvdata/qemuxml2argv-boot-network.args | 2 tests/qemuxml2argvdata/qemuxml2argv-bootloader.args | 2 tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args | 2 tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args | 2 tests/qemuxml2argvdata/qemuxml2argv-console-compat.args | 2 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args | 2 tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args | 2 tests/qemuxml2argvdata/qemuxml2argv-disk-many.args | 2 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args | 2 tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args | 2 tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args | 2 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args | 2 tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args | 2 tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args | 2 tests/qemuxml2argvdata/qemuxml2argv-input-xen.args | 2 tests/qemuxml2argvdata/qemuxml2argv-minimal.args | 2 tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 2 tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args | 2 tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args | 2 tests/qemuxml2argvdata/qemuxml2argv-net-user.args | 2 tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args | 2 tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-file.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-many.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args | 2 tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args | 2 tests/qemuxml2argvdata/qemuxml2argv-sound.args | 2 39 files changed, 140 insertions(+), 61 deletions(-) Dan. diff -r 3bbea433803f src/qemu_conf.c --- a/src/qemu_conf.c Fri May 16 17:39:29 2008 -0400 +++ b/src/qemu_conf.c Fri May 16 17:40:39 2008 -0400 @@ -56,6 +56,7 @@ #include "memory.h" #include "verify.h" #include "c-ctype.h" +#include "xml.h" #define qemudLog(level, msg...) fprintf(stderr, msg) @@ -1743,6 +1744,25 @@ } xmlXPathFreeObject(obj); + /* Extract domain vcpu info */ + obj = xmlXPathEval(BAD_CAST "string(/domain/vcpu[1]/@cpuset)", ctxt); + if ((obj == NULL) || (obj->type != XPATH_STRING) || + (obj->stringval == NULL) || (obj->stringval[0] == 0)) { + /* Allow use on all CPUS */ + memset(def->cpumask, 1, QEMUD_CPUMASK_LEN); + } else { + char *set = (char *)obj->stringval; + memset(def->cpumask, 0, QEMUD_CPUMASK_LEN); + if (virParseCpuSet(conn, (const char **)&set, + 0, def->cpumask, + QEMUD_CPUMASK_LEN) < 0) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed vcpu mask information")); + goto error; + } + } + xmlXPathFreeObject(obj); + /* See if ACPI feature is requested */ obj = xmlXPathEval(BAD_CAST "/domain/features/acpi", ctxt); if ((obj != NULL) && (obj->type == XPATH_NODESET) && @@ -2431,6 +2451,7 @@ disableKQEMU = 1; len = 1 + /* qemu */ + 1 + /* Stopped */ 2 + /* machine type */ disableKQEMU + /* Disable kqemu */ (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME ? 2 : 0) + /* -name XXX */ @@ -2464,6 +2485,8 @@ goto no_memory; if (!((*argv)[++n] = strdup(vm->def->os.binary))) goto no_memory; + if (!((*argv)[++n] = strdup("-S"))) + goto no_memory; if (!((*argv)[++n] = strdup("-M"))) goto no_memory; if (!((*argv)[++n] = strdup(vm->def->os.machine))) @@ -3876,7 +3899,7 @@ const struct qemud_vm_sound_def *sound; const struct qemud_vm_chr_def *chr; const char *type = NULL; - int n; + int n, allones = 1; if (!(type = qemudVirtTypeToString(def->virtType))) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, @@ -3897,7 +3920,24 @@ virBufferVSprintf(&buf, " <memory>%lu</memory>\n", def->maxmem); virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n", def->memory); - virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", def->vcpus); + + for (n = 0 ; n < QEMUD_CPUMASK_LEN ; n++) + if (def->cpumask[n] != 1) + allones = 0; + + if (allones) { + virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", def->vcpus); + } else { + char *cpumask = NULL; + if ((cpumask = virSaveCpuSet(conn, def->cpumask, QEMUD_CPUMASK_LEN)) == NULL) { + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, + "%s", _("allocating cpu mask")); + goto cleanup; + } + virBufferVSprintf(&buf, " <vcpu cpuset='%s'>%d</vcpu>\n", cpumask, def->vcpus); + free(cpumask); + } + if (def->os.bootloader[0]) virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", def->os.bootloader); virBufferAddLit(&buf, " <os>\n"); diff -r 3bbea433803f src/qemu_conf.h --- a/src/qemu_conf.h Fri May 16 17:39:29 2008 -0400 +++ b/src/qemu_conf.h Fri May 16 17:40:39 2008 -0400 @@ -33,6 +33,7 @@ #include "iptables.h" #include "capabilities.h" #include <netinet/in.h> +#include <sched.h> #define qemudDebug(fmt, ...) do {} while(0) @@ -104,6 +105,7 @@ #define QEMUD_MAX_NAME_LEN 50 #define QEMUD_MAX_XML_LEN 4096 #define QEMUD_MAX_ERROR_LEN 1024 +#define QEMUD_CPUMASK_LEN CPU_SETSIZE /* Stores the virtual network interface configuration */ struct qemud_vm_net_def { @@ -282,6 +284,7 @@ unsigned long memory; unsigned long maxmem; int vcpus; + char cpumask[QEMUD_CPUMASK_LEN]; int noReboot; diff -r 3bbea433803f src/qemu_driver.c --- a/src/qemu_driver.c Fri May 16 17:39:29 2008 -0400 +++ b/src/qemu_driver.c Fri May 16 17:40:39 2008 -0400 @@ -713,6 +713,50 @@ return 0; } +static int +qemudInitCpus(virConnectPtr conn, + struct qemud_driver *driver, + struct qemud_vm *vm) { + char *info = NULL; + cpu_set_t mask; + int i, maxcpu = QEMUD_CPUMASK_LEN; + virNodeInfo nodeinfo; + + if (virNodeInfoPopulate(conn, &nodeinfo) < 0) + return -1; + + /* setaffinity fails if you set bits for CPUs which + * aren't present, so we have to limit ourselves */ + if (maxcpu > nodeinfo.cpus) + maxcpu = nodeinfo.cpus; + + CPU_ZERO(&mask); + for (i = 0 ; i < maxcpu ; i++) + if (vm->def->cpumask[i]) + CPU_SET(i, &mask); + + for (i = 0 ; i < vm->nvcpupids ; i++) { + if (sched_setaffinity(vm->vcpupids[i], + sizeof(mask), &mask) < 0) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + _("failed to set CPU affinity %s"), + strerror(errno)); + return -1; + } + } + + /* Allow the CPUS to start executing */ + if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("resume operation failed")); + return -1; + } + free(info); + + return 0; +} + + static int qemudNextFreeVNCPort(struct qemud_driver *driver ATTRIBUTE_UNUSED) { int i; @@ -870,28 +914,17 @@ } if (ret == 0) { - if (virEventAddHandle(vm->stdout, - POLLIN | POLLERR | POLLHUP, - qemudDispatchVMEvent, - driver) < 0) { - qemudShutdownVMDaemon(conn, driver, vm); - return -1; - } - - if (virEventAddHandle(vm->stderr, - POLLIN | POLLERR | POLLHUP, - qemudDispatchVMEvent, - driver) < 0) { - qemudShutdownVMDaemon(conn, driver, vm); - return -1; - } - - if (qemudWaitForMonitor(conn, driver, vm) < 0) { - qemudShutdownVMDaemon(conn, driver, vm); - return -1; - } - - if (qemudDetectVcpuPIDs(conn, driver, vm) < 0) { + if ((virEventAddHandle(vm->stdout, + POLLIN | POLLERR | POLLHUP, + qemudDispatchVMEvent, + driver) < 0) || + (virEventAddHandle(vm->stderr, + POLLIN | POLLERR | POLLHUP, + qemudDispatchVMEvent, + driver) < 0) || + (qemudWaitForMonitor(conn, driver, vm) < 0) || + (qemudDetectVcpuPIDs(conn, driver, vm) < 0) || + (qemudInitCpus(conn, driver, vm) < 0)) { qemudShutdownVMDaemon(conn, driver, vm); return -1; } diff -r 3bbea433803f src/xml.c --- a/src/xml.c Fri May 16 17:39:29 2008 -0400 +++ b/src/xml.c Fri May 16 17:40:39 2008 -0400 @@ -60,7 +60,7 @@ * Parser and converter for the CPUset strings used in libvirt * * * ************************************************************************/ -#if WITH_XEN +#if WITH_XEN || WITH_QEMU /** * parseCpuNumber: * @str: pointer to the char pointer used @@ -249,8 +249,9 @@ _("topology cpuset syntax error"), 0); return (-1); } +#endif - +#if WITH_XEN /** * virConvertCpuSet: * @conn: connection diff -r 3bbea433803f src/xml.h --- a/src/xml.h Fri May 16 17:39:29 2008 -0400 +++ b/src/xml.h Fri May 16 17:40:39 2008 -0400 @@ -32,7 +32,7 @@ xmlXPathContextPtr ctxt, xmlNodePtr **list); -#if WITH_XEN +#if WITH_XEN || WITH_QEMU int virParseCpuSet (virConnectPtr conn, const char **str, char sep, @@ -41,6 +41,8 @@ char * virSaveCpuSet (virConnectPtr conn, char *cpuset, int maxcpu); +#endif +#if WITH_XEN char * virConvertCpuSet(virConnectPtr conn, const char *str, int maxcpu); diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args --- a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args --- a/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-boot-network.args --- a/tests/qemuxml2argvdata/qemuxml2argv-boot-network.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-network.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-bootloader.args --- a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/usr/bin/qemu-kvm -M xenner -m 214 -smp 1 -nographic -monitor pty -no-acpi -bootloader /usr/bin/pygrub -cdrom /dev/cdrom -net none -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu-kvm -S -M xenner -m 214 -smp 1 -nographic -monitor pty -no-acpi -bootloader /usr/bin/pygrub -cdrom /dev/cdrom -net none -serial none -parallel none -usb \ No newline at end of file diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args --- a/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args --- a/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-console-compat.args --- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-many.args --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-many.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-many.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=virtio,index=0 -drive file=/tmp/logs.img,if=virtio,index=6 -net none -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=virtio,index=0 -drive file=/tmp/logs.img,if=virtio,index=6 -net none -serial none -parallel none -usb \ No newline at end of file diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=xen,index=0 -drive file=/tmp/logs.img,if=xen,index=6 -net none -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=xen,index=0 -drive file=/tmp/logs.img,if=xen,index=6 -net none -serial none -parallel none -usb \ No newline at end of file diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args --- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 none -usb -usbdevice mouse \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args --- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 none -usb -usbdevice tablet \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-input-xen.args --- a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/usr/bin/xenner -M xenner -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc :-5901 \ No newline at end of file +/usr/bin/xenner -S -M xenner -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc :-5901 \ No newline at end of file diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-minimal.args --- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/usr/bin/qemu -M pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -M pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb \ No newline at end of file diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-minimal.xml --- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml Fri May 16 17:40:39 2008 -0400 @@ -3,7 +3,7 @@ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory>219200</memory> <currentMemory>219200</currentMemory> - <vcpu>1</vcpu> + <vcpu cpuset='1-4,8-20,525'>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> <boot dev='hd'/> diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args --- a/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,1 @@ -/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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args --- a/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-net-user.args --- a/tests/qemuxml2argvdata/qemuxml2argv-net-user.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-user.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args --- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +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,model=virtio -net user,vlan=0 -serial none -parallel none -usb \ No newline at end of file +/usr/bin/qemu -S -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,model=virtio -net user,vlan=0 -serial none -parallel none -usb \ No newline at end of file diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args --- a/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-file.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-many.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-many.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-many.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 +/usr/bin/qemu -S -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 diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-sound.args --- a/tests/qemuxml2argvdata/qemuxml2argv-sound.args Fri May 16 17:39:29 2008 -0400 +++ b/tests/qemuxml2argvdata/qemuxml2argv-sound.args Fri May 16 17:40:39 2008 -0400 @@ -1,1 +1,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 none -usb -soundhw pcspk,es1370,sb16 \ No newline at end of file +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -soundhw pcspk,es1370,sb16 \ 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 :|

On Fri, 16 May 2008, Daniel P. Berrange wrote:
The XML format allows for an initial CPU mask to be specified for a guests vCPUs. eg with this XML:
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
Since we have CPU pinning support from my previous patch, adding in the initial pinning is fairly easy. We first pass the '-S' arg to QEMU when forking it. This causes it to initialize, but not start the CPUs in the guest. We then set the affinity mask for all its CPUs, and then send the 'cont' command to the monitor to start execution.
Does this include Xen support? Stefan

Stefan de Konink wrote:
On Fri, 16 May 2008, Daniel P. Berrange wrote:
The XML format allows for an initial CPU mask to be specified for a guests vCPUs. eg with this XML:
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
Since we have CPU pinning support from my previous patch, adding in the initial pinning is fairly easy. We first pass the '-S' arg to QEMU when forking it. This causes it to initialize, but not start the CPUs in the guest. We then set the affinity mask for all its CPUs, and then send the 'cont' command to the monitor to start execution.
Does this include Xen support?
Stefan
cpu pinning is already support for xen. - Cole

Daniel P. Berrange wrote:
Since we have CPU pinning support from my previous patch, adding in the initial pinning is fairly easy. We first pass the '-S' arg to QEMU when forking it.
If -S is always added, this becomes unnecessary (qemu_conf.c:2823): if (vm->migrateFrom[0]) { if (!((*argv)[++n] = strdup("-S"))) goto no_memory; -jim

On Fri, May 16, 2008 at 10:50:20PM +0100, Daniel P. Berrange wrote:
The XML format allows for an initial CPU mask to be specified for a guests vCPUs. eg with this XML:
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
what about output. In the xen case we went though the exercise to dump a cpuset string back only if it wasn't 'all set'.
Since we have CPU pinning support from my previous patch, adding in the initial pinning is fairly easy. We first pass the '-S' arg to QEMU when forking it. This causes it to initialize, but not start the CPUs in the guest. We then set the affinity mask for all its CPUs, and then send the 'cont' command to the monitor to start execution. [...] + /* Extract domain vcpu info */ + obj = xmlXPathEval(BAD_CAST "string(/domain/vcpu[1]/@cpuset)", ctxt); + if ((obj == NULL) || (obj->type != XPATH_STRING) || + (obj->stringval == NULL) || (obj->stringval[0] == 0)) { + /* Allow use on all CPUS */ + memset(def->cpumask, 1, QEMUD_CPUMASK_LEN); + } else { + char *set = (char *)obj->stringval; + memset(def->cpumask, 0, QEMUD_CPUMASK_LEN); + if (virParseCpuSet(conn, (const char **)&set, + 0, def->cpumask, + QEMUD_CPUMASK_LEN) < 0) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed vcpu mask information")); + goto error; + } + } + xmlXPathFreeObject(obj);
virXPathString() would make it way cleaner IMHO [...]
virBufferVSprintf(&buf, " <memory>%lu</memory>\n", def->maxmem); virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n", def->memory); - virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", def->vcpus); + + for (n = 0 ; n < QEMUD_CPUMASK_LEN ; n++) + if (def->cpumask[n] != 1) + allones = 0; + + if (allones) { + virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", def->vcpus);
okay that answers my question :-) Patch looks fine. Since we have migration nearly ready, it would be interesting to check the combination of both at some point too, Looks fine to me, +1, 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 Wed, May 21, 2008 at 11:33:33AM -0400, Daniel Veillard wrote:
On Fri, May 16, 2008 at 10:50:20PM +0100, Daniel P. Berrange wrote:
+ /* Extract domain vcpu info */ + obj = xmlXPathEval(BAD_CAST "string(/domain/vcpu[1]/@cpuset)", ctxt); + if ((obj == NULL) || (obj->type != XPATH_STRING) || + (obj->stringval == NULL) || (obj->stringval[0] == 0)) { + /* Allow use on all CPUS */ + memset(def->cpumask, 1, QEMUD_CPUMASK_LEN); + } else { + char *set = (char *)obj->stringval; + memset(def->cpumask, 0, QEMUD_CPUMASK_LEN); + if (virParseCpuSet(conn, (const char **)&set, + 0, def->cpumask, + QEMUD_CPUMASK_LEN) < 0) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed vcpu mask information")); + goto error; + } + } + xmlXPathFreeObject(obj);
virXPathString() would make it way cleaner IMHO
It definitely would - this entire funciton uses the old style direct API calls and needs switching over.
Patch looks fine. Since we have migration nearly ready, it would be interesting to check the combination of both at some point too,
Looks fine to me, +1,
Thanks, I've committed this patch, including the bug Jim pointed out about the unneccessary -S arg when using migrateFrom args 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 :|
participants (5)
-
Cole Robinson
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Paris
-
Stefan de Konink