[libvirt] PATCH: Clean up QEMU driver argv builder
by Daniel P. Berrange
Daniel pointed out that the way we build up the QEMU argv strnig is becoming
rather unscalable / error prone. This patch refactors it into to use a short
macro to do memory allocation/reallocation, which clears it up quite nicely
qemu_conf.c | 293 +++++++++++++++++++++++-------------------------------------
1 file changed, 116 insertions(+), 177 deletions(-)
Regards,
Daniel
diff -r 7c1231eebae9 src/qemu_conf.c
--- a/src/qemu_conf.c Thu May 22 12:31:13 2008 -0400
+++ b/src/qemu_conf.c Thu May 22 12:31:46 2008 -0400
@@ -2411,8 +2419,8 @@
int qemudBuildCommandLine(virConnectPtr conn,
struct qemud_driver *driver,
struct qemud_vm *vm,
- char ***argv) {
- int len, n = -1, i;
+ char ***retargv) {
+ int i;
char memory[50];
char vcpus[50];
char boot[QEMUD_MAX_BOOT_DEVS+1];
@@ -2424,6 +2432,8 @@
struct qemud_vm_chr_def *parallel = vm->def->parallels;
struct utsname ut;
int disableKQEMU = 0;
+ int qargc = 0, qarga = 0;
+ char **qargv = NULL;
if (vm->qemuVersion == 0) {
if (qemudExtractVersionInfo(vm->def->os.binary,
@@ -2451,65 +2461,46 @@
vm->def->virtType == QEMUD_VIRT_QEMU)
disableKQEMU = 1;
- len = 1 + /* qemu */
- 1 + /* Stopped */
- 2 + /* machine type */
- disableKQEMU + /* Disable kqemu */
- (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME ? 2 : 0) + /* -name XXX */
- 2 * vm->def->ndisks + /* disks*/
- (vm->def->nnets > 0 ? (4 * vm->def->nnets) : 2) + /* networks */
- 1 + /* usb */
- 2 * vm->def->ninputs + /* input devices */
- ((vm->def->nsounds > 0) ? 2 : 0) + /* sound */
- (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 */
- 2 + /* monitor */
- (vm->def->localtime ? 1 : 0) + /* localtime */
- (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
- vm->def->noReboot ? 1 : 0) + /* no-reboot */
- (vm->def->features & QEMUD_FEATURE_ACPI ? 0 : 1) + /* acpi */
- (vm->def->os.kernel[0] ? 2 : 0) + /* kernel */
- (vm->def->os.initrd[0] ? 2 : 0) + /* initrd */
- (vm->def->os.cmdline[0] ? 2 : 0) + /* cmdline */
- (vm->def->os.bootloader[0] ? 2 : 0) + /* bootloader */
- (vm->def->graphicsType == QEMUD_GRAPHICS_VNC ? 2 :
- (vm->def->graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)) + /* graphics */
- (vm->migrateFrom[0] ? 2 : 0); /* migrateFrom */
+#define ADD_ARG_SPACE \
+ do { \
+ if (qargc == qarga) { \
+ qarga += 10; \
+ if (VIR_REALLOC_N(qargv, qarga) < 0) \
+ goto no_memory; \
+ } \
+ } while (0)
+
+#define ADD_ARG(thisarg) \
+ do { \
+ ADD_ARG_SPACE; \
+ qargv[qargc++] = thisarg; \
+ } while (0)
+
+#define ADD_ARG_LIT(thisarg) \
+ do { \
+ ADD_ARG_SPACE; \
+ if ((qargv[qargc++] = strdup(thisarg)) == NULL) \
+ goto no_memory; \
+ } while (0)
snprintf(memory, sizeof(memory), "%lu", vm->def->memory/1024);
snprintf(vcpus, sizeof(vcpus), "%d", vm->def->vcpus);
- if (!(*argv = calloc(len+1, sizeof(**argv))))
- 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)))
- goto no_memory;
- if (disableKQEMU) {
- if (!((*argv)[++n] = strdup("-no-kqemu")))
- goto no_memory;
- }
- if (!((*argv)[++n] = strdup("-m")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(memory)))
- goto no_memory;
- if (!((*argv)[++n] = strdup("-smp")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vcpus)))
- goto no_memory;
+
+ ADD_ARG_LIT(vm->def->os.binary);
+ ADD_ARG_LIT("-S");
+ ADD_ARG_LIT("-M");
+ ADD_ARG_LIT(vm->def->os.machine);
+ if (disableKQEMU)
+ ADD_ARG_LIT("-no-kqemu");
+ ADD_ARG_LIT("-m");
+ ADD_ARG_LIT(memory);
+ ADD_ARG_LIT("-smp");
+ ADD_ARG_LIT(vcpus);
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME) {
- if (!((*argv)[++n] = strdup("-name")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->name)))
- goto no_memory;
+ ADD_ARG_LIT("-name");
+ ADD_ARG_LIT(vm->def->name);
}
/*
* NB, -nographic *MUST* come before any serial, or monitor
@@ -2518,31 +2509,21 @@
* if you ask for nographic. So we have to make sure we override
* these defaults ourselves...
*/
- if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE) {
- if (!((*argv)[++n] = strdup("-nographic")))
- goto no_memory;
- }
-
- if (!((*argv)[++n] = strdup("-monitor")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("pty")))
- goto no_memory;
-
- if (vm->def->localtime) {
- if (!((*argv)[++n] = strdup("-localtime")))
- goto no_memory;
- }
-
- if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
- vm->def->noReboot) {
- if (!((*argv)[++n] = strdup("-no-reboot")))
- goto no_memory;
- }
-
- if (!(vm->def->features & QEMUD_FEATURE_ACPI)) {
- if (!((*argv)[++n] = strdup("-no-acpi")))
- goto no_memory;
- }
+ if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE)
+ ADD_ARG_LIT("-nographic");
+
+ ADD_ARG_LIT("-monitor");
+ ADD_ARG_LIT("pty");
+
+ if (vm->def->localtime)
+ ADD_ARG_LIT("-localtime");
+
+ if ((vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT) &&
+ vm->def->noReboot)
+ ADD_ARG_LIT("-no-reboot");
+
+ if (!(vm->def->features & QEMUD_FEATURE_ACPI))
+ ADD_ARG_LIT("-no-acpi");
if (!vm->def->os.bootloader[0]) {
for (i = 0 ; i < vm->def->os.nBootDevs ; i++) {
@@ -2565,34 +2546,24 @@
}
}
boot[vm->def->os.nBootDevs] = '\0';
- if (!((*argv)[++n] = strdup("-boot")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(boot)))
- goto no_memory;
+ ADD_ARG_LIT("-boot");
+ ADD_ARG_LIT(boot);
if (vm->def->os.kernel[0]) {
- if (!((*argv)[++n] = strdup("-kernel")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.kernel)))
- goto no_memory;
+ ADD_ARG_LIT("-kernel");
+ ADD_ARG_LIT(vm->def->os.kernel);
}
if (vm->def->os.initrd[0]) {
- if (!((*argv)[++n] = strdup("-initrd")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.initrd)))
- goto no_memory;
+ ADD_ARG_LIT("-initrd");
+ ADD_ARG_LIT(vm->def->os.initrd);
}
if (vm->def->os.cmdline[0]) {
- if (!((*argv)[++n] = strdup("-append")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.cmdline)))
- goto no_memory;
- }
- } else {
- if (!((*argv)[++n] = strdup("-bootloader")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.bootloader)))
- goto no_memory;
+ ADD_ARG_LIT("-append");
+ ADD_ARG_LIT(vm->def->os.cmdline);
+ }
+ } else {
+ ADD_ARG_LIT("-bootloader");
+ ADD_ARG_LIT(vm->def->os.bootloader);
}
/* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
@@ -2621,8 +2592,6 @@
const char *media = NULL;
int bootable = 0;
int idx = virDiskNameToIndex(disk->dst);
- if (!((*argv)[++n] = strdup("-drive")))
- goto no_memory;
if (idx < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
@@ -2654,8 +2623,8 @@
idx,
bootable ? ",boot=on" : "");
- if (!((*argv)[++n] = strdup(opt)))
- goto no_memory;
+ ADD_ARG_LIT("-drive");
+ ADD_ARG_LIT(opt);
disk = disk->next;
}
} else {
@@ -2684,20 +2653,16 @@
snprintf(file, PATH_MAX, "%s", disk->src);
- if (!((*argv)[++n] = strdup(dev)))
- goto no_memory;
- if (!((*argv)[++n] = strdup(file)))
- goto no_memory;
+ ADD_ARG_LIT(dev);
+ ADD_ARG_LIT(file);
disk = disk->next;
}
}
if (!net) {
- if (!((*argv)[++n] = strdup("-net")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("none")))
- goto no_memory;
+ ADD_ARG_LIT("-net");
+ ADD_ARG_LIT("none");
} else {
int vlan = 0;
while (net) {
@@ -2712,19 +2677,14 @@
(net->model[0] ? ",model=" : ""), net->model) >= sizeof(nic))
goto error;
- if (!((*argv)[++n] = strdup("-net")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(nic)))
- goto no_memory;
-
- if (!((*argv)[++n] = strdup("-net")))
- goto no_memory;
+ ADD_ARG_LIT("-net");
+ ADD_ARG_LIT(nic);
+ ADD_ARG_LIT("-net");
switch (net->type) {
case QEMUD_NET_NETWORK:
case QEMUD_NET_BRIDGE:
- if (!((*argv)[++n] = qemudNetworkIfaceConnect(conn, driver, vm, net, vlan)))
- goto error;
+ ADD_ARG(qemudNetworkIfaceConnect(conn, driver, vm, net, vlan));
break;
case QEMUD_NET_ETHERNET:
@@ -2736,8 +2696,7 @@
vlan) >= (PATH_MAX-1))
goto error;
- if (!((*argv)[++n] = strdup(arg)))
- goto no_memory;
+ ADD_ARG_LIT(arg);
}
break;
@@ -2765,8 +2724,7 @@
vlan) >= (PATH_MAX-1))
goto error;
- if (!((*argv)[++n] = strdup(arg)))
- goto no_memory;
+ ADD_ARG_LIT(arg);
}
break;
@@ -2777,8 +2735,7 @@
if (snprintf(arg, PATH_MAX-1, "user,vlan=%d", vlan) >= (PATH_MAX-1))
goto error;
- if (!((*argv)[++n] = strdup(arg)))
- goto no_memory;
+ ADD_ARG_LIT(arg);
}
}
@@ -2788,10 +2745,8 @@
}
if (!serial) {
- if (!((*argv)[++n] = strdup("-serial")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("none")))
- goto no_memory;
+ ADD_ARG_LIT("-serial");
+ ADD_ARG_LIT("none");
} else {
while (serial) {
char buf[4096];
@@ -2799,20 +2754,16 @@
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;
+ ADD_ARG_LIT("-serial");
+ ADD_ARG_LIT(buf);
serial = serial->next;
}
}
if (!parallel) {
- if (!((*argv)[++n] = strdup("-parallel")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("none")))
- goto no_memory;
+ ADD_ARG_LIT("-parallel");
+ ADD_ARG_LIT("none");
} else {
while (parallel) {
char buf[4096];
@@ -2820,23 +2771,18 @@
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;
+ ADD_ARG_LIT("-parallel");
+ ADD_ARG_LIT(buf);
parallel = parallel->next;
}
}
- if (!((*argv)[++n] = strdup("-usb")))
- goto no_memory;
+ ADD_ARG_LIT("-usb");
while (input) {
if (input->bus == QEMU_INPUT_BUS_USB) {
- if (!((*argv)[++n] = strdup("-usbdevice")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(input->type == QEMU_INPUT_TYPE_MOUSE ? "mouse" : "tablet")))
- goto no_memory;
+ ADD_ARG_LIT("-usbdevice");
+ ADD_ARG_LIT(input->type == QEMU_INPUT_TYPE_MOUSE ? "mouse" : "tablet");
}
input = input->next;
@@ -2870,15 +2816,11 @@
if (ret < 0 || ret >= (int)sizeof(vncdisplay))
goto error;
- if (!((*argv)[++n] = strdup("-vnc")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vncdisplay)))
- goto no_memory;
+ ADD_ARG_LIT("-vnc");
+ ADD_ARG_LIT(vncdisplay);
if (vm->def->keymap) {
- if (!((*argv)[++n] = strdup("-k")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->keymap)))
- goto no_memory;
+ ADD_ARG_LIT("-k");
+ ADD_ARG_LIT(vm->def->keymap);
}
} else if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE) {
/* Nada - we added -nographic earlier in this function */
@@ -2892,12 +2834,11 @@
char *modstr = calloc(1, size+1);
if (!modstr)
goto no_memory;
- if (!((*argv)[++n] = strdup("-soundhw")))
- goto no_memory;
while(sound && size > 0) {
const char *model = qemudSoundModelToString(sound->model);
if (!model) {
+ free(modstr);
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("invalid sound model"));
goto error;
@@ -2908,19 +2849,18 @@
if (sound)
strncat(modstr, ",", size--);
}
- if (!((*argv)[++n] = modstr))
- goto no_memory;
+ ADD_ARG_LIT("-soundhw");
+ ADD_ARG(modstr);
}
if (vm->migrateFrom[0]) {
- if (!((*argv)[++n] = strdup("-incoming")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->migrateFrom)))
- goto no_memory;
- }
-
- (*argv)[++n] = NULL;
-
+ ADD_ARG_LIT("-incoming");
+ ADD_ARG_LIT(vm->migrateFrom);
+ }
+
+ ADD_ARG(NULL);
+
+ *retargv = qargv;
return 0;
no_memory:
@@ -2934,11 +2874,10 @@
vm->tapfds = NULL;
vm->ntapfds = 0;
}
- if (argv) {
- for (i = 0 ; i < n ; i++)
- free((*argv)[i]);
- free(*argv);
- *argv = NULL;
+ if (qargv) {
+ for (i = 0 ; i < qargc ; i++)
+ free((qargv)[i]);
+ free(qargv);
}
return -1;
}
--
|: 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 :|
16 years, 6 months
[libvirt] Compilation error (storageRegister)
by Stefan de Konink
./configure --prefix=/usr --with-xen --without-sasl --without-avahi
--without-test --without-libvirtd --sysconfdir=/etc --localstatedir=/var
--without-qemu --without-storage-lvm --without-storage-iscsi
gcc -DUSE_READLINE -g -O2 -Wall -Wformat -Wformat-security
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes
-Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fasynchronous-unwind-tables -o .libs/virsh virsh-virsh.o
virsh-console.o virsh-util-lib.o -Wall -Wformat -Wformat-security
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes
-Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fasynchronous-unwind-tables ./.libs/libvirt.so
/usr/lib64/libxml2.so -ldl -lm /usr/lib64/libgnutls.so -L/usr/lib64
/usr/lib64/libtasn1.so -lz /usr/lib64/libgcrypt.so
/usr/lib64/libgpg-error.so ../gnulib/lib/.libs/libgnu.a -lreadline
-lxenstore
./.libs/libvirt.so: undefined reference to `storageRegister'
collect2: ld returned 1 exit status
make[2]: *** [virsh] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/libvirt_test_la-remote_internal.Tpo
.deps/libvirt_test_la-remote_internal.Plo
make[2]: Leaving directory `/home/skinkie/external/libvirt/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/skinkie/external/libvirt'
make: *** [all] Error 2
16 years, 6 months
[libvirt] PATCH: Support initial boot time CPU affinity mask
by Daniel P. Berrange
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 :|
16 years, 6 months
[libvirt] PATCH: Support vCPU pinning in QEMU driver
by Daniel P. Berrange
KVM added ability to get the thread ID for vCPUs via the monitor
(qemu) info cpus
* CPU #0: pc=0x00000000000ffff0 thread_id=11463
CPU #1: pc=0x00000000fffffff0 thread_id=11464
CPU #2: pc=0x00000000fffffff0 thread_id=11465
With this we have enough information to be able to support vCPU pinning in
the QEMU driver for KVM. For QEMU/KQEMU it is trivial, since they have a
single thread.
The following patch implements CPU pinning and fetching of CPU affinity
information. In this example I pin one of the 2 cpus in a guest:
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system start VirtTest
Domain VirtTest started
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system vcpuinfo VirtTest
VCPU: 0
CPU: 0
State: running
CPU Affinity: yy
VCPU: 1
CPU: 0
State: running
CPU Affinity: yy
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system vcpupin VirtTest 1 0
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system vcpuinfo VirtTest
VCPU: 0
CPU: 0
State: running
CPU Affinity: yy
VCPU: 1
CPU: 0
State: running
CPU Affinity: y-
This is implemented using sched_setaffinity/sched_getaffinity which are
Linux specific. There doesn't appear to be a portable process affinity
API in POSIX.
If the KVM instance does not support the 'thread_id' data in 'info cpus',
we simply print out a suitable error message. We detect the mapping at
startup and cache it thereafter.
Dan.
diff -r 0f537442ce97 src/qemu_conf.h
--- a/src/qemu_conf.h Fri May 16 16:09:57 2008 -0400
+++ b/src/qemu_conf.h Fri May 16 17:39:29 2008 -0400
@@ -328,6 +328,9 @@
int *tapfds;
int ntapfds;
+ int nvcpupids;
+ int *vcpupids;
+
int qemuVersion;
int qemuCmdFlags; /* values from enum qemud_cmd_flags */
diff -r 0f537442ce97 src/qemu_driver.c
--- a/src/qemu_driver.c Fri May 16 16:09:57 2008 -0400
+++ b/src/qemu_driver.c Fri May 16 17:39:29 2008 -0400
@@ -61,6 +61,7 @@
#include "nodeinfo.h"
#include "stats_linux.h"
#include "capabilities.h"
+#include "memory.h"
static int qemudShutdown(void);
@@ -118,6 +119,10 @@
struct qemud_network *network);
static int qemudDomainGetMaxVcpus(virDomainPtr dom);
+static int qemudMonitorCommand (const struct qemud_driver *driver,
+ const struct qemud_vm *vm,
+ const char *cmd,
+ char **reply);
static struct qemud_driver *qemu_driver = NULL;
@@ -608,6 +613,106 @@
return ret;
}
+static int
+qemudDetectVcpuPIDs(virConnectPtr conn,
+ struct qemud_driver *driver,
+ struct qemud_vm *vm) {
+ char *qemucpus = NULL;
+ char *line;
+ int lastVcpu = -1;
+
+ /* Only KVM has seperate threads for CPUs,
+ others just use main QEMU process for CPU */
+ if (vm->def->virtType != QEMUD_VIRT_KVM)
+ vm->nvcpupids = 1;
+ else
+ vm->nvcpupids = vm->def->vcpus;
+
+ if (VIR_ALLOC_N(vm->vcpupids, vm->nvcpupids) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("allocate cpumap"));
+ return -1;
+ }
+
+ if (vm->def->virtType != QEMUD_VIRT_KVM) {
+ vm->vcpupids[0] = vm->pid;
+ return 0;
+ }
+
+ if (qemudMonitorCommand(driver, vm, "info cpus", &qemucpus) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command to fetch CPU thread info"));
+ VIR_FREE(vm->vcpupids);
+ vm->nvcpupids = 0;
+ return -1;
+ }
+
+ /*
+ * This is the gross format we're about to parse :-{
+ *
+ * (qemu) info cpus
+ * * CPU #0: pc=0x00000000000f0c4a thread_id=30019
+ * CPU #1: pc=0x00000000fffffff0 thread_id=30020
+ * CPU #2: pc=0x00000000fffffff0 thread_id=30021
+ *
+ */
+ line = qemucpus;
+ do {
+ char *offset = strchr(line, '#');
+ char *end = NULL;
+ int vcpu = 0, tid = 0;
+
+ /* See if we're all done */
+ if (offset == NULL)
+ break;
+
+ /* Extract VCPU number */
+ if (virStrToLong_i(offset + 1, &end, 10, &vcpu) < 0)
+ goto error;
+ if (end == NULL || *end != ':')
+ goto error;
+
+ /* Extract host Thread ID */
+ if ((offset = strstr(line, "thread_id=")) == NULL)
+ goto error;
+ if (virStrToLong_i(offset + strlen("thread_id="), &end, 10, &tid) < 0)
+ goto error;
+ if (end == NULL || !c_isspace(*end))
+ goto error;
+
+ /* Validate the VCPU is in expected range & order */
+ if (vcpu > vm->nvcpupids ||
+ vcpu != (lastVcpu + 1))
+ goto error;
+
+ lastVcpu = vcpu;
+ vm->vcpupids[vcpu] = tid;
+
+ /* Skip to next data line */
+ line = strchr(offset, '\r');
+ if (line == NULL)
+ line = strchr(offset, '\n');
+ } while (line != NULL);
+
+ /* Validate we got data for all VCPUs we expected */
+ if (lastVcpu != (vm->def->vcpus - 1))
+ goto error;
+
+ free(qemucpus);
+ return 0;
+
+error:
+ VIR_FREE(vm->vcpupids);
+ vm->vcpupids = 0;
+ free(qemucpus);
+
+ /* Explicitly return success, not error. Older KVM does
+ not have vCPU -> Thread mapping info and we don't
+ want to break its use. This merely disables ability
+ to pin vCPUS with libvirt */
+ return 0;
+}
+
static int qemudNextFreeVNCPort(struct qemud_driver *driver ATTRIBUTE_UNUSED) {
int i;
@@ -785,6 +890,11 @@
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
+
+ if (qemudDetectVcpuPIDs(conn, driver, vm) < 0) {
+ qemudShutdownVMDaemon(conn, driver, vm);
+ return -1;
+ }
}
return ret;
@@ -857,6 +967,9 @@
vm->pid = -1;
vm->id = -1;
vm->state = VIR_DOMAIN_SHUTOFF;
+ free(vm->vcpupids);
+ vm->vcpupids = NULL;
+ vm->nvcpupids = 0;
if (vm->newDef) {
qemudFreeVMDef(vm->def);
@@ -2271,6 +2384,127 @@
vm->def->vcpus = nvcpus;
return 0;
+}
+
+
+static int
+qemudDomainPinVcpu(virDomainPtr dom,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen) {
+ struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
+ struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
+ cpu_set_t mask;
+ int i, maxcpu;
+ virNodeInfo nodeinfo;
+
+ if (!qemudIsActiveVM(vm)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ "%s",_("cannot pin vcpus on an inactive domain"));
+ return -1;
+ }
+
+ if (vcpu > (vm->nvcpupids-1)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ _("vcpu number out of range %d > %d"),
+ vcpu, vm->nvcpupids);
+ return -1;
+ }
+
+ if (virNodeInfoPopulate(dom->conn, &nodeinfo) < 0)
+ return -1;
+
+ maxcpu = maplen * 8;
+ if (maxcpu > nodeinfo.cpus)
+ maxcpu = nodeinfo.cpus;
+
+ CPU_ZERO(&mask);
+ for (i = 0 ; i < maxcpu ; i++) {
+ if ((cpumap[i/8] >> (i % 8)) & 1)
+ CPU_SET(i, &mask);
+ }
+
+ if (vm->vcpupids != NULL) {
+ if (sched_setaffinity(vm->vcpupids[vcpu], sizeof(mask), &mask) < 0) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ _("cannot set affinity: %s"), strerror(errno));
+ return -1;
+ }
+ } else {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("cpu affinity is not supported"));
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+qemudDomainGetVcpus(virDomainPtr dom,
+ virVcpuInfoPtr info,
+ int maxinfo,
+ unsigned char *cpumaps,
+ int maplen) {
+ struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
+ struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
+ virNodeInfo nodeinfo;
+ int i, v, maxcpu;
+
+ if (!qemudIsActiveVM(vm)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ "%s",_("cannot pin vcpus on an inactive domain"));
+ return -1;
+ }
+
+ if (virNodeInfoPopulate(dom->conn, &nodeinfo) < 0)
+ return -1;
+
+ maxcpu = maplen * 8;
+ if (maxcpu > nodeinfo.cpus)
+ maxcpu = nodeinfo.cpus;
+
+ /* Clamp to actual number of vcpus */
+ if (maxinfo > vm->nvcpupids)
+ maxinfo = vm->nvcpupids;
+
+ if (maxinfo < 1)
+ return 0;
+
+ if (info != NULL) {
+ memset(info, 0, sizeof(*info) * maxinfo);
+ for (i = 0 ; i < maxinfo ; i++) {
+ info[i].number = i;
+ info[i].state = VIR_VCPU_RUNNING;
+ /* XXX cpu time, current pCPU mapping */
+ }
+ }
+
+ if (cpumaps != NULL) {
+ memset(cpumaps, 0, maplen * maxinfo);
+ if (vm->vcpupids != NULL) {
+ for (v = 0 ; v < maxinfo ; v++) {
+ cpu_set_t mask;
+ unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
+ CPU_ZERO(&mask);
+
+ if (sched_getaffinity(vm->vcpupids[v], sizeof(mask), &mask) < 0) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ _("cannot get affinity: %s"), strerror(errno));
+ return -1;
+ }
+
+ for (i = 0 ; i < maxcpu ; i++)
+ if (CPU_ISSET(i, &mask))
+ VIR_USE_CPU(cpumap, i);
+ }
+ } else {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("cpu affinity is not available"));
+ return -1;
+ }
+ }
+
+ return maxinfo;
}
static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
@@ -3221,8 +3455,8 @@
qemudDomainRestore, /* domainRestore */
NULL, /* domainCoreDump */
qemudDomainSetVcpus, /* domainSetVcpus */
- NULL, /* domainPinVcpu */
- NULL, /* domainGetVcpus */
+ qemudDomainPinVcpu, /* domainPinVcpu */
+ qemudDomainGetVcpus, /* domainGetVcpus */
qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
qemudDomainDumpXML, /* domainDumpXML */
qemudListDefinedDomains, /* listDomains */
--
|: 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 :|
16 years, 6 months
[libvirt] PATCH: Remove duplicate messages in configure.ac
by Daniel P. Berrange
Another configure.ac cleanup, this time removing a bunch of duplicated
messages printed out by various checks. Applies ontop of the previous
patch.
Dan.
diff -r cc378ee57aab configure.in
--- a/configure.in Tue May 20 14:23:31 2008 -0400
+++ b/configure.in Tue May 20 14:32:17 2008 -0400
@@ -355,16 +355,14 @@
[GNUTLS_FOUND=yes], [GNUTLS_FOUND=no])
fi
if test "$GNUTLS_FOUND" = "no"; then
- AC_CHECK_HEADER([gnutls/gnutls.h],
- [],
- AC_MSG_ERROR(
- [You must install the GnuTLS development package in order to compile libvirt]))
+ fail=0
old_libs="$LIBS"
- AC_CHECK_LIB([gnutls], [gnutls_handshake],
- [],
- [AC_MSG_ERROR(
- [You must install the GnuTLS library in order to compile and run libvirt])],
- [-lgcrypt])
+ AC_CHECK_HEADER([gnutls/gnutls.h], [], [fail=1])
+ AC_CHECK_LIB([gnutls], [gnutls_handshake],[], [fail=1], [-lgcrypt])
+
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the GnuTLS library in order to compile and run libvirt])
+
GNUTLS_LIBS=$LIBS
LIBS="$old_libs"
fi
@@ -400,6 +398,7 @@
SASL_CFLAGS="-I$with_sasl"
SASL_LIBS="-L$with_sasl"
fi
+ fail=0
old_cflags="$CFLAGS"
old_libs="$LIBS"
CFLAGS="$CFLAGS $SASL_CFLAGS"
@@ -408,18 +407,18 @@
if test "x$with_sasl" != "xcheck" ; then
with_sasl=no
else
- AC_MSG_ERROR(
- [You must install the Cyrus SASL development package in order to compile libvirt])
+ fail=1
fi])
if test "x$with_sasl" != "xno" ; then
AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl=yes],[
if test "x$with_sasl" = "xcheck" ; then
with_sasl=no
else
- AC_MSG_ERROR(
- [You must install the Cyrus SASL library in order to compile and run libvirt])
+ fail=1
fi])
fi
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt])
CFLAGS="$old_cflags"
LIBS="$old_libs"
SASL_LIBS="$SASL_LIBS -lsasl2"
@@ -518,10 +517,11 @@
with_selinux="yes"
fi
else
- AC_CHECK_HEADER([selinux/selinux.h],[],
- [AC_MSG_ERROR([You must install the SELinux development package in order to compile libvirt])])
- AC_CHECK_LIB([selinux], [fgetfilecon],[],
- [AC_MSG_ERROR([You must install the SELinux development package in order to compile and run libvirt])])
+ fail=0
+ AC_CHECK_HEADER([selinux/selinux.h],[],[fail=1])
+ AC_CHECK_LIB([selinux], [fgetfilecon],[],[fail=1])
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the SELinux development package in order to compile libvirt])
fi
CFLAGS="$old_cflags"
LIBS="$old_libs"
@@ -552,10 +552,11 @@
with_numactl="yes"
fi
else
- AC_CHECK_HEADER([numa.h],[],
- [AC_MSG_ERROR([You must install the numactl development package in order to compile libvirt])])
- AC_CHECK_LIB([numa], [numa_available],[],
- [AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])])
+ fail=0
+ AC_CHECK_HEADER([numa.h],[],[fail=1])
+ AC_CHECK_LIB([numa], [numa_available],[],[fail=1])
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])
fi
CFLAGS="$old_cflags"
LIBS="$old_libs"
@@ -632,7 +633,7 @@
AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_fs" = "yes" ; then
if test -z "$MOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
- if test -z "$UMOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
+ if test -z "$UMOUNT" ; then AC_MSG_ERROR(We need umount for FS storage driver) ; fi
else
if test -z "$MOUNT" ; then with_storage_fs=no ; fi
if test -z "$UMOUNT" ; then with_storage_fs=no ; fi
--
|: 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 :|
16 years, 6 months
[libvirt] PATCH: Ensure configure.ac is fully quoted
by Daniel P. Berrange
As suggested by Jim, this patch goes through the configure script and makes
sure all args to macros are fully quoted. NB, this applies on top of the
NUMA/cpu pinning patches I sent the other day, not CVS.
Dan.
diff -r d2bddf5ed80e configure.in
--- a/configure.in Tue May 20 14:10:37 2008 -0400
+++ b/configure.in Tue May 20 14:23:31 2008 -0400
@@ -15,12 +15,12 @@
LIBVIRT_VERSION_INFO=`expr $LIBVIRT_MAJOR_VERSION + $LIBVIRT_MINOR_VERSION`:$LIBVIRT_MICRO_VERSION:$LIBVIRT_MINOR_VERSION
LIBVIRT_VERSION_NUMBER=`expr $LIBVIRT_MAJOR_VERSION \* 1000000 + $LIBVIRT_MINOR_VERSION \* 1000 + $LIBVIRT_MICRO_VERSION`
-AC_SUBST(LIBVIRT_MAJOR_VERSION)
-AC_SUBST(LIBVIRT_MINOR_VERSION)
-AC_SUBST(LIBVIRT_MICRO_VERSION)
-AC_SUBST(LIBVIRT_VERSION)
-AC_SUBST(LIBVIRT_VERSION_INFO)
-AC_SUBST(LIBVIRT_VERSION_NUMBER)
+AC_SUBST([LIBVIRT_MAJOR_VERSION])
+AC_SUBST([LIBVIRT_MINOR_VERSION])
+AC_SUBST([LIBVIRT_MICRO_VERSION])
+AC_SUBST([LIBVIRT_VERSION])
+AC_SUBST([LIBVIRT_VERSION_INFO])
+AC_SUBST([LIBVIRT_VERSION_NUMBER])
dnl Required minimum versions of all libs we depend on
LIBXML_REQUIRED="2.5.0"
@@ -74,34 +74,34 @@
])
dnl Do we have rpcgen?
-AC_PATH_PROG(RPCGEN, rpcgen, no)
-AM_CONDITIONAL(RPCGEN, [test "x$ac_cv_path_RPCGEN" != "xno"])
+AC_PATH_PROG([RPCGEN], [rpcgen], [no])
+AM_CONDITIONAL([RPCGEN], [test "x$ac_cv_path_RPCGEN" != "xno"])
dnl Is this GLIBC's buggy rpcgen?
-AM_CONDITIONAL(GLIBC_RPCGEN,
+AM_CONDITIONAL([GLIBC_RPCGEN],
[test "x$ac_cv_path_RPCGEN" != "xno" &&
$ac_cv_path_RPCGEN -t </dev/null >/dev/null 2>&1])
dnl pthread?
-AC_CHECK_HEADER(pthread.h,
- AC_CHECK_LIB(pthread,pthread_join,[
+AC_CHECK_HEADER([pthread.h],
+ AC_CHECK_LIB([pthread],[pthread_join],[
AC_DEFINE([HAVE_LIBPTHREAD],[],[Define if pthread (-lpthread)])
AC_DEFINE([HAVE_PTHREAD_H],[],[Define if <pthread.h>])
]))
dnl Miscellaneous external programs.
-AC_PATH_PROG(RM, rm, /bin/rm)
-AC_PATH_PROG(MV, mv, /bin/mv)
-AC_PATH_PROG(TAR, tar, /bin/tar)
-AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
-AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
+AC_PATH_PROG([RM], [rm], [/bin/rm])
+AC_PATH_PROG([MV], [mv], [/bin/mv])
+AC_PATH_PROG([TAR], [tar], [/bin/tar])
+AC_PATH_PROG([XMLLINT], [xmllint], [/usr/bin/xmllint])
+AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc])
dnl External programs that we can use if they are available.
dnl We will hard-code paths to these programs unless we cannot
dnl detect them, in which case we'll search for the program
dnl along the $PATH at runtime and fail if it's not there.
-AC_PATH_PROG(DNSMASQ, dnsmasq, dnsmasq,
+AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
-AC_PATH_PROG(BRCTL, brctl, brctl,
+AC_PATH_PROG([BRCTL], [brctl], [brctl],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_DEFINE_UNQUOTED([DNSMASQ],["$DNSMASQ"],
@@ -110,15 +110,15 @@
[Location or name of the brctl program (see bridge-utils)])
dnl Specific dir for HTML output ?
-AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
+AC_ARG_WITH([html-dir], AC_HELP_STRING([--with-html-dir=path],
[path to base html directory, default $datadir/doc/html]),
[HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
-AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
+AC_ARG_WITH([html-subdir], AC_HELP_STRING([--with-html-subdir=path],
[directory used under html-dir, default $PACKAGE-$VERSION/html]),
[test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
[HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
-AC_SUBST(HTML_DIR)
+AC_SUBST([HTML_DIR])
dnl if --prefix is /usr, don't use /usr/var for localstatedir
dnl or /usr/etc for sysconfdir
@@ -133,19 +133,19 @@
dnl Allow to build without Xen, QEMU/KVM, test or remote driver
-AC_ARG_WITH(xen,
+AC_ARG_WITH([xen],
[ --with-xen add XEN support (on)],[],[with_xen=yes])
-AC_ARG_WITH(qemu,
+AC_ARG_WITH([qemu],
[ --with-qemu add QEMU/KVM support (on)],[],[with_qemu=yes])
-AC_ARG_WITH(openvz,
+AC_ARG_WITH([openvz],
[ --with-openvz add OpenVZ support (off)],[],[with_openvz=no])
-AC_ARG_WITH(lxc,
+AC_ARG_WITH([lxc],
[ --with-lxc add Linux Container support (off)],[],[with_lxc=no])
-AC_ARG_WITH(test,
+AC_ARG_WITH([test],
[ --with-test add test driver support (on)],[],[with_test=yes])
-AC_ARG_WITH(remote,
+AC_ARG_WITH([remote],
[ --with-remote add remote driver support (on)],[],[with_remote=yes])
-AC_ARG_WITH(libvirtd,
+AC_ARG_WITH([libvirtd],
[ --with-libvirtd add libvirtd support (on)],[],[with_libvirtd=yes])
dnl
@@ -156,19 +156,19 @@
else
STATIC_BINARIES=
fi
-AC_SUBST(STATIC_BINARIES)
+AC_SUBST([STATIC_BINARIES])
dnl --enable-debug=(yes|no)
-AC_ARG_ENABLE(debug,
+AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug=no/yes],
[enable debugging output]),[],[enable_debug=yes])
if test x"$enable_debug" = x"yes"; then
- AC_DEFINE(ENABLE_DEBUG, [], [whether debugging is enabled])
+ AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled])
fi
AC_MSG_CHECKING([where to write libvirtd PID file])
-AC_ARG_WITH(remote-pid-file, AC_HELP_STRING([--with-remote-pid-file=[pidfile|none]], [PID file for libvirtd]))
+AC_ARG_WITH([remote-pid-file], AC_HELP_STRING([--with-remote-pid-file=[pidfile|none]], [PID file for libvirtd]))
if test "x$with_remote_pid_file" == "x" ; then
REMOTE_PID_FILE="$localstatedir/run/libvirtd.pid"
elif test "x$with_remote_pid_file" == "xnone" ; then
@@ -176,14 +176,14 @@
else
REMOTE_PID_FILE="$with_remote_pid_file"
fi
-AC_SUBST(REMOTE_PID_FILE)
+AC_SUBST([REMOTE_PID_FILE])
AC_MSG_RESULT($REMOTE_PID_FILE)
dnl
dnl init script flavor
dnl
AC_MSG_CHECKING([for init script flavor])
-AC_ARG_WITH(init-script,
+AC_ARG_WITH([init-script],
AC_HELP_STRING([--with-init-scripts=[redhat|auto|none]],
[Style of init scripts to install (defaults to auto)]))
if test "x$with_init_scripts" = "x" -o "x$with_init_scripts" = "xauto"; then
@@ -193,19 +193,19 @@
with_init_scripts=none
fi
fi
-AM_CONDITIONAL(LIBVIRT_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
+AM_CONDITIONAL([LIBVIRT_INIT_SCRIPTS_RED_HAT], test x$with_init_scripts = xredhat)
AC_MSG_RESULT($with_init_scripts)
dnl
dnl ensure that Fedora's system-config-firewall knows
dnl about libvirt's iptables rules
dnl
-AC_ARG_ENABLE(iptables-lokkit,
+AC_ARG_ENABLE([iptables-lokkit],
AC_HELP_STRING([--enable-iptables-lokkit=no/yes/check],
[enable registering libvirt's iptables rules with Fedora's lokkit]),
[],[enable_iptables_lokkit=check])
if test x"$enable_iptables_lokkit" != x"no"; then
- AC_PATH_PROG(LOKKIT_PATH, lokkit, [], [/usr/sbin:$PATH])
+ AC_PATH_PROG([LOKKIT_PATH],[lokkit], [], [/usr/sbin:$PATH])
fi
if test x"$enable_iptables_lokkit" = x"yes" -a x"$LOKKIT_PATH" = x; then
@@ -213,18 +213,18 @@
fi
if test x"$LOKKIT_PATH" != x; then
- AC_DEFINE(ENABLE_IPTABLES_LOKKIT, [], [whether support for Fedora's lokkit is enabled])
- AC_DEFINE_UNQUOTED(LOKKIT_PATH, "$LOKKIT_PATH", [path to lokkit binary])
+ AC_DEFINE([ENABLE_IPTABLES_LOKKIT], [], [whether support for Fedora's lokkit is enabled])
+ AC_DEFINE_UNQUOTED([LOKKIT_PATH], "$LOKKIT_PATH", [path to lokkit binary])
fi
-AC_PATH_PROG(IPTABLES_PATH, iptables, /sbin/iptables, [/usr/sbin:$PATH])
-AC_DEFINE_UNQUOTED(IPTABLES_PATH, "$IPTABLES_PATH", [path to iptables binary])
+AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [/usr/sbin:$PATH])
+AC_DEFINE_UNQUOTED([IPTABLES_PATH], "$IPTABLES_PATH", [path to iptables binary])
dnl
dnl Specify the xen-distribution directory to be able to compile on a
dnl non-xenified host
dnl
-AC_ARG_WITH(xen-distdir, AC_HELP_STRING([--with-xen-distdir=path],
+AC_ARG_WITH([xen-distdir], AC_HELP_STRING([--with-xen-distdir=path],
[distribution directory of Xen, default /usr]))
if test "x$with_xen_distdir" != "x"
then
@@ -262,7 +262,7 @@
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_XEN"
fi
- AC_CHECK_HEADERS(xen/xen.h xen/version.h xen/dom0_ops.h,,[
+ AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[
AC_MSG_ERROR([Cannot find standard Xen headers. Is xen-devel installed?])
],
[#include <stdio.h>
@@ -270,8 +270,8 @@
])
dnl Search for the location of <xen/{linux,sys}/privcmd.h>.
- AC_CHECK_HEADERS(xen/sys/privcmd.h,,[
- AC_CHECK_HEADERS(xen/linux/privcmd.h,,[
+ AC_CHECK_HEADERS([xen/sys/privcmd.h],,[
+ AC_CHECK_HEADERS([xen/linux/privcmd.h],,[
AC_MSG_ERROR([Cannot find header file <xen/linux/privcmd.h> or <xen/sys/privcmd.h>. Is xen-devel installed?])
],
[#include <stdio.h>
@@ -289,7 +289,7 @@
dnl check for kernel headers required by qemud/bridge.c
dnl
if test "$with_qemu" = "yes" ; then
- AC_CHECK_HEADERS(linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h,,
+ AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt]))
fi
@@ -304,7 +304,7 @@
LIBXML_LIBS=""
LIBXML_FOUND="no"
-AC_ARG_WITH(libxml, [ --with-libxml=[PFX] libxml2 location])
+AC_ARG_WITH([libxml], [ --with-libxml=[PFX] libxml2 location])
if test "x$with_libxml" = "xno" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
AC_MSG_ERROR(libxml2 >= $LIBXML_REQUIRED is required for libvirt)
@@ -332,16 +332,16 @@
fi
fi
-AC_SUBST(LIBXML_CFLAGS)
-AC_SUBST(LIBXML_LIBS)
+AC_SUBST([LIBXML_CFLAGS])
+AC_SUBST([LIBXML_LIBS])
dnl xmlURI structure has query_raw?
old_cflags="$CFLAGS"
old_ldflags="$LDFLAGS"
CFLAGS="$CFLAGS $LIBXML_CFLAGS"
LDFLAGS="$LDFLAGS $LIBXML_LIBS"
-AC_CHECK_MEMBER(struct _xmlURI.query_raw,
- [AC_DEFINE(HAVE_XMLURI_QUERY_RAW, [], [Have query_raw field in libxml2 xmlURI structure])],,
+AC_CHECK_MEMBER([struct _xmlURI.query_raw],
+ [AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [], [Have query_raw field in libxml2 xmlURI structure])],,
[#include <libxml/uri.h>])
CFLAGS="$old_cflags"
LDFLAGS="$old_ldflags"
@@ -360,7 +360,7 @@
AC_MSG_ERROR(
[You must install the GnuTLS development package in order to compile libvirt]))
old_libs="$LIBS"
- AC_CHECK_LIB(gnutls, gnutls_handshake,
+ AC_CHECK_LIB([gnutls], [gnutls_handshake],
[],
[AC_MSG_ERROR(
[You must install the GnuTLS library in order to compile and run libvirt])],
@@ -369,8 +369,8 @@
LIBS="$old_libs"
fi
-AC_SUBST(GNUTLS_CFLAGS)
-AC_SUBST(GNUTLS_LIBS)
+AC_SUBST([GNUTLS_CFLAGS])
+AC_SUBST([GNUTLS_LIBS])
dnl Old versions of GnuTLS uses types like 'gnutls_session' instead
dnl of 'gnutls_session_t'. Try to detect this type if defined so
@@ -379,8 +379,8 @@
old_ldflags="$LDFLAGS"
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
LDFLAGS="$LDFLAGS $GNUTLS_LIBS"
-AC_CHECK_TYPE(gnutls_session,
- AC_DEFINE(GNUTLS_1_0_COMPAT,[],
+AC_CHECK_TYPE([gnutls_session],
+ AC_DEFINE([GNUTLS_1_0_COMPAT],[],
[enable GnuTLS 1.0 compatibility macros]),,
[#include <gnutls/gnutls.h>])
CFLAGS="$old_cflags"
@@ -388,7 +388,7 @@
dnl Cyrus SASL
-AC_ARG_WITH(sasl,
+AC_ARG_WITH([sasl],
[ --with-sasl use cyrus SASL for authentication],
[],
[with_sasl=check])
@@ -412,7 +412,7 @@
[You must install the Cyrus SASL development package in order to compile libvirt])
fi])
if test "x$with_sasl" != "xno" ; then
- AC_CHECK_LIB(sasl2, sasl_client_init,[with_sasl=yes],[
+ AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl=yes],[
if test "x$with_sasl" = "xcheck" ; then
with_sasl=no
else
@@ -424,19 +424,19 @@
LIBS="$old_libs"
SASL_LIBS="$SASL_LIBS -lsasl2"
if test "x$with_sasl" = "xyes" ; then
- AC_DEFINE_UNQUOTED(HAVE_SASL, 1,
+ AC_DEFINE_UNQUOTED([HAVE_SASL], 1,
[whether Cyrus SASL is available for authentication])
fi
fi
-AM_CONDITIONAL(HAVE_SASL, [test "x$with_sasl" = "xyes"])
-AC_SUBST(SASL_CFLAGS)
-AC_SUBST(SASL_LIBS)
+AM_CONDITIONAL([HAVE_SASL], [test "x$with_sasl" = "xyes"])
+AC_SUBST([SASL_CFLAGS])
+AC_SUBST([SASL_LIBS])
dnl PolicyKit library
POLKIT_CFLAGS=
POLKIT_LIBS=
-AC_ARG_WITH(polkit,
+AC_ARG_WITH([polkit],
[ --with-polkit use PolicyKit for UNIX socket access checks],
[],
[with_polkit=check])
@@ -452,29 +452,29 @@
fi
])
if test "x$with_polkit" = "xyes" ; then
- AC_DEFINE_UNQUOTED(HAVE_POLKIT, 1,
+ AC_DEFINE_UNQUOTED([HAVE_POLKIT], 1,
[use PolicyKit for UNIX socket access checks])
old_CFLAGS=$CFLAGS
old_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS $POLKIT_CFLAGS"
LDFLAGS="$LDFLAGS $POLKIT_LIBS"
- AC_CHECK_FUNCS(polkit_context_is_caller_authorized)
+ AC_CHECK_FUNCS([polkit_context_is_caller_authorized])
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
- AC_PATH_PROG(POLKIT_AUTH, polkit-auth)
+ AC_PATH_PROG([POLKIT_AUTH], [polkit-auth])
if test "x$POLKIT_AUTH" != "x"; then
AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
fi
fi
fi
-AM_CONDITIONAL(HAVE_POLKIT, [test "x$with_polkit" = "xyes"])
-AC_SUBST(POLKIT_CFLAGS)
-AC_SUBST(POLKIT_LIBS)
+AM_CONDITIONAL([HAVE_POLKIT], [test "x$with_polkit" = "xyes"])
+AC_SUBST([POLKIT_CFLAGS])
+AC_SUBST([POLKIT_LIBS])
dnl Avahi library
-AC_ARG_WITH(avahi,
+AC_ARG_WITH([avahi],
[ --with-avahi use avahi to advertise remote daemon],
[],
[with_avahi=check])
@@ -492,16 +492,16 @@
fi
])
if test "x$with_avahi" = "xyes" ; then
- AC_DEFINE_UNQUOTED(HAVE_AVAHI, 1,
+ AC_DEFINE_UNQUOTED([HAVE_AVAHI], 1,
[whether Avahi is used to broadcast server presense])
fi
fi
-AM_CONDITIONAL(HAVE_AVAHI, [test "x$with_avahi" = "xyes"])
-AC_SUBST(AVAHI_CFLAGS)
-AC_SUBST(AVAHI_LIBS)
+AM_CONDITIONAL([HAVE_AVAHI], [test "x$with_avahi" = "xyes"])
+AC_SUBST([AVAHI_CFLAGS])
+AC_SUBST([AVAHI_LIBS])
dnl SELinux
-AC_ARG_WITH(selinux,
+AC_ARG_WITH([selinux],
[ --with-selinux use SELinux to manage security],
[],
[with_selinux=check])
@@ -513,14 +513,14 @@
old_libs="$LIBS"
if test "$with_selinux" = "check"; then
AC_CHECK_HEADER([selinux/selinux.h],[],[with_selinux=no])
- AC_CHECK_LIB(selinux, fgetfilecon,[],[with_selinux=no])
+ AC_CHECK_LIB([selinux], [fgetfilecon],[],[with_selinux=no])
if test "$with_selinux" != "no"; then
with_selinux="yes"
fi
else
AC_CHECK_HEADER([selinux/selinux.h],[],
[AC_MSG_ERROR([You must install the SELinux development package in order to compile libvirt])])
- AC_CHECK_LIB(selinux, fgetfilecon,[],
+ AC_CHECK_LIB([selinux], [fgetfilecon],[],
[AC_MSG_ERROR([You must install the SELinux development package in order to compile and run libvirt])])
fi
CFLAGS="$old_cflags"
@@ -528,14 +528,14 @@
fi
if test "$with_selinux" = "yes"; then
SELINUX_LIBS="-lselinux"
- AC_DEFINE_UNQUOTED(HAVE_SELINUX, 1, [whether SELinux is available for security])
+ AC_DEFINE_UNQUOTED([HAVE_SELINUX], 1, [whether SELinux is available for security])
fi
-AM_CONDITIONAL(HAVE_SELINUX, [test "$with_selinux" != "no"])
-AC_SUBST(SELINUX_CFLAGS)
-AC_SUBST(SELINUX_LIBS)
+AM_CONDITIONAL([HAVE_SELINUX], [test "$with_selinux" != "no"])
+AC_SUBST([SELINUX_CFLAGS])
+AC_SUBST([SELINUX_LIBS])
dnl NUMA lib
-AC_ARG_WITH(numactl,
+AC_ARG_WITH([numactl],
[ --with-numactl use numactl for host topology info],
[],
[with_numactl=check])
@@ -547,14 +547,14 @@
old_libs="$LIBS"
if test "$with_numactl" = "check"; then
AC_CHECK_HEADER([numa.h],[],[with_numactl=no])
- AC_CHECK_LIB(numa, numa_available,[],[with_numactl=no])
+ AC_CHECK_LIB([numa], [numa_available],[],[with_numactl=no])
if test "$with_numactl" != "no"; then
with_numactl="yes"
fi
else
AC_CHECK_HEADER([numa.h],[],
[AC_MSG_ERROR([You must install the numactl development package in order to compile libvirt])])
- AC_CHECK_LIB(numa, numa_available,[],
+ AC_CHECK_LIB([numa], [numa_available],[],
[AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])])
fi
CFLAGS="$old_cflags"
@@ -562,17 +562,17 @@
fi
if test "$with_numactl" = "yes"; then
NUMACTL_LIBS="-lnuma"
- AC_DEFINE_UNQUOTED(HAVE_NUMACTL, 1, [whether Numactl is available for security])
+ AC_DEFINE_UNQUOTED([HAVE_NUMACTL], 1, [whether Numactl is available for security])
fi
-AM_CONDITIONAL(HAVE_NUMACTL, [test "$with_numactl" != "no"])
-AC_SUBST(NUMACTL_CFLAGS)
-AC_SUBST(NUMACTL_LIBS)
+AM_CONDITIONAL([HAVE_NUMACTL], [test "$with_numactl" != "no"])
+AC_SUBST([NUMACTL_CFLAGS])
+AC_SUBST([NUMACTL_LIBS])
dnl virsh libraries
AC_CHECK_HEADERS([readline/readline.h])
# Check for readline.
-AC_CHECK_LIB(readline, readline,
+AC_CHECK_LIB([readline], [readline],
[lv_use_readline=yes; VIRSH_LIBS="$VIRSH_LIBS -lreadline"],
[lv_use_readline=no])
@@ -589,7 +589,7 @@
# Now, check for -lreadline again, also using $LIBS.
# Note: this time we use a different function, so that
# we don't get a cached "no" result.
- AC_CHECK_LIB(readline, rl_initialize,
+ AC_CHECK_LIB([readline], [rl_initialize],
[lv_use_readline=yes
VIRSH_LIBS="$VIRSH_LIBS -lreadline $LIBS"],,
[$LIBS])
@@ -607,29 +607,29 @@
else
READLINE_CFLAGS=
fi
-AC_SUBST(READLINE_CFLAGS)
-AC_SUBST(VIRSH_LIBS)
+AC_SUBST([READLINE_CFLAGS])
+AC_SUBST([VIRSH_LIBS])
-AC_SUBST(WITH_XEN)
-AC_SUBST(LIBVIRT_FEATURES)
+AC_SUBST([WITH_XEN])
+AC_SUBST([LIBVIRT_FEATURES])
dnl
dnl Storage driver checks
dnl
-AC_ARG_WITH(storage-fs,
+AC_ARG_WITH([storage-fs],
[ --with-storage-fs with FileSystem backend for the storage driver (on)],[],[with_storage_fs=check])
-AC_ARG_WITH(storage-lvm,
+AC_ARG_WITH([storage-lvm],
[ --with-storage-lvm with LVM backend for the storage driver (on)],[],[with_storage_lvm=check])
-AC_ARG_WITH(storage-iscsi,
+AC_ARG_WITH([storage-iscsi],
[ --with-storage-iscsi with iSCSI backend for the storage driver (on)],[],[with_storage_iscsi=check])
-AC_ARG_WITH(storage-disk,
+AC_ARG_WITH([storage-disk],
[ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check])
if test "$with_storage_fs" = "yes" -o "$with_storage_fs" = "check"; then
- AC_PATH_PROG(MOUNT, [mount], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(UMOUNT, [umount], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_fs" = "yes" ; then
if test -z "$MOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
if test -z "$UMOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
@@ -641,41 +641,41 @@
fi
if test "$with_storage_fs" = "yes" ; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_FS, 1, [whether FS backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_FS], 1, [whether FS backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([MOUNT],["$MOUNT"],
[Location or name of the mount program])
AC_DEFINE_UNQUOTED([UMOUNT],["$UMOUNT"],
[Location or name of the mount program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_FS, [test "$with_storage_fs" = "yes"])
+AM_CONDITIONAL([WITH_STORAGE_FS], [test "$with_storage_fs" = "yes"])
-AC_PATH_PROG(QEMU_IMG, [qemu-img], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
+AC_PATH_PROG([QEMU_IMG], [qemu-img], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
if test -n "$QEMU_IMG" ; then
- AC_DEFINE_UNQUOTED(HAVE_QEMU_IMG, 1, [whether qemu-img is available for non-raw files])
+ AC_DEFINE_UNQUOTED([HAVE_QEMU_IMG], 1, [whether qemu-img is available for non-raw files])
AC_DEFINE_UNQUOTED([QEMU_IMG],["$QEMU_IMG"],
[Location or name of the qemu-img program])
fi
-AC_PATH_PROG(QCOW_CREATE, [qcow-create], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
+AC_PATH_PROG([QCOW_CREATE], [qcow-create], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
if test -n "$QCOW_CREATE" ; then
- AC_DEFINE_UNQUOTED(HAVE_QCOW_CREATE, 1, [whether qcow-create is available for non-raw files])
+ AC_DEFINE_UNQUOTED([HAVE_QCOW_CREATE], 1, [whether qcow-create is available for non-raw files])
AC_DEFINE_UNQUOTED([QCOW_CREATE],["$QCOW_CREATE"],
[Location or name of the qcow-create program])
fi
if test "$with_storage_lvm" = "yes" -o "$with_storage_lvm" = "check"; then
- AC_PATH_PROG(PVCREATE, [pvcreate], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGCREATE, [vgcreate], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(LVCREATE, [lvcreate], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(PVREMOVE, [pvremove], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGREMOVE, [vgremove], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(LVREMOVE, [lvremove], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGCHANGE, [vgchange], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(PVS, [pvs], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGS, [vgs], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(LVS, [lvs], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PVCREATE], [pvcreate], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGCREATE], [vgcreate], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([LVCREATE], [lvcreate], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PVREMOVE], [pvremove], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGREMOVE], [vgremove], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([LVREMOVE], [lvremove], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGCHANGE], [vgchange], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PVS], [pvs], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGS], [vgs], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([LVS], [lvs], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_lvm" = "yes" ; then
if test -z "$PVCREATE" ; then AC_MSG_ERROR(We need pvcreate for LVM storage driver) ; fi
@@ -704,7 +704,7 @@
fi
if test "$with_storage_lvm" = "yes" ; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_LVM, 1, [whether LVM backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_LVM], 1, [whether LVM backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PVCREATE],["$PVCREATE"],[Location of pvcreate program])
AC_DEFINE_UNQUOTED([VGCREATE],["$VGCREATE"],[Location of vgcreate program])
AC_DEFINE_UNQUOTED([LVCREATE],["$LVCREATE"],[Location of lvcreate program])
@@ -717,12 +717,12 @@
AC_DEFINE_UNQUOTED([LVS],["$LVS"],[Location of lvs program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_LVM, [test "$with_storage_lvm" = "yes"])
+AM_CONDITIONAL([WITH_STORAGE_LVM], [test "$with_storage_lvm" = "yes"])
if test "$with_storage_iscsi" = "yes" -o "$with_storage_iscsi" = "check"; then
- AC_PATH_PROG(ISCSIADM, [iscsiadm], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([ISCSIADM], [iscsiadm], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_iscsi" = "yes" ; then
if test -z "$ISCSIADM" ; then AC_MSG_ERROR(We need iscsiadm for iSCSI storage driver) ; fi
else
@@ -732,18 +732,18 @@
fi
if test "$with_storage_iscsi" = "yes" ; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_ISCSI, 1, [whether iSCSI backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_ISCSI], 1, [whether iSCSI backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([ISCSIADM],["$ISCSIADM"],[Location of iscsiadm program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_ISCSI, [test "$with_storage_iscsi" = "yes"])
+AM_CONDITIONAL([WITH_STORAGE_ISCSI], [test "$with_storage_iscsi" = "yes"])
LIBPARTED_CFLAGS=
LIBPARTED_LIBS=
if test "$with_storage_disk" = "yes" -o "$with_storage_disk" = "check"; then
- AC_PATH_PROG(PARTED, [parted], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin])
if test -z "$PARTED" ; then with_storage_disk=no ; fi
PARTED_FOUND=yes
@@ -755,9 +755,9 @@
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
PARTED_FOUND=yes
- AC_CHECK_HEADER(parted/parted.h,,[PARTED_FOUND=no])
- AC_CHECK_LIB(uuid, uuid_generate,,[PARTED_FOUND=no])
- AC_CHECK_LIB(parted, ped_device_read,,[PARTED_FOUND=no])
+ AC_CHECK_HEADER([parted/parted.h],,[PARTED_FOUND=no])
+ AC_CHECK_LIB([uuid], [uuid_generate],,[PARTED_FOUND=no])
+ AC_CHECK_LIB([parted], [ped_device_read],,[PARTED_FOUND=no])
LIBPARTED_LIBS="-luuid -lparted"
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
@@ -774,13 +774,13 @@
fi
if test "$with_storage_disk" = "yes"; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_DISK, 1, [whether Disk backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_DISK], 1, [whether Disk backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PARTED],["$PARTED"], [Location or name of the parted program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_DISK, [test "$with_storage_disk" = "yes"])
-AC_SUBST(LIBPARTED_CFLAGS)
-AC_SUBST(LIBPARTED_LIBS)
+AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
+AC_SUBST([LIBPARTED_CFLAGS])
+AC_SUBST([LIBPARTED_LIBS])
dnl
@@ -808,7 +808,7 @@
echo Found python in environment PYTHON=$PYTHON
with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
else
- AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+ AC_PATH_PROG([PYTHON], [python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5])
fi
fi
fi
@@ -853,11 +853,11 @@
else
PYTHON=
fi
-AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
-AC_SUBST(pythondir)
-AC_SUBST(PYTHON_VERSION)
-AC_SUBST(PYTHON_INCLUDES)
-AC_SUBST(PYTHON_SITE_PACKAGES)
+AM_CONDITIONAL([WITH_PYTHON], test "$PYTHON_INCLUDES" != "")
+AC_SUBST([pythondir])
+AC_SUBST([PYTHON_VERSION])
+AC_SUBST([PYTHON_INCLUDES])
+AC_SUBST([PYTHON_SITE_PACKAGES])
AC_MSG_CHECKING([whether this host is running a Xen kernel])
RUNNING_XEN=
@@ -879,9 +879,9 @@
fi
AC_MSG_RESULT($RUNNING_XEND)
-AM_CONDITIONAL(ENABLE_XEN_TESTS, [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
+AM_CONDITIONAL([ENABLE_XEN_TESTS], [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
-AC_ARG_ENABLE(test-coverage,
+AC_ARG_ENABLE([test-coverage],
[ --enable-test-coverage turn on code coverage instrumentation],
[case "${enableval}" in
yes|no) ;;
@@ -899,7 +899,7 @@
dnl Enable building the proxy?
-AC_ARG_WITH(xen-proxy,
+AC_ARG_WITH([xen-proxy],
[ --with-xen-proxy add XEN setuid proxy support (on)],[],[with_xen_proxy=auto])
AC_MSG_CHECKING([if Xen setuid proxy is needed])
@@ -915,13 +915,13 @@
fi
AC_MSG_RESULT([$with_xen_proxy])
-AM_CONDITIONAL(WITH_PROXY,[test "$with_xen_proxy" = "yes"])
+AM_CONDITIONAL([WITH_PROXY],[test "$with_xen_proxy" = "yes"])
if test "$with_xen_proxy" = "yes"; then
- AC_DEFINE(WITH_PROXY, 1, [Whether Xen proxy is enabled])
+ AC_DEFINE([WITH_PROXY], 1, [Whether Xen proxy is enabled])
fi
dnl Enable building libvirtd?
-AM_CONDITIONAL(WITH_LIBVIRTD,[test "x$with_libvirtd" = "xyes"])
+AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
dnl Check for gettext
AM_GNU_GETTEXT_VERSION([0.14.1])
@@ -952,10 +952,10 @@
MINGW_EXTRA_LDFLAGS="-no-undefined"
;;
esac
-AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
-AC_SUBST(CYGWIN_EXTRA_LIBADD)
-AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
-AC_SUBST(MINGW_EXTRA_LDFLAGS)
+AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
+AC_SUBST([CYGWIN_EXTRA_LIBADD])
+AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD])
+AC_SUBST([MINGW_EXTRA_LDFLAGS])
AC_SYS_LARGEFILE
@@ -964,7 +964,7 @@
# in which .o files will be created.
test "$enable_shared" = no && lt_cv_objdir=.
LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
-AC_SUBST(LV_LIBTOOL_OBJDIR)
+AC_SUBST([LV_LIBTOOL_OBJDIR])
# very annoying
rm -f COPYING
--
|: 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 :|
16 years, 6 months
[libvirt] PATCH: Add NUMA info to QEMU driver
by Daniel P. Berrange
This patch includes NUMA topology info in the QEMU driver capabilities
XML output. It also implements the free memory driver APIs. This is done
with the LGPL'd numactl library. The configure script probes for it and
only enables this functionality if it is found. The numactl library has
been around for quite a while - RHEL-3 vintage at least
configure.in | 39 ++++++++++++++++++++++++++++++
libvirt.spec.in | 3 ++
src/Makefile.am | 2 +
src/qemu_conf.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/qemu_driver.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 178 insertions(+)
Regards,
Daniel
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.64
diff -u -p -r1.64 qemu_conf.c
--- src/qemu_conf.c 15 May 2008 20:07:34 -0000 1.64
+++ src/qemu_conf.c 15 May 2008 21:07:42 -0000
@@ -42,6 +42,10 @@
#include <libxml/xpath.h>
#include <libxml/uri.h>
+#if HAVE_NUMACTL
+#include <numa.h>
+#endif
+
#include "libvirt/virterror.h"
#include "qemu_conf.h"
@@ -49,6 +53,7 @@
#include "buf.h"
#include "conf.h"
#include "util.h"
+#include "memory.h"
#include <verify.h>
#define qemudLog(level, msg...) fprintf(stderr, msg)
@@ -389,6 +394,67 @@ qemudCapsInitGuest(virCapsPtr caps,
return 0;
}
+#if HAVE_NUMACTL
+#define MAX_CPUS 4096
+#define MAX_CPUS_MASK_SIZE (sizeof(unsigned long))
+#define MAX_CPUS_MASK_LEN (MAX_CPUS / MAX_CPUS_MASK_SIZE)
+#define MAX_CPUS_MASK_BYTES (MAX_CPUS / 8)
+static int
+qemudCapsInitNUMA(virCapsPtr caps)
+{
+ int n, i;
+ unsigned long *mask = NULL;
+ int ncpus;
+ int *cpus = NULL;
+ int ret = -1;
+
+ fprintf(stderr, "Add numa\n");
+
+ if (numa_available() < 0)
+ return 0;
+
+ fprintf(stderr, "Start\n");
+ if (VIR_ALLOC_N(mask, MAX_CPUS_MASK_LEN) < 0)
+ goto cleanup;
+
+ for (n = 0 ; n <= numa_max_node() ; n++) {
+ fprintf(stderr, "Do node %d\n", n);
+
+ if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_BYTES) < 0)
+ goto cleanup;
+
+ for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++)
+ if ((mask[(i / MAX_CPUS_MASK_SIZE)] >> (i % MAX_CPUS_MASK_SIZE)) & 1)
+ ncpus++;
+
+ if (VIR_ALLOC_N(cpus, ncpus) < 0)
+ goto cleanup;
+
+ for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++)
+ if ((mask[(i / MAX_CPUS_MASK_SIZE)] >> (i % MAX_CPUS_MASK_SIZE)) & 1)
+ cpus[ncpus++] = i;
+
+ fprintf(stderr, "Do node %d %d\n", n, ncpus);
+ if (virCapabilitiesAddHostNUMACell(caps,
+ n,
+ ncpus,
+ cpus) < 0)
+ goto cleanup;
+
+ VIR_FREE(cpus);
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(cpus);
+ VIR_FREE(mask);
+ return ret;
+}
+#else
+static int qemudCapsInitNUMA(virCapsPtr caps ATTRIBUTE_UNUSED) { return 0; }
+#endif
+
virCapsPtr qemudCapsInit(void) {
struct utsname utsname;
virCapsPtr caps;
@@ -401,6 +467,9 @@ virCapsPtr qemudCapsInit(void) {
0, 0)) == NULL)
goto no_memory;
+ if (qemudCapsInitNUMA(caps) < 0)
+ goto no_memory;
+
for (i = 0 ; i < (sizeof(arch_info_hvm)/sizeof(arch_info_hvm[0])) ; i++)
if (qemudCapsInitGuest(caps,
utsname.machine,
Index: src/qemu_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.74
diff -u -p -r1.74 qemu_driver.c
--- src/qemu_driver.c 15 May 2008 16:11:40 -0000 1.74
+++ src/qemu_driver.c 15 May 2008 21:07:50 -0000
@@ -47,6 +47,10 @@
#include <sys/wait.h>
#include <libxml/uri.h>
+#if HAVE_NUMACTL
+#include <numa.h>
+#endif
+
#include "libvirt/virterror.h"
#include "event.h"
@@ -1605,6 +1609,62 @@ static char *qemudGetCapabilities(virCon
}
+#if HAVE_NUMACTL
+static int
+qemudNodeGetCellsFreeMemory(virConnectPtr conn,
+ unsigned long long *freeMems,
+ int startCell,
+ int maxCells)
+{
+ int n, lastCell, numCells;
+ fprintf(stderr, "Foo %d %d\n", startCell, maxCells);
+ if (numa_available() < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("NUMA not supported on this host"));
+ return -1;
+ }
+ lastCell = startCell + maxCells - 1;
+ if (lastCell > numa_max_node())
+ lastCell = numa_max_node();
+
+ for (numCells = 0, n = startCell ; n <= lastCell ; n++) {
+ long long mem;
+ if (numa_node_size64(n, &mem) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Failed to query NUMA free memory"));
+ return -1;
+ }
+ fprintf(stderr, "baro %d %llu\n", n, mem);
+ freeMems[numCells++] = mem;
+ }
+ return numCells;
+}
+
+static unsigned long long
+qemudNodeGetFreeMemory (virConnectPtr conn)
+{
+ unsigned long long freeMem = 0;
+ int n;
+ if (numa_available() < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("NUMA not supported on this host"));
+ return -1;
+ }
+
+ for (n = 0 ; n <= numa_max_node() ; n++) {
+ long long mem;
+ if (numa_node_size64(n, &mem) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Failed to query NUMA free memory"));
+ return -1;
+ }
+ freeMem += mem;
+ }
+
+ return freeMem;
+}
+
+#endif
static int qemudGetProcessInfo(unsigned long long *cpuTime, int pid) {
char proc[PATH_MAX];
@@ -3168,8 +3228,13 @@ static virDriver qemuDriver = {
NULL, /* domainMigrateFinish */
qemudDomainBlockStats, /* domainBlockStats */
qemudDomainInterfaceStats, /* domainInterfaceStats */
+#if HAVE_NUMACTL
+ qemudNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
+ qemudNodeGetFreeMemory, /* getFreeMemory */
+#else
NULL, /* nodeGetCellsFreeMemory */
NULL, /* getFreeMemory */
+#endif
};
static virNetworkDriver qemuNetworkDriver = {
Index: src/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/src/Makefile.am,v
retrieving revision 1.79
diff -u -p -r1.79 Makefile.am
--- src/Makefile.am 29 Apr 2008 15:38:13 -0000 1.79
+++ src/Makefile.am 15 May 2008 21:07:57 -0000
@@ -9,6 +9,7 @@ INCLUDES = \
$(GNUTLS_CFLAGS) \
$(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \
+ $(NUMACTL_CFLAGS) \
-DBINDIR=\""$(libexecdir)"\" \
-DSBINDIR=\""$(sbindir)"\" \
-DSYSCONF_DIR="\"$(sysconfdir)\"" \
@@ -100,6 +101,7 @@ endif
libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES)
libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) $(SELINUX_LIBS) \
+ $(NUMACTL_LIBS) \
@CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
-version-info @LIBVIRT_VERSION_INFO@ \
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.143
diff -u -p -r1.143 configure.in
--- configure.in 5 May 2008 19:58:56 -0000 1.143
+++ configure.in 15 May 2008 21:08:05 -0000
@@ -534,6 +534,40 @@ AM_CONDITIONAL(HAVE_SELINUX, [test "$wit
AC_SUBST(SELINUX_CFLAGS)
AC_SUBST(SELINUX_LIBS)
+dnl NUMA lib
+AC_ARG_WITH(numactl,
+ [ --with-numactl use numactl for host topology info],
+ [],
+ [with_numactl=check])
+
+NUMACTL_CFLAGS=
+NUMACTL_LIBS=
+if test "$with_qemu" = "yes" -a "$with_numactl" != "no"; then
+ old_cflags="$CFLAGS"
+ old_libs="$LIBS"
+ if test "$with_numactl" = "check"; then
+ AC_CHECK_HEADER([numa.h],[],[with_numactl=no])
+ AC_CHECK_LIB(numa, numa_available,[],[with_numactl=no])
+ if test "$with_numactl" != "no"; then
+ with_numactl="yes"
+ fi
+ else
+ AC_CHECK_HEADER([numa.h],[],
+ [AC_MSG_ERROR([You must install the numactl development package in order to compile libvirt])])
+ AC_CHECK_LIB(numa, numa_available,[],
+ [AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])])
+ fi
+ CFLAGS="$old_cflags"
+ LIBS="$old_libs"
+fi
+if test "$with_numactl" = "yes"; then
+ NUMACTL_LIBS="-lnuma"
+ AC_DEFINE_UNQUOTED(HAVE_NUMACTL, 1, [whether Numactl is available for security])
+fi
+AM_CONDITIONAL(HAVE_NUMACTL, [test "$with_numactl" != "no"])
+AC_SUBST(NUMACTL_CFLAGS)
+AC_SUBST(NUMACTL_LIBS)
+
dnl virsh libraries
AC_CHECK_HEADERS([readline/readline.h])
@@ -1001,6 +1035,11 @@ AC_MSG_NOTICE([ selinux: $SELINUX_CFLAG
else
AC_MSG_NOTICE([ selinux: no])
fi
+if test "$with_numactl" = "yes" ; then
+AC_MSG_NOTICE([ numactl: $NUMACTL_CFLAGS $NUMACTL_LIBS])
+else
+AC_MSG_NOTICE([ numactl: no])
+fi
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Miscellaneous])
AC_MSG_NOTICE([])
Index: libvirt.spec.in
===================================================================
RCS file: /data/cvs/libvirt/libvirt.spec.in,v
retrieving revision 1.83
diff -u -p -r1.83 libvirt.spec.in
--- libvirt.spec.in 8 Apr 2008 16:45:57 -0000 1.83
+++ libvirt.spec.in 15 May 2008 21:08:14 -0000
@@ -67,6 +67,9 @@ BuildRequires: dnsmasq
BuildRequires: bridge-utils
BuildRequires: qemu
BuildRequires: cyrus-sasl-devel
+%if %{with_qemu}
+BuildRequires: numactl-devel
+%endif
%if %{with_polkit}
BuildRequires: PolicyKit-devel >= 0.6
%endif
--
|: 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 :|
16 years, 6 months
[libvirt] PATCH: Add NUMA apis to remote driver
by Daniel P. Berrange
For some reason the virNodeGetFreeMemroy and virNodeGetCellsFreeMemory
NUMA APIs were never added to the remote driver. THis patch fixes that.
It also updates the 2 perl scripts which post-process the RPC files to
not insert TABs, since we'd previously removed them from all the generated
files. Finally, the remote_protocol.x has TAB -> SPACE conversion since
we missed that first time around
qemud/remote.c | 47 +
qemud/remote_dispatch_localvars.h | 3
qemud/remote_dispatch_proc_switch.h | 15
qemud/remote_dispatch_prototypes.h | 2
qemud/remote_generate_stubs.pl | 20
qemud/remote_protocol.c | 30 +
qemud/remote_protocol.h | 918 ++++++++++++++++++------------------
qemud/remote_protocol.x | 21
qemud/rpcgen_fix.pl | 4
src/remote_internal.c | 55 ++
10 files changed, 657 insertions(+), 458 deletions(-)
Regards,
Daniel
Index: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.74
diff -u -p -r1.74 remote_internal.c
--- src/remote_internal.c 15 May 2008 14:21:34 -0000 1.74
+++ src/remote_internal.c 15 May 2008 21:07:22 -0000
@@ -1329,6 +1329,58 @@ remoteGetCapabilities (virConnectPtr con
}
static int
+remoteNodeGetCellsFreeMemory(virConnectPtr conn,
+ unsigned long long *freeMems,
+ int startCell,
+ int maxCells)
+{
+ remote_node_get_cells_free_memory_args args;
+ remote_node_get_cells_free_memory_ret ret;
+ int i;
+ GET_PRIVATE (conn, -1);
+
+ if (maxCells > REMOTE_NODE_MAX_CELLS) {
+ errorf (conn, VIR_ERR_RPC,
+ _("too many NUMA cells: %d > %d"),
+ maxCells,
+ REMOTE_NODE_MAX_CELLS);
+ return -1;
+ }
+
+ args.startCell = startCell;
+ args.maxCells = maxCells;
+
+ memset (&ret, 0, sizeof ret);
+ if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY,
+ (xdrproc_t) xdr_remote_node_get_cells_free_memory_args, (char *)&args,
+ (xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *)&ret) == -1)
+ return -1;
+
+ for (i = 0 ; i < ret.freeMems.freeMems_len ; i++)
+ freeMems[i] = ret.freeMems.freeMems_val[i];
+
+ xdr_free((xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *) &ret);
+
+ return ret.freeMems.freeMems_len;
+}
+
+static unsigned long long
+remoteNodeGetFreeMemory (virConnectPtr conn)
+{
+ remote_node_get_free_memory_ret ret;
+ GET_PRIVATE (conn, -1);
+
+ memset (&ret, 0, sizeof ret);
+ if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_FREE_MEMORY,
+ (xdrproc_t) xdr_void, NULL,
+ (xdrproc_t) xdr_remote_node_get_free_memory_ret, (char *)&ret) == -1)
+ return 0;
+
+ return ret.freeMem;
+}
+
+
+static int
remoteListDomains (virConnectPtr conn, int *ids, int maxids)
{
int i;
@@ -4728,7 +4780,8 @@ static virDriver driver = {
.domainMigrateFinish = remoteDomainMigrateFinish,
.domainBlockStats = remoteDomainBlockStats,
.domainInterfaceStats = remoteDomainInterfaceStats,
- .nodeGetCellsFreeMemory = NULL,
+ .nodeGetCellsFreeMemory = remoteNodeGetCellsFreeMemory,
+ .getFreeMemory = remoteNodeGetFreeMemory,
};
static virNetworkDriver network_driver = {
Index: qemud/remote.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote.c,v
retrieving revision 1.31
diff -u -p -r1.31 remote.c
--- qemud/remote.c 15 May 2008 06:12:32 -0000 1.31
+++ qemud/remote.c 15 May 2008 21:07:31 -0000
@@ -596,6 +596,53 @@ remoteDispatchGetCapabilities (struct qe
}
static int
+remoteDispatchNodeGetCellsFreeMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client,
+ remote_message_header *req,
+ remote_node_get_cells_free_memory_args *args,
+ remote_node_get_cells_free_memory_ret *ret)
+{
+ CHECK_CONN(client);
+
+ if (args->maxCells > REMOTE_NODE_MAX_CELLS) {
+ remoteDispatchError (client, req,
+ "%s", _("maxCells > REMOTE_NODE_MAX_CELLS"));
+ return -2;
+ }
+
+ /* Allocate return buffer. */
+ ret->freeMems.freeMems_val = calloc (args->maxCells, sizeof (*(ret->freeMems.freeMems_val)));
+
+ ret->freeMems.freeMems_len = virNodeGetCellsFreeMemory(client->conn,
+ (unsigned long long *)ret->freeMems.freeMems_val,
+ args->startCell,
+ args->maxCells);
+ if (ret->freeMems.freeMems_len == 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int
+remoteDispatchNodeGetFreeMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client,
+ remote_message_header *req,
+ void *args ATTRIBUTE_UNUSED,
+ remote_node_get_free_memory_ret *ret)
+{
+ unsigned long long freeMem;
+ CHECK_CONN(client);
+
+ freeMem = virNodeGetFreeMemory(client->conn);
+ if (freeMem == 0) return -1;
+
+ ret->freeMem = freeMem;
+ return 0;
+}
+
+
+static int
remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
remote_message_header *req,
Index: qemud/remote_dispatch_localvars.h
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_dispatch_localvars.h,v
retrieving revision 1.9
diff -u -p -r1.9 remote_dispatch_localvars.h
--- qemud/remote_dispatch_localvars.h 20 Feb 2008 15:22:35 -0000 1.9
+++ qemud/remote_dispatch_localvars.h 15 May 2008 21:07:31 -0000
@@ -98,6 +98,8 @@ remote_domain_save_args lv_remote_domain
remote_domain_migrate_prepare_args lv_remote_domain_migrate_prepare_args;
remote_domain_migrate_prepare_ret lv_remote_domain_migrate_prepare_ret;
remote_domain_undefine_args lv_remote_domain_undefine_args;
+remote_node_get_cells_free_memory_args lv_remote_node_get_cells_free_memory_args;
+remote_node_get_cells_free_memory_ret lv_remote_node_get_cells_free_memory_ret;
remote_domain_get_scheduler_type_args lv_remote_domain_get_scheduler_type_args;
remote_domain_get_scheduler_type_ret lv_remote_domain_get_scheduler_type_ret;
remote_get_version_ret lv_remote_get_version_ret;
@@ -122,6 +124,7 @@ remote_storage_pool_undefine_args lv_rem
remote_domain_set_autostart_args lv_remote_domain_set_autostart_args;
remote_storage_pool_get_autostart_args lv_remote_storage_pool_get_autostart_args;
remote_storage_pool_get_autostart_ret lv_remote_storage_pool_get_autostart_ret;
+remote_node_get_free_memory_ret lv_remote_node_get_free_memory_ret;
remote_storage_vol_get_path_args lv_remote_storage_vol_get_path_args;
remote_storage_vol_get_path_ret lv_remote_storage_vol_get_path_ret;
remote_domain_lookup_by_id_args lv_remote_domain_lookup_by_id_args;
Index: qemud/remote_dispatch_proc_switch.h
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_dispatch_proc_switch.h,v
retrieving revision 1.10
diff -u -p -r1.10 remote_dispatch_proc_switch.h
--- qemud/remote_dispatch_proc_switch.h 10 Apr 2008 16:54:54 -0000 1.10
+++ qemud/remote_dispatch_proc_switch.h 15 May 2008 21:07:31 -0000
@@ -491,6 +491,21 @@ case REMOTE_PROC_NETWORK_UNDEFINE:
args = (char *) &lv_remote_network_undefine_args;
memset (&lv_remote_network_undefine_args, 0, sizeof lv_remote_network_undefine_args);
break;
+case REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY:
+ fn = (dispatch_fn) remoteDispatchNodeGetCellsFreeMemory;
+ args_filter = (xdrproc_t) xdr_remote_node_get_cells_free_memory_args;
+ args = (char *) &lv_remote_node_get_cells_free_memory_args;
+ memset (&lv_remote_node_get_cells_free_memory_args, 0, sizeof lv_remote_node_get_cells_free_memory_args);
+ ret_filter = (xdrproc_t) xdr_remote_node_get_cells_free_memory_ret;
+ ret = (char *) &lv_remote_node_get_cells_free_memory_ret;
+ memset (&lv_remote_node_get_cells_free_memory_ret, 0, sizeof lv_remote_node_get_cells_free_memory_ret);
+ break;
+case REMOTE_PROC_NODE_GET_FREE_MEMORY:
+ fn = (dispatch_fn) remoteDispatchNodeGetFreeMemory;
+ ret_filter = (xdrproc_t) xdr_remote_node_get_free_memory_ret;
+ ret = (char *) &lv_remote_node_get_free_memory_ret;
+ memset (&lv_remote_node_get_free_memory_ret, 0, sizeof lv_remote_node_get_free_memory_ret);
+ break;
case REMOTE_PROC_NODE_GET_INFO:
fn = (dispatch_fn) remoteDispatchNodeGetInfo;
ret_filter = (xdrproc_t) xdr_remote_node_get_info_ret;
Index: qemud/remote_dispatch_prototypes.h
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_dispatch_prototypes.h,v
retrieving revision 1.10
diff -u -p -r1.10 remote_dispatch_prototypes.h
--- qemud/remote_dispatch_prototypes.h 20 Feb 2008 15:22:35 -0000 1.10
+++ qemud/remote_dispatch_prototypes.h 15 May 2008 21:07:31 -0000
@@ -67,6 +67,8 @@ static int remoteDispatchNetworkLookupBy
static int remoteDispatchNetworkLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_lookup_by_uuid_args *args, remote_network_lookup_by_uuid_ret *ret);
static int remoteDispatchNetworkSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_set_autostart_args *args, void *ret);
static int remoteDispatchNetworkUndefine (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_undefine_args *args, void *ret);
+static int remoteDispatchNodeGetCellsFreeMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_node_get_cells_free_memory_args *args, remote_node_get_cells_free_memory_ret *ret);
+static int remoteDispatchNodeGetFreeMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_node_get_free_memory_ret *ret);
static int remoteDispatchNodeGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_node_get_info_ret *ret);
static int remoteDispatchNumOfDefinedDomains (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_defined_domains_ret *ret);
static int remoteDispatchNumOfDefinedNetworks (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_defined_networks_ret *ret);
Index: qemud/remote_generate_stubs.pl
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_generate_stubs.pl,v
retrieving revision 1.2
diff -u -p -r1.2 remote_generate_stubs.pl
--- qemud/remote_generate_stubs.pl 5 Dec 2007 15:34:05 -0000 1.2
+++ qemud/remote_generate_stubs.pl 15 May 2008 21:07:31 -0000
@@ -84,8 +84,8 @@ if ($opt_d) {
my @keys = sort (keys %calls);
foreach (@keys) {
print "$_:\n";
- print "\tname $calls{$_}->{name} ($calls{$_}->{ProcName})\n";
- print "\t$calls{$_}->{args} -> $calls{$_}->{ret}\n";
+ print " name $calls{$_}->{name} ($calls{$_}->{ProcName})\n";
+ print " $calls{$_}->{args} -> $calls{$_}->{ret}\n";
}
}
@@ -117,18 +117,18 @@ elsif ($opt_w) {
my @keys = sort (keys %calls);
foreach (@keys) {
print "case REMOTE_PROC_$calls{$_}->{UC_NAME}:\n";
- print "\tfn = (dispatch_fn) remoteDispatch$calls{$_}->{ProcName};\n";
+ print " fn = (dispatch_fn) remoteDispatch$calls{$_}->{ProcName};\n";
if ($calls{$_}->{args} ne "void") {
- print "\targs_filter = (xdrproc_t) xdr_$calls{$_}->{args};\n";
- print "\targs = (char *) &lv_$calls{$_}->{args};\n";
- print "\tmemset (&lv_$calls{$_}->{args}, 0, sizeof lv_$calls{$_}->{args});\n"
+ print " args_filter = (xdrproc_t) xdr_$calls{$_}->{args};\n";
+ print " args = (char *) &lv_$calls{$_}->{args};\n";
+ print " memset (&lv_$calls{$_}->{args}, 0, sizeof lv_$calls{$_}->{args});\n"
}
if ($calls{$_}->{ret} ne "void") {
- print "\tret_filter = (xdrproc_t) xdr_$calls{$_}->{ret};\n";
- print "\tret = (char *) &lv_$calls{$_}->{ret};\n";
- print "\tmemset (&lv_$calls{$_}->{ret}, 0, sizeof lv_$calls{$_}->{ret});\n"
+ print " ret_filter = (xdrproc_t) xdr_$calls{$_}->{ret};\n";
+ print " ret = (char *) &lv_$calls{$_}->{ret};\n";
+ print " memset (&lv_$calls{$_}->{ret}, 0, sizeof lv_$calls{$_}->{ret});\n"
}
- print "\tbreak;\n";
+ print " break;\n";
}
}
Index: qemud/remote_protocol.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_protocol.c,v
retrieving revision 1.10
diff -u -p -r1.10 remote_protocol.c
--- qemud/remote_protocol.c 10 Apr 2008 16:54:54 -0000 1.10
+++ qemud/remote_protocol.c 15 May 2008 21:07:31 -0000
@@ -387,6 +387,36 @@ xdr_remote_get_capabilities_ret (XDR *xd
}
bool_t
+xdr_remote_node_get_cells_free_memory_args (XDR *xdrs, remote_node_get_cells_free_memory_args *objp)
+{
+
+ if (!xdr_int (xdrs, &objp->startCell))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->maxCells))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_remote_node_get_cells_free_memory_ret (XDR *xdrs, remote_node_get_cells_free_memory_ret *objp)
+{
+
+ if (!xdr_array (xdrs, (char **)&objp->freeMems.freeMems_val, (u_int *) &objp->freeMems.freeMems_len, REMOTE_NODE_MAX_CELLS,
+ sizeof (quad_t), (xdrproc_t) xdr_quad_t))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_remote_node_get_free_memory_ret (XDR *xdrs, remote_node_get_free_memory_ret *objp)
+{
+
+ if (!xdr_quad_t (xdrs, &objp->freeMem))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_remote_domain_get_scheduler_type_args (XDR *xdrs, remote_domain_get_scheduler_type_args *objp)
{
Index: qemud/remote_protocol.h
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_protocol.h,v
retrieving revision 1.11
diff -u -p -r1.11 remote_protocol.h
--- qemud/remote_protocol.h 10 Apr 2008 16:54:54 -0000 1.11
+++ qemud/remote_protocol.h 15 May 2008 21:07:31 -0000
@@ -30,34 +30,35 @@ typedef remote_nonnull_string *remote_st
#define REMOTE_STORAGE_POOL_NAME_LIST_MAX 256
#define REMOTE_STORAGE_VOL_NAME_LIST_MAX 1024
#define REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX 16
+#define REMOTE_NODE_MAX_CELLS 1024
#define REMOTE_AUTH_SASL_DATA_MAX 65536
#define REMOTE_AUTH_TYPE_LIST_MAX 20
typedef char remote_uuid[VIR_UUID_BUFLEN];
struct remote_nonnull_domain {
- remote_nonnull_string name;
- remote_uuid uuid;
- int id;
+ remote_nonnull_string name;
+ remote_uuid uuid;
+ int id;
};
typedef struct remote_nonnull_domain remote_nonnull_domain;
struct remote_nonnull_network {
- remote_nonnull_string name;
- remote_uuid uuid;
+ remote_nonnull_string name;
+ remote_uuid uuid;
};
typedef struct remote_nonnull_network remote_nonnull_network;
struct remote_nonnull_storage_pool {
- remote_nonnull_string name;
- remote_uuid uuid;
+ remote_nonnull_string name;
+ remote_uuid uuid;
};
typedef struct remote_nonnull_storage_pool remote_nonnull_storage_pool;
struct remote_nonnull_storage_vol {
- remote_nonnull_string pool;
- remote_nonnull_string name;
- remote_nonnull_string key;
+ remote_nonnull_string pool;
+ remote_nonnull_string name;
+ remote_nonnull_string key;
};
typedef struct remote_nonnull_storage_vol remote_nonnull_storage_vol;
@@ -70,1076 +71,1097 @@ typedef remote_nonnull_storage_pool *rem
typedef remote_nonnull_storage_vol *remote_storage_vol;
struct remote_error {
- int code;
- int domain;
- remote_string message;
- int level;
- remote_domain dom;
- remote_string str1;
- remote_string str2;
- remote_string str3;
- int int1;
- int int2;
- remote_network net;
+ int code;
+ int domain;
+ remote_string message;
+ int level;
+ remote_domain dom;
+ remote_string str1;
+ remote_string str2;
+ remote_string str3;
+ int int1;
+ int int2;
+ remote_network net;
};
typedef struct remote_error remote_error;
enum remote_auth_type {
- REMOTE_AUTH_NONE = 0,
- REMOTE_AUTH_SASL = 1,
- REMOTE_AUTH_POLKIT = 2,
+ REMOTE_AUTH_NONE = 0,
+ REMOTE_AUTH_SASL = 1,
+ REMOTE_AUTH_POLKIT = 2,
};
typedef enum remote_auth_type remote_auth_type;
struct remote_vcpu_info {
- u_int number;
- int state;
- u_quad_t cpu_time;
- int cpu;
+ u_int number;
+ int state;
+ u_quad_t cpu_time;
+ int cpu;
};
typedef struct remote_vcpu_info remote_vcpu_info;
struct remote_sched_param_value {
- int type;
- union {
- int i;
- u_int ui;
- quad_t l;
- u_quad_t ul;
- double d;
- int b;
- } remote_sched_param_value_u;
+ int type;
+ union {
+ int i;
+ u_int ui;
+ quad_t l;
+ u_quad_t ul;
+ double d;
+ int b;
+ } remote_sched_param_value_u;
};
typedef struct remote_sched_param_value remote_sched_param_value;
struct remote_sched_param {
- remote_nonnull_string field;
- remote_sched_param_value value;
+ remote_nonnull_string field;
+ remote_sched_param_value value;
};
typedef struct remote_sched_param remote_sched_param;
struct remote_open_args {
- remote_string name;
- int flags;
+ remote_string name;
+ int flags;
};
typedef struct remote_open_args remote_open_args;
struct remote_supports_feature_args {
- int feature;
+ int feature;
};
typedef struct remote_supports_feature_args remote_supports_feature_args;
struct remote_supports_feature_ret {
- int supported;
+ int supported;
};
typedef struct remote_supports_feature_ret remote_supports_feature_ret;
struct remote_get_type_ret {
- remote_nonnull_string type;
+ remote_nonnull_string type;
};
typedef struct remote_get_type_ret remote_get_type_ret;
struct remote_get_version_ret {
- quad_t hv_ver;
+ quad_t hv_ver;
};
typedef struct remote_get_version_ret remote_get_version_ret;
struct remote_get_hostname_ret {
- remote_nonnull_string hostname;
+ remote_nonnull_string hostname;
};
typedef struct remote_get_hostname_ret remote_get_hostname_ret;
struct remote_get_max_vcpus_args {
- remote_string type;
+ remote_string type;
};
typedef struct remote_get_max_vcpus_args remote_get_max_vcpus_args;
struct remote_get_max_vcpus_ret {
- int max_vcpus;
+ int max_vcpus;
};
typedef struct remote_get_max_vcpus_ret remote_get_max_vcpus_ret;
struct remote_node_get_info_ret {
- char model[32];
- quad_t memory;
- int cpus;
- int mhz;
- int nodes;
- int sockets;
- int cores;
- int threads;
+ char model[32];
+ quad_t memory;
+ int cpus;
+ int mhz;
+ int nodes;
+ int sockets;
+ int cores;
+ int threads;
};
typedef struct remote_node_get_info_ret remote_node_get_info_ret;
struct remote_get_capabilities_ret {
- remote_nonnull_string capabilities;
+ remote_nonnull_string capabilities;
};
typedef struct remote_get_capabilities_ret remote_get_capabilities_ret;
+struct remote_node_get_cells_free_memory_args {
+ int startCell;
+ int maxCells;
+};
+typedef struct remote_node_get_cells_free_memory_args remote_node_get_cells_free_memory_args;
+
+struct remote_node_get_cells_free_memory_ret {
+ struct {
+ u_int freeMems_len;
+ quad_t *freeMems_val;
+ } freeMems;
+};
+typedef struct remote_node_get_cells_free_memory_ret remote_node_get_cells_free_memory_ret;
+
+struct remote_node_get_free_memory_ret {
+ quad_t freeMem;
+};
+typedef struct remote_node_get_free_memory_ret remote_node_get_free_memory_ret;
+
struct remote_domain_get_scheduler_type_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_get_scheduler_type_args remote_domain_get_scheduler_type_args;
struct remote_domain_get_scheduler_type_ret {
- remote_nonnull_string type;
- int nparams;
+ remote_nonnull_string type;
+ int nparams;
};
typedef struct remote_domain_get_scheduler_type_ret remote_domain_get_scheduler_type_ret;
struct remote_domain_get_scheduler_parameters_args {
- remote_nonnull_domain dom;
- int nparams;
+ remote_nonnull_domain dom;
+ int nparams;
};
typedef struct remote_domain_get_scheduler_parameters_args remote_domain_get_scheduler_parameters_args;
struct remote_domain_get_scheduler_parameters_ret {
- struct {
- u_int params_len;
- remote_sched_param *params_val;
- } params;
+ struct {
+ u_int params_len;
+ remote_sched_param *params_val;
+ } params;
};
typedef struct remote_domain_get_scheduler_parameters_ret remote_domain_get_scheduler_parameters_ret;
struct remote_domain_set_scheduler_parameters_args {
- remote_nonnull_domain dom;
- struct {
- u_int params_len;
- remote_sched_param *params_val;
- } params;
+ remote_nonnull_domain dom;
+ struct {
+ u_int params_len;
+ remote_sched_param *params_val;
+ } params;
};
typedef struct remote_domain_set_scheduler_parameters_args remote_domain_set_scheduler_parameters_args;
struct remote_domain_block_stats_args {
- remote_nonnull_domain dom;
- remote_nonnull_string path;
+ remote_nonnull_domain dom;
+ remote_nonnull_string path;
};
typedef struct remote_domain_block_stats_args remote_domain_block_stats_args;
struct remote_domain_block_stats_ret {
- quad_t rd_req;
- quad_t rd_bytes;
- quad_t wr_req;
- quad_t wr_bytes;
- quad_t errs;
+ quad_t rd_req;
+ quad_t rd_bytes;
+ quad_t wr_req;
+ quad_t wr_bytes;
+ quad_t errs;
};
typedef struct remote_domain_block_stats_ret remote_domain_block_stats_ret;
struct remote_domain_interface_stats_args {
- remote_nonnull_domain dom;
- remote_nonnull_string path;
+ remote_nonnull_domain dom;
+ remote_nonnull_string path;
};
typedef struct remote_domain_interface_stats_args remote_domain_interface_stats_args;
struct remote_domain_interface_stats_ret {
- quad_t rx_bytes;
- quad_t rx_packets;
- quad_t rx_errs;
- quad_t rx_drop;
- quad_t tx_bytes;
- quad_t tx_packets;
- quad_t tx_errs;
- quad_t tx_drop;
+ quad_t rx_bytes;
+ quad_t rx_packets;
+ quad_t rx_errs;
+ quad_t rx_drop;
+ quad_t tx_bytes;
+ quad_t tx_packets;
+ quad_t tx_errs;
+ quad_t tx_drop;
};
typedef struct remote_domain_interface_stats_ret remote_domain_interface_stats_ret;
struct remote_list_domains_args {
- int maxids;
+ int maxids;
};
typedef struct remote_list_domains_args remote_list_domains_args;
struct remote_list_domains_ret {
- struct {
- u_int ids_len;
- int *ids_val;
- } ids;
+ struct {
+ u_int ids_len;
+ int *ids_val;
+ } ids;
};
typedef struct remote_list_domains_ret remote_list_domains_ret;
struct remote_num_of_domains_ret {
- int num;
+ int num;
};
typedef struct remote_num_of_domains_ret remote_num_of_domains_ret;
struct remote_domain_create_linux_args {
- remote_nonnull_string xml_desc;
- int flags;
+ remote_nonnull_string xml_desc;
+ int flags;
};
typedef struct remote_domain_create_linux_args remote_domain_create_linux_args;
struct remote_domain_create_linux_ret {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_create_linux_ret remote_domain_create_linux_ret;
struct remote_domain_lookup_by_id_args {
- int id;
+ int id;
};
typedef struct remote_domain_lookup_by_id_args remote_domain_lookup_by_id_args;
struct remote_domain_lookup_by_id_ret {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_lookup_by_id_ret remote_domain_lookup_by_id_ret;
struct remote_domain_lookup_by_uuid_args {
- remote_uuid uuid;
+ remote_uuid uuid;
};
typedef struct remote_domain_lookup_by_uuid_args remote_domain_lookup_by_uuid_args;
struct remote_domain_lookup_by_uuid_ret {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_lookup_by_uuid_ret remote_domain_lookup_by_uuid_ret;
struct remote_domain_lookup_by_name_args {
- remote_nonnull_string name;
+ remote_nonnull_string name;
};
typedef struct remote_domain_lookup_by_name_args remote_domain_lookup_by_name_args;
struct remote_domain_lookup_by_name_ret {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_lookup_by_name_ret remote_domain_lookup_by_name_ret;
struct remote_domain_suspend_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_suspend_args remote_domain_suspend_args;
struct remote_domain_resume_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_resume_args remote_domain_resume_args;
struct remote_domain_shutdown_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_shutdown_args remote_domain_shutdown_args;
struct remote_domain_reboot_args {
- remote_nonnull_domain dom;
- int flags;
+ remote_nonnull_domain dom;
+ int flags;
};
typedef struct remote_domain_reboot_args remote_domain_reboot_args;
struct remote_domain_destroy_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_destroy_args remote_domain_destroy_args;
struct remote_domain_get_os_type_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_get_os_type_args remote_domain_get_os_type_args;
struct remote_domain_get_os_type_ret {
- remote_nonnull_string type;
+ remote_nonnull_string type;
};
typedef struct remote_domain_get_os_type_ret remote_domain_get_os_type_ret;
struct remote_domain_get_max_memory_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_get_max_memory_args remote_domain_get_max_memory_args;
struct remote_domain_get_max_memory_ret {
- u_quad_t memory;
+ u_quad_t memory;
};
typedef struct remote_domain_get_max_memory_ret remote_domain_get_max_memory_ret;
struct remote_domain_set_max_memory_args {
- remote_nonnull_domain dom;
- u_quad_t memory;
+ remote_nonnull_domain dom;
+ u_quad_t memory;
};
typedef struct remote_domain_set_max_memory_args remote_domain_set_max_memory_args;
struct remote_domain_set_memory_args {
- remote_nonnull_domain dom;
- u_quad_t memory;
+ remote_nonnull_domain dom;
+ u_quad_t memory;
};
typedef struct remote_domain_set_memory_args remote_domain_set_memory_args;
struct remote_domain_get_info_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_get_info_args remote_domain_get_info_args;
struct remote_domain_get_info_ret {
- u_char state;
- u_quad_t max_mem;
- u_quad_t memory;
- u_short nr_virt_cpu;
- u_quad_t cpu_time;
+ u_char state;
+ u_quad_t max_mem;
+ u_quad_t memory;
+ u_short nr_virt_cpu;
+ u_quad_t cpu_time;
};
typedef struct remote_domain_get_info_ret remote_domain_get_info_ret;
struct remote_domain_save_args {
- remote_nonnull_domain dom;
- remote_nonnull_string to;
+ remote_nonnull_domain dom;
+ remote_nonnull_string to;
};
typedef struct remote_domain_save_args remote_domain_save_args;
struct remote_domain_restore_args {
- remote_nonnull_string from;
+ remote_nonnull_string from;
};
typedef struct remote_domain_restore_args remote_domain_restore_args;
struct remote_domain_core_dump_args {
- remote_nonnull_domain dom;
- remote_nonnull_string to;
- int flags;
+ remote_nonnull_domain dom;
+ remote_nonnull_string to;
+ int flags;
};
typedef struct remote_domain_core_dump_args remote_domain_core_dump_args;
struct remote_domain_dump_xml_args {
- remote_nonnull_domain dom;
- int flags;
+ remote_nonnull_domain dom;
+ int flags;
};
typedef struct remote_domain_dump_xml_args remote_domain_dump_xml_args;
struct remote_domain_dump_xml_ret {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_domain_dump_xml_ret remote_domain_dump_xml_ret;
struct remote_domain_migrate_prepare_args {
- remote_string uri_in;
- u_quad_t flags;
- remote_string dname;
- u_quad_t resource;
+ remote_string uri_in;
+ u_quad_t flags;
+ remote_string dname;
+ u_quad_t resource;
};
typedef struct remote_domain_migrate_prepare_args remote_domain_migrate_prepare_args;
struct remote_domain_migrate_prepare_ret {
- struct {
- u_int cookie_len;
- char *cookie_val;
- } cookie;
- remote_string uri_out;
+ struct {
+ u_int cookie_len;
+ char *cookie_val;
+ } cookie;
+ remote_string uri_out;
};
typedef struct remote_domain_migrate_prepare_ret remote_domain_migrate_prepare_ret;
struct remote_domain_migrate_perform_args {
- remote_nonnull_domain dom;
- struct {
- u_int cookie_len;
- char *cookie_val;
- } cookie;
- remote_nonnull_string uri;
- u_quad_t flags;
- remote_string dname;
- u_quad_t resource;
+ remote_nonnull_domain dom;
+ struct {
+ u_int cookie_len;
+ char *cookie_val;
+ } cookie;
+ remote_nonnull_string uri;
+ u_quad_t flags;
+ remote_string dname;
+ u_quad_t resource;
};
typedef struct remote_domain_migrate_perform_args remote_domain_migrate_perform_args;
struct remote_domain_migrate_finish_args {
- remote_nonnull_string dname;
- struct {
- u_int cookie_len;
- char *cookie_val;
- } cookie;
- remote_nonnull_string uri;
- u_quad_t flags;
+ remote_nonnull_string dname;
+ struct {
+ u_int cookie_len;
+ char *cookie_val;
+ } cookie;
+ remote_nonnull_string uri;
+ u_quad_t flags;
};
typedef struct remote_domain_migrate_finish_args remote_domain_migrate_finish_args;
struct remote_domain_migrate_finish_ret {
- remote_nonnull_domain ddom;
+ remote_nonnull_domain ddom;
};
typedef struct remote_domain_migrate_finish_ret remote_domain_migrate_finish_ret;
struct remote_list_defined_domains_args {
- int maxnames;
+ int maxnames;
};
typedef struct remote_list_defined_domains_args remote_list_defined_domains_args;
struct remote_list_defined_domains_ret {
- struct {
- u_int names_len;
- remote_nonnull_string *names_val;
- } names;
+ struct {
+ u_int names_len;
+ remote_nonnull_string *names_val;
+ } names;
};
typedef struct remote_list_defined_domains_ret remote_list_defined_domains_ret;
struct remote_num_of_defined_domains_ret {
- int num;
+ int num;
};
typedef struct remote_num_of_defined_domains_ret remote_num_of_defined_domains_ret;
struct remote_domain_create_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_create_args remote_domain_create_args;
struct remote_domain_define_xml_args {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_domain_define_xml_args remote_domain_define_xml_args;
struct remote_domain_define_xml_ret {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_define_xml_ret remote_domain_define_xml_ret;
struct remote_domain_undefine_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_undefine_args remote_domain_undefine_args;
struct remote_domain_set_vcpus_args {
- remote_nonnull_domain dom;
- int nvcpus;
+ remote_nonnull_domain dom;
+ int nvcpus;
};
typedef struct remote_domain_set_vcpus_args remote_domain_set_vcpus_args;
struct remote_domain_pin_vcpu_args {
- remote_nonnull_domain dom;
- int vcpu;
- struct {
- u_int cpumap_len;
- char *cpumap_val;
- } cpumap;
+ remote_nonnull_domain dom;
+ int vcpu;
+ struct {
+ u_int cpumap_len;
+ char *cpumap_val;
+ } cpumap;
};
typedef struct remote_domain_pin_vcpu_args remote_domain_pin_vcpu_args;
struct remote_domain_get_vcpus_args {
- remote_nonnull_domain dom;
- int maxinfo;
- int maplen;
+ remote_nonnull_domain dom;
+ int maxinfo;
+ int maplen;
};
typedef struct remote_domain_get_vcpus_args remote_domain_get_vcpus_args;
struct remote_domain_get_vcpus_ret {
- struct {
- u_int info_len;
- remote_vcpu_info *info_val;
- } info;
- struct {
- u_int cpumaps_len;
- char *cpumaps_val;
- } cpumaps;
+ struct {
+ u_int info_len;
+ remote_vcpu_info *info_val;
+ } info;
+ struct {
+ u_int cpumaps_len;
+ char *cpumaps_val;
+ } cpumaps;
};
typedef struct remote_domain_get_vcpus_ret remote_domain_get_vcpus_ret;
struct remote_domain_get_max_vcpus_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_get_max_vcpus_args remote_domain_get_max_vcpus_args;
struct remote_domain_get_max_vcpus_ret {
- int num;
+ int num;
};
typedef struct remote_domain_get_max_vcpus_ret remote_domain_get_max_vcpus_ret;
struct remote_domain_attach_device_args {
- remote_nonnull_domain dom;
- remote_nonnull_string xml;
+ remote_nonnull_domain dom;
+ remote_nonnull_string xml;
};
typedef struct remote_domain_attach_device_args remote_domain_attach_device_args;
struct remote_domain_detach_device_args {
- remote_nonnull_domain dom;
- remote_nonnull_string xml;
+ remote_nonnull_domain dom;
+ remote_nonnull_string xml;
};
typedef struct remote_domain_detach_device_args remote_domain_detach_device_args;
struct remote_domain_get_autostart_args {
- remote_nonnull_domain dom;
+ remote_nonnull_domain dom;
};
typedef struct remote_domain_get_autostart_args remote_domain_get_autostart_args;
struct remote_domain_get_autostart_ret {
- int autostart;
+ int autostart;
};
typedef struct remote_domain_get_autostart_ret remote_domain_get_autostart_ret;
struct remote_domain_set_autostart_args {
- remote_nonnull_domain dom;
- int autostart;
+ remote_nonnull_domain dom;
+ int autostart;
};
typedef struct remote_domain_set_autostart_args remote_domain_set_autostart_args;
struct remote_num_of_networks_ret {
- int num;
+ int num;
};
typedef struct remote_num_of_networks_ret remote_num_of_networks_ret;
struct remote_list_networks_args {
- int maxnames;
+ int maxnames;
};
typedef struct remote_list_networks_args remote_list_networks_args;
struct remote_list_networks_ret {
- struct {
- u_int names_len;
- remote_nonnull_string *names_val;
- } names;
+ struct {
+ u_int names_len;
+ remote_nonnull_string *names_val;
+ } names;
};
typedef struct remote_list_networks_ret remote_list_networks_ret;
struct remote_num_of_defined_networks_ret {
- int num;
+ int num;
};
typedef struct remote_num_of_defined_networks_ret remote_num_of_defined_networks_ret;
struct remote_list_defined_networks_args {
- int maxnames;
+ int maxnames;
};
typedef struct remote_list_defined_networks_args remote_list_defined_networks_args;
struct remote_list_defined_networks_ret {
- struct {
- u_int names_len;
- remote_nonnull_string *names_val;
- } names;
+ struct {
+ u_int names_len;
+ remote_nonnull_string *names_val;
+ } names;
};
typedef struct remote_list_defined_networks_ret remote_list_defined_networks_ret;
struct remote_network_lookup_by_uuid_args {
- remote_uuid uuid;
+ remote_uuid uuid;
};
typedef struct remote_network_lookup_by_uuid_args remote_network_lookup_by_uuid_args;
struct remote_network_lookup_by_uuid_ret {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_lookup_by_uuid_ret remote_network_lookup_by_uuid_ret;
struct remote_network_lookup_by_name_args {
- remote_nonnull_string name;
+ remote_nonnull_string name;
};
typedef struct remote_network_lookup_by_name_args remote_network_lookup_by_name_args;
struct remote_network_lookup_by_name_ret {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_lookup_by_name_ret remote_network_lookup_by_name_ret;
struct remote_network_create_xml_args {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_network_create_xml_args remote_network_create_xml_args;
struct remote_network_create_xml_ret {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_create_xml_ret remote_network_create_xml_ret;
struct remote_network_define_xml_args {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_network_define_xml_args remote_network_define_xml_args;
struct remote_network_define_xml_ret {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_define_xml_ret remote_network_define_xml_ret;
struct remote_network_undefine_args {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_undefine_args remote_network_undefine_args;
struct remote_network_create_args {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_create_args remote_network_create_args;
struct remote_network_destroy_args {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_destroy_args remote_network_destroy_args;
struct remote_network_dump_xml_args {
- remote_nonnull_network net;
- int flags;
+ remote_nonnull_network net;
+ int flags;
};
typedef struct remote_network_dump_xml_args remote_network_dump_xml_args;
struct remote_network_dump_xml_ret {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_network_dump_xml_ret remote_network_dump_xml_ret;
struct remote_network_get_bridge_name_args {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_get_bridge_name_args remote_network_get_bridge_name_args;
struct remote_network_get_bridge_name_ret {
- remote_nonnull_string name;
+ remote_nonnull_string name;
};
typedef struct remote_network_get_bridge_name_ret remote_network_get_bridge_name_ret;
struct remote_network_get_autostart_args {
- remote_nonnull_network net;
+ remote_nonnull_network net;
};
typedef struct remote_network_get_autostart_args remote_network_get_autostart_args;
struct remote_network_get_autostart_ret {
- int autostart;
+ int autostart;
};
typedef struct remote_network_get_autostart_ret remote_network_get_autostart_ret;
struct remote_network_set_autostart_args {
- remote_nonnull_network net;
- int autostart;
+ remote_nonnull_network net;
+ int autostart;
};
typedef struct remote_network_set_autostart_args remote_network_set_autostart_args;
struct remote_auth_list_ret {
- struct {
- u_int types_len;
- remote_auth_type *types_val;
- } types;
+ struct {
+ u_int types_len;
+ remote_auth_type *types_val;
+ } types;
};
typedef struct remote_auth_list_ret remote_auth_list_ret;
struct remote_auth_sasl_init_ret {
- remote_nonnull_string mechlist;
+ remote_nonnull_string mechlist;
};
typedef struct remote_auth_sasl_init_ret remote_auth_sasl_init_ret;
struct remote_auth_sasl_start_args {
- remote_nonnull_string mech;
- int nil;
- struct {
- u_int data_len;
- char *data_val;
- } data;
+ remote_nonnull_string mech;
+ int nil;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
};
typedef struct remote_auth_sasl_start_args remote_auth_sasl_start_args;
struct remote_auth_sasl_start_ret {
- int complete;
- int nil;
- struct {
- u_int data_len;
- char *data_val;
- } data;
+ int complete;
+ int nil;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
};
typedef struct remote_auth_sasl_start_ret remote_auth_sasl_start_ret;
struct remote_auth_sasl_step_args {
- int nil;
- struct {
- u_int data_len;
- char *data_val;
- } data;
+ int nil;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
};
typedef struct remote_auth_sasl_step_args remote_auth_sasl_step_args;
struct remote_auth_sasl_step_ret {
- int complete;
- int nil;
- struct {
- u_int data_len;
- char *data_val;
- } data;
+ int complete;
+ int nil;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
};
typedef struct remote_auth_sasl_step_ret remote_auth_sasl_step_ret;
struct remote_auth_polkit_ret {
- int complete;
+ int complete;
};
typedef struct remote_auth_polkit_ret remote_auth_polkit_ret;
struct remote_num_of_storage_pools_ret {
- int num;
+ int num;
};
typedef struct remote_num_of_storage_pools_ret remote_num_of_storage_pools_ret;
struct remote_list_storage_pools_args {
- int maxnames;
+ int maxnames;
};
typedef struct remote_list_storage_pools_args remote_list_storage_pools_args;
struct remote_list_storage_pools_ret {
- struct {
- u_int names_len;
- remote_nonnull_string *names_val;
- } names;
+ struct {
+ u_int names_len;
+ remote_nonnull_string *names_val;
+ } names;
};
typedef struct remote_list_storage_pools_ret remote_list_storage_pools_ret;
struct remote_num_of_defined_storage_pools_ret {
- int num;
+ int num;
};
typedef struct remote_num_of_defined_storage_pools_ret remote_num_of_defined_storage_pools_ret;
struct remote_list_defined_storage_pools_args {
- int maxnames;
+ int maxnames;
};
typedef struct remote_list_defined_storage_pools_args remote_list_defined_storage_pools_args;
struct remote_list_defined_storage_pools_ret {
- struct {
- u_int names_len;
- remote_nonnull_string *names_val;
- } names;
+ struct {
+ u_int names_len;
+ remote_nonnull_string *names_val;
+ } names;
};
typedef struct remote_list_defined_storage_pools_ret remote_list_defined_storage_pools_ret;
struct remote_storage_pool_lookup_by_uuid_args {
- remote_uuid uuid;
+ remote_uuid uuid;
};
typedef struct remote_storage_pool_lookup_by_uuid_args remote_storage_pool_lookup_by_uuid_args;
struct remote_storage_pool_lookup_by_uuid_ret {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_lookup_by_uuid_ret remote_storage_pool_lookup_by_uuid_ret;
struct remote_storage_pool_lookup_by_name_args {
- remote_nonnull_string name;
+ remote_nonnull_string name;
};
typedef struct remote_storage_pool_lookup_by_name_args remote_storage_pool_lookup_by_name_args;
struct remote_storage_pool_lookup_by_name_ret {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_lookup_by_name_ret remote_storage_pool_lookup_by_name_ret;
struct remote_storage_pool_lookup_by_volume_args {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_pool_lookup_by_volume_args remote_storage_pool_lookup_by_volume_args;
struct remote_storage_pool_lookup_by_volume_ret {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_lookup_by_volume_ret remote_storage_pool_lookup_by_volume_ret;
struct remote_storage_pool_create_xml_args {
- remote_nonnull_string xml;
- u_int flags;
+ remote_nonnull_string xml;
+ u_int flags;
};
typedef struct remote_storage_pool_create_xml_args remote_storage_pool_create_xml_args;
struct remote_storage_pool_create_xml_ret {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_create_xml_ret remote_storage_pool_create_xml_ret;
struct remote_storage_pool_define_xml_args {
- remote_nonnull_string xml;
- u_int flags;
+ remote_nonnull_string xml;
+ u_int flags;
};
typedef struct remote_storage_pool_define_xml_args remote_storage_pool_define_xml_args;
struct remote_storage_pool_define_xml_ret {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_define_xml_ret remote_storage_pool_define_xml_ret;
struct remote_storage_pool_build_args {
- remote_nonnull_storage_pool pool;
- u_int flags;
+ remote_nonnull_storage_pool pool;
+ u_int flags;
};
typedef struct remote_storage_pool_build_args remote_storage_pool_build_args;
struct remote_storage_pool_undefine_args {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_undefine_args remote_storage_pool_undefine_args;
struct remote_storage_pool_create_args {
- remote_nonnull_storage_pool pool;
- u_int flags;
+ remote_nonnull_storage_pool pool;
+ u_int flags;
};
typedef struct remote_storage_pool_create_args remote_storage_pool_create_args;
struct remote_storage_pool_destroy_args {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_destroy_args remote_storage_pool_destroy_args;
struct remote_storage_pool_delete_args {
- remote_nonnull_storage_pool pool;
- u_int flags;
+ remote_nonnull_storage_pool pool;
+ u_int flags;
};
typedef struct remote_storage_pool_delete_args remote_storage_pool_delete_args;
struct remote_storage_pool_refresh_args {
- remote_nonnull_storage_pool pool;
- u_int flags;
+ remote_nonnull_storage_pool pool;
+ u_int flags;
};
typedef struct remote_storage_pool_refresh_args remote_storage_pool_refresh_args;
struct remote_storage_pool_dump_xml_args {
- remote_nonnull_storage_pool pool;
- u_int flags;
+ remote_nonnull_storage_pool pool;
+ u_int flags;
};
typedef struct remote_storage_pool_dump_xml_args remote_storage_pool_dump_xml_args;
struct remote_storage_pool_dump_xml_ret {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_storage_pool_dump_xml_ret remote_storage_pool_dump_xml_ret;
struct remote_storage_pool_get_info_args {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_get_info_args remote_storage_pool_get_info_args;
struct remote_storage_pool_get_info_ret {
- u_char state;
- u_quad_t capacity;
- u_quad_t allocation;
- u_quad_t available;
+ u_char state;
+ u_quad_t capacity;
+ u_quad_t allocation;
+ u_quad_t available;
};
typedef struct remote_storage_pool_get_info_ret remote_storage_pool_get_info_ret;
struct remote_storage_pool_get_autostart_args {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_get_autostart_args remote_storage_pool_get_autostart_args;
struct remote_storage_pool_get_autostart_ret {
- int autostart;
+ int autostart;
};
typedef struct remote_storage_pool_get_autostart_ret remote_storage_pool_get_autostart_ret;
struct remote_storage_pool_set_autostart_args {
- remote_nonnull_storage_pool pool;
- int autostart;
+ remote_nonnull_storage_pool pool;
+ int autostart;
};
typedef struct remote_storage_pool_set_autostart_args remote_storage_pool_set_autostart_args;
struct remote_storage_pool_num_of_volumes_args {
- remote_nonnull_storage_pool pool;
+ remote_nonnull_storage_pool pool;
};
typedef struct remote_storage_pool_num_of_volumes_args remote_storage_pool_num_of_volumes_args;
struct remote_storage_pool_num_of_volumes_ret {
- int num;
+ int num;
};
typedef struct remote_storage_pool_num_of_volumes_ret remote_storage_pool_num_of_volumes_ret;
struct remote_storage_pool_list_volumes_args {
- remote_nonnull_storage_pool pool;
- int maxnames;
+ remote_nonnull_storage_pool pool;
+ int maxnames;
};
typedef struct remote_storage_pool_list_volumes_args remote_storage_pool_list_volumes_args;
struct remote_storage_pool_list_volumes_ret {
- struct {
- u_int names_len;
- remote_nonnull_string *names_val;
- } names;
+ struct {
+ u_int names_len;
+ remote_nonnull_string *names_val;
+ } names;
};
typedef struct remote_storage_pool_list_volumes_ret remote_storage_pool_list_volumes_ret;
struct remote_storage_vol_lookup_by_name_args {
- remote_nonnull_storage_pool pool;
- remote_nonnull_string name;
+ remote_nonnull_storage_pool pool;
+ remote_nonnull_string name;
};
typedef struct remote_storage_vol_lookup_by_name_args remote_storage_vol_lookup_by_name_args;
struct remote_storage_vol_lookup_by_name_ret {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_vol_lookup_by_name_ret remote_storage_vol_lookup_by_name_ret;
struct remote_storage_vol_lookup_by_key_args {
- remote_nonnull_string key;
+ remote_nonnull_string key;
};
typedef struct remote_storage_vol_lookup_by_key_args remote_storage_vol_lookup_by_key_args;
struct remote_storage_vol_lookup_by_key_ret {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_vol_lookup_by_key_ret remote_storage_vol_lookup_by_key_ret;
struct remote_storage_vol_lookup_by_path_args {
- remote_nonnull_string path;
+ remote_nonnull_string path;
};
typedef struct remote_storage_vol_lookup_by_path_args remote_storage_vol_lookup_by_path_args;
struct remote_storage_vol_lookup_by_path_ret {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_vol_lookup_by_path_ret remote_storage_vol_lookup_by_path_ret;
struct remote_storage_vol_create_xml_args {
- remote_nonnull_storage_pool pool;
- remote_nonnull_string xml;
- u_int flags;
+ remote_nonnull_storage_pool pool;
+ remote_nonnull_string xml;
+ u_int flags;
};
typedef struct remote_storage_vol_create_xml_args remote_storage_vol_create_xml_args;
struct remote_storage_vol_create_xml_ret {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_vol_create_xml_ret remote_storage_vol_create_xml_ret;
struct remote_storage_vol_delete_args {
- remote_nonnull_storage_vol vol;
- u_int flags;
+ remote_nonnull_storage_vol vol;
+ u_int flags;
};
typedef struct remote_storage_vol_delete_args remote_storage_vol_delete_args;
struct remote_storage_vol_dump_xml_args {
- remote_nonnull_storage_vol vol;
- u_int flags;
+ remote_nonnull_storage_vol vol;
+ u_int flags;
};
typedef struct remote_storage_vol_dump_xml_args remote_storage_vol_dump_xml_args;
struct remote_storage_vol_dump_xml_ret {
- remote_nonnull_string xml;
+ remote_nonnull_string xml;
};
typedef struct remote_storage_vol_dump_xml_ret remote_storage_vol_dump_xml_ret;
struct remote_storage_vol_get_info_args {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_vol_get_info_args remote_storage_vol_get_info_args;
struct remote_storage_vol_get_info_ret {
- char type;
- u_quad_t capacity;
- u_quad_t allocation;
+ char type;
+ u_quad_t capacity;
+ u_quad_t allocation;
};
typedef struct remote_storage_vol_get_info_ret remote_storage_vol_get_info_ret;
struct remote_storage_vol_get_path_args {
- remote_nonnull_storage_vol vol;
+ remote_nonnull_storage_vol vol;
};
typedef struct remote_storage_vol_get_path_args remote_storage_vol_get_path_args;
struct remote_storage_vol_get_path_ret {
- remote_nonnull_string name;
+ remote_nonnull_string name;
};
typedef struct remote_storage_vol_get_path_ret remote_storage_vol_get_path_ret;
#define REMOTE_PROGRAM 0x20008086
#define REMOTE_PROTOCOL_VERSION 1
enum remote_procedure {
- REMOTE_PROC_OPEN = 1,
- REMOTE_PROC_CLOSE = 2,
- REMOTE_PROC_GET_TYPE = 3,
- REMOTE_PROC_GET_VERSION = 4,
- REMOTE_PROC_GET_MAX_VCPUS = 5,
- REMOTE_PROC_NODE_GET_INFO = 6,
- REMOTE_PROC_GET_CAPABILITIES = 7,
- REMOTE_PROC_DOMAIN_ATTACH_DEVICE = 8,
- REMOTE_PROC_DOMAIN_CREATE = 9,
- REMOTE_PROC_DOMAIN_CREATE_LINUX = 10,
- REMOTE_PROC_DOMAIN_DEFINE_XML = 11,
- REMOTE_PROC_DOMAIN_DESTROY = 12,
- REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13,
- REMOTE_PROC_DOMAIN_DUMP_XML = 14,
- REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15,
- REMOTE_PROC_DOMAIN_GET_INFO = 16,
- REMOTE_PROC_DOMAIN_GET_MAX_MEMORY = 17,
- REMOTE_PROC_DOMAIN_GET_MAX_VCPUS = 18,
- REMOTE_PROC_DOMAIN_GET_OS_TYPE = 19,
- REMOTE_PROC_DOMAIN_GET_VCPUS = 20,
- REMOTE_PROC_LIST_DEFINED_DOMAINS = 21,
- REMOTE_PROC_DOMAIN_LOOKUP_BY_ID = 22,
- REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME = 23,
- REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID = 24,
- REMOTE_PROC_NUM_OF_DEFINED_DOMAINS = 25,
- REMOTE_PROC_DOMAIN_PIN_VCPU = 26,
- REMOTE_PROC_DOMAIN_REBOOT = 27,
- REMOTE_PROC_DOMAIN_RESUME = 28,
- REMOTE_PROC_DOMAIN_SET_AUTOSTART = 29,
- REMOTE_PROC_DOMAIN_SET_MAX_MEMORY = 30,
- REMOTE_PROC_DOMAIN_SET_MEMORY = 31,
- REMOTE_PROC_DOMAIN_SET_VCPUS = 32,
- REMOTE_PROC_DOMAIN_SHUTDOWN = 33,
- REMOTE_PROC_DOMAIN_SUSPEND = 34,
- REMOTE_PROC_DOMAIN_UNDEFINE = 35,
- REMOTE_PROC_LIST_DEFINED_NETWORKS = 36,
- REMOTE_PROC_LIST_DOMAINS = 37,
- REMOTE_PROC_LIST_NETWORKS = 38,
- REMOTE_PROC_NETWORK_CREATE = 39,
- REMOTE_PROC_NETWORK_CREATE_XML = 40,
- REMOTE_PROC_NETWORK_DEFINE_XML = 41,
- REMOTE_PROC_NETWORK_DESTROY = 42,
- REMOTE_PROC_NETWORK_DUMP_XML = 43,
- REMOTE_PROC_NETWORK_GET_AUTOSTART = 44,
- REMOTE_PROC_NETWORK_GET_BRIDGE_NAME = 45,
- REMOTE_PROC_NETWORK_LOOKUP_BY_NAME = 46,
- REMOTE_PROC_NETWORK_LOOKUP_BY_UUID = 47,
- REMOTE_PROC_NETWORK_SET_AUTOSTART = 48,
- REMOTE_PROC_NETWORK_UNDEFINE = 49,
- REMOTE_PROC_NUM_OF_DEFINED_NETWORKS = 50,
- REMOTE_PROC_NUM_OF_DOMAINS = 51,
- REMOTE_PROC_NUM_OF_NETWORKS = 52,
- REMOTE_PROC_DOMAIN_CORE_DUMP = 53,
- REMOTE_PROC_DOMAIN_RESTORE = 54,
- REMOTE_PROC_DOMAIN_SAVE = 55,
- REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE = 56,
- REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57,
- REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58,
- REMOTE_PROC_GET_HOSTNAME = 59,
- REMOTE_PROC_SUPPORTS_FEATURE = 60,
- REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61,
- REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62,
- REMOTE_PROC_DOMAIN_MIGRATE_FINISH = 63,
- REMOTE_PROC_DOMAIN_BLOCK_STATS = 64,
- REMOTE_PROC_DOMAIN_INTERFACE_STATS = 65,
- REMOTE_PROC_AUTH_LIST = 66,
- REMOTE_PROC_AUTH_SASL_INIT = 67,
- REMOTE_PROC_AUTH_SASL_START = 68,
- REMOTE_PROC_AUTH_SASL_STEP = 69,
- REMOTE_PROC_AUTH_POLKIT = 70,
- REMOTE_PROC_NUM_OF_STORAGE_POOLS = 71,
- REMOTE_PROC_LIST_STORAGE_POOLS = 72,
- REMOTE_PROC_NUM_OF_DEFINED_STORAGE_POOLS = 73,
- REMOTE_PROC_LIST_DEFINED_STORAGE_POOLS = 74,
- REMOTE_PROC_DISCOVER_STORAGE_POOLS = 75,
- REMOTE_PROC_STORAGE_POOL_CREATE_XML = 76,
- REMOTE_PROC_STORAGE_POOL_DEFINE_XML = 77,
- REMOTE_PROC_STORAGE_POOL_CREATE = 78,
- REMOTE_PROC_STORAGE_POOL_BUILD = 79,
- REMOTE_PROC_STORAGE_POOL_DESTROY = 80,
- REMOTE_PROC_STORAGE_POOL_DELETE = 81,
- REMOTE_PROC_STORAGE_POOL_UNDEFINE = 82,
- REMOTE_PROC_STORAGE_POOL_REFRESH = 83,
- REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME = 84,
- REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID = 85,
- REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME = 86,
- REMOTE_PROC_STORAGE_POOL_GET_INFO = 87,
- REMOTE_PROC_STORAGE_POOL_DUMP_XML = 88,
- REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART = 89,
- REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART = 90,
- REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES = 91,
- REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES = 92,
- REMOTE_PROC_STORAGE_VOL_CREATE_XML = 93,
- REMOTE_PROC_STORAGE_VOL_DELETE = 94,
- REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME = 95,
- REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY = 96,
- REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH = 97,
- REMOTE_PROC_STORAGE_VOL_GET_INFO = 98,
- REMOTE_PROC_STORAGE_VOL_DUMP_XML = 99,
- REMOTE_PROC_STORAGE_VOL_GET_PATH = 100,
+ REMOTE_PROC_OPEN = 1,
+ REMOTE_PROC_CLOSE = 2,
+ REMOTE_PROC_GET_TYPE = 3,
+ REMOTE_PROC_GET_VERSION = 4,
+ REMOTE_PROC_GET_MAX_VCPUS = 5,
+ REMOTE_PROC_NODE_GET_INFO = 6,
+ REMOTE_PROC_GET_CAPABILITIES = 7,
+ REMOTE_PROC_DOMAIN_ATTACH_DEVICE = 8,
+ REMOTE_PROC_DOMAIN_CREATE = 9,
+ REMOTE_PROC_DOMAIN_CREATE_LINUX = 10,
+ REMOTE_PROC_DOMAIN_DEFINE_XML = 11,
+ REMOTE_PROC_DOMAIN_DESTROY = 12,
+ REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13,
+ REMOTE_PROC_DOMAIN_DUMP_XML = 14,
+ REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15,
+ REMOTE_PROC_DOMAIN_GET_INFO = 16,
+ REMOTE_PROC_DOMAIN_GET_MAX_MEMORY = 17,
+ REMOTE_PROC_DOMAIN_GET_MAX_VCPUS = 18,
+ REMOTE_PROC_DOMAIN_GET_OS_TYPE = 19,
+ REMOTE_PROC_DOMAIN_GET_VCPUS = 20,
+ REMOTE_PROC_LIST_DEFINED_DOMAINS = 21,
+ REMOTE_PROC_DOMAIN_LOOKUP_BY_ID = 22,
+ REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME = 23,
+ REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID = 24,
+ REMOTE_PROC_NUM_OF_DEFINED_DOMAINS = 25,
+ REMOTE_PROC_DOMAIN_PIN_VCPU = 26,
+ REMOTE_PROC_DOMAIN_REBOOT = 27,
+ REMOTE_PROC_DOMAIN_RESUME = 28,
+ REMOTE_PROC_DOMAIN_SET_AUTOSTART = 29,
+ REMOTE_PROC_DOMAIN_SET_MAX_MEMORY = 30,
+ REMOTE_PROC_DOMAIN_SET_MEMORY = 31,
+ REMOTE_PROC_DOMAIN_SET_VCPUS = 32,
+ REMOTE_PROC_DOMAIN_SHUTDOWN = 33,
+ REMOTE_PROC_DOMAIN_SUSPEND = 34,
+ REMOTE_PROC_DOMAIN_UNDEFINE = 35,
+ REMOTE_PROC_LIST_DEFINED_NETWORKS = 36,
+ REMOTE_PROC_LIST_DOMAINS = 37,
+ REMOTE_PROC_LIST_NETWORKS = 38,
+ REMOTE_PROC_NETWORK_CREATE = 39,
+ REMOTE_PROC_NETWORK_CREATE_XML = 40,
+ REMOTE_PROC_NETWORK_DEFINE_XML = 41,
+ REMOTE_PROC_NETWORK_DESTROY = 42,
+ REMOTE_PROC_NETWORK_DUMP_XML = 43,
+ REMOTE_PROC_NETWORK_GET_AUTOSTART = 44,
+ REMOTE_PROC_NETWORK_GET_BRIDGE_NAME = 45,
+ REMOTE_PROC_NETWORK_LOOKUP_BY_NAME = 46,
+ REMOTE_PROC_NETWORK_LOOKUP_BY_UUID = 47,
+ REMOTE_PROC_NETWORK_SET_AUTOSTART = 48,
+ REMOTE_PROC_NETWORK_UNDEFINE = 49,
+ REMOTE_PROC_NUM_OF_DEFINED_NETWORKS = 50,
+ REMOTE_PROC_NUM_OF_DOMAINS = 51,
+ REMOTE_PROC_NUM_OF_NETWORKS = 52,
+ REMOTE_PROC_DOMAIN_CORE_DUMP = 53,
+ REMOTE_PROC_DOMAIN_RESTORE = 54,
+ REMOTE_PROC_DOMAIN_SAVE = 55,
+ REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE = 56,
+ REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57,
+ REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58,
+ REMOTE_PROC_GET_HOSTNAME = 59,
+ REMOTE_PROC_SUPPORTS_FEATURE = 60,
+ REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61,
+ REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62,
+ REMOTE_PROC_DOMAIN_MIGRATE_FINISH = 63,
+ REMOTE_PROC_DOMAIN_BLOCK_STATS = 64,
+ REMOTE_PROC_DOMAIN_INTERFACE_STATS = 65,
+ REMOTE_PROC_AUTH_LIST = 66,
+ REMOTE_PROC_AUTH_SASL_INIT = 67,
+ REMOTE_PROC_AUTH_SASL_START = 68,
+ REMOTE_PROC_AUTH_SASL_STEP = 69,
+ REMOTE_PROC_AUTH_POLKIT = 70,
+ REMOTE_PROC_NUM_OF_STORAGE_POOLS = 71,
+ REMOTE_PROC_LIST_STORAGE_POOLS = 72,
+ REMOTE_PROC_NUM_OF_DEFINED_STORAGE_POOLS = 73,
+ REMOTE_PROC_LIST_DEFINED_STORAGE_POOLS = 74,
+ REMOTE_PROC_DISCOVER_STORAGE_POOLS = 75,
+ REMOTE_PROC_STORAGE_POOL_CREATE_XML = 76,
+ REMOTE_PROC_STORAGE_POOL_DEFINE_XML = 77,
+ REMOTE_PROC_STORAGE_POOL_CREATE = 78,
+ REMOTE_PROC_STORAGE_POOL_BUILD = 79,
+ REMOTE_PROC_STORAGE_POOL_DESTROY = 80,
+ REMOTE_PROC_STORAGE_POOL_DELETE = 81,
+ REMOTE_PROC_STORAGE_POOL_UNDEFINE = 82,
+ REMOTE_PROC_STORAGE_POOL_REFRESH = 83,
+ REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME = 84,
+ REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID = 85,
+ REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME = 86,
+ REMOTE_PROC_STORAGE_POOL_GET_INFO = 87,
+ REMOTE_PROC_STORAGE_POOL_DUMP_XML = 88,
+ REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART = 89,
+ REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART = 90,
+ REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES = 91,
+ REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES = 92,
+ REMOTE_PROC_STORAGE_VOL_CREATE_XML = 93,
+ REMOTE_PROC_STORAGE_VOL_DELETE = 94,
+ REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME = 95,
+ REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY = 96,
+ REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH = 97,
+ REMOTE_PROC_STORAGE_VOL_GET_INFO = 98,
+ REMOTE_PROC_STORAGE_VOL_DUMP_XML = 99,
+ REMOTE_PROC_STORAGE_VOL_GET_PATH = 100,
+ REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY = 101,
+ REMOTE_PROC_NODE_GET_FREE_MEMORY = 102,
};
typedef enum remote_procedure remote_procedure;
enum remote_message_direction {
- REMOTE_CALL = 0,
- REMOTE_REPLY = 1,
- REMOTE_MESSAGE = 2,
+ REMOTE_CALL = 0,
+ REMOTE_REPLY = 1,
+ REMOTE_MESSAGE = 2,
};
typedef enum remote_message_direction remote_message_direction;
enum remote_message_status {
- REMOTE_OK = 0,
- REMOTE_ERROR = 1,
+ REMOTE_OK = 0,
+ REMOTE_ERROR = 1,
};
typedef enum remote_message_status remote_message_status;
#define REMOTE_MESSAGE_HEADER_XDR_LEN 4
struct remote_message_header {
- u_int prog;
- u_int vers;
- remote_procedure proc;
- remote_message_direction direction;
- u_int serial;
- remote_message_status status;
+ u_int prog;
+ u_int vers;
+ remote_procedure proc;
+ remote_message_direction direction;
+ u_int serial;
+ remote_message_status status;
};
typedef struct remote_message_header remote_message_header;
@@ -1172,6 +1194,9 @@ extern bool_t xdr_remote_get_max_vcpus_
extern bool_t xdr_remote_get_max_vcpus_ret (XDR *, remote_get_max_vcpus_ret*);
extern bool_t xdr_remote_node_get_info_ret (XDR *, remote_node_get_info_ret*);
extern bool_t xdr_remote_get_capabilities_ret (XDR *, remote_get_capabilities_ret*);
+extern bool_t xdr_remote_node_get_cells_free_memory_args (XDR *, remote_node_get_cells_free_memory_args*);
+extern bool_t xdr_remote_node_get_cells_free_memory_ret (XDR *, remote_node_get_cells_free_memory_ret*);
+extern bool_t xdr_remote_node_get_free_memory_ret (XDR *, remote_node_get_free_memory_ret*);
extern bool_t xdr_remote_domain_get_scheduler_type_args (XDR *, remote_domain_get_scheduler_type_args*);
extern bool_t xdr_remote_domain_get_scheduler_type_ret (XDR *, remote_domain_get_scheduler_type_ret*);
extern bool_t xdr_remote_domain_get_scheduler_parameters_args (XDR *, remote_domain_get_scheduler_parameters_args*);
@@ -1344,6 +1369,9 @@ extern bool_t xdr_remote_get_max_vcpus_a
extern bool_t xdr_remote_get_max_vcpus_ret ();
extern bool_t xdr_remote_node_get_info_ret ();
extern bool_t xdr_remote_get_capabilities_ret ();
+extern bool_t xdr_remote_node_get_cells_free_memory_args ();
+extern bool_t xdr_remote_node_get_cells_free_memory_ret ();
+extern bool_t xdr_remote_node_get_free_memory_ret ();
extern bool_t xdr_remote_domain_get_scheduler_type_args ();
extern bool_t xdr_remote_domain_get_scheduler_type_ret ();
extern bool_t xdr_remote_domain_get_scheduler_parameters_args ();
Index: qemud/remote_protocol.x
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_protocol.x,v
retrieving revision 1.11
diff -u -p -r1.11 remote_protocol.x
--- qemud/remote_protocol.x 10 Apr 2008 16:53:29 -0000 1.11
+++ qemud/remote_protocol.x 15 May 2008 21:07:31 -0000
@@ -87,6 +87,9 @@ const REMOTE_STORAGE_VOL_NAME_LIST_MAX =
/* Upper limit on list of scheduler parameters. */
const REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX = 16;
+/* Upper limit on number of NUMA cells */
+const REMOTE_NODE_MAX_CELLS = 1024;
+
/* Upper limit on SASL auth negotiation packet */
const REMOTE_AUTH_SASL_DATA_MAX = 65536;
@@ -254,6 +257,19 @@ struct remote_get_capabilities_ret {
remote_nonnull_string capabilities;
};
+struct remote_node_get_cells_free_memory_args {
+ int startCell;
+ int maxCells;
+};
+
+struct remote_node_get_cells_free_memory_ret {
+ hyper freeMems<REMOTE_NODE_MAX_CELLS>;
+};
+
+struct remote_node_get_free_memory_ret {
+ hyper freeMem;
+};
+
struct remote_domain_get_scheduler_type_args {
remote_nonnull_domain dom;
};
@@ -1017,7 +1033,10 @@ enum remote_procedure {
REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH = 97,
REMOTE_PROC_STORAGE_VOL_GET_INFO = 98,
REMOTE_PROC_STORAGE_VOL_DUMP_XML = 99,
- REMOTE_PROC_STORAGE_VOL_GET_PATH = 100
+ REMOTE_PROC_STORAGE_VOL_GET_PATH = 100,
+
+ REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY = 101,
+ REMOTE_PROC_NODE_GET_FREE_MEMORY = 102
};
/* Custom RPC structure. */
Index: qemud/rpcgen_fix.pl
===================================================================
RCS file: /data/cvs/libvirt/qemud/rpcgen_fix.pl,v
retrieving revision 1.1
diff -u -p -r1.1 rpcgen_fix.pl
--- qemud/rpcgen_fix.pl 11 Jun 2007 11:36:17 -0000 1.1
+++ qemud/rpcgen_fix.pl 15 May 2008 21:07:31 -0000
@@ -24,6 +24,8 @@ while (<>) {
next;
}
+ s/\t/ /g;
+
if (m/^}/) {
$in_function = 0;
@@ -52,7 +54,7 @@ while (<>) {
foreach (keys %uses) {
$i = $uses{$_};
unshift @function,
- ("\tchar **objp_cpp$i = (char **) (void *) &$_;\n");
+ (" char **objp_cpp$i = (char **) (void *) &$_;\n");
$i++;
}
@function =
--
|: 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 :|
16 years, 6 months
[libvirt] PATCH: Fix some more memory leaks
by Daniel P. Berrange
While testing Cole's series of patches I identified a couple more places
where we leak memory.
In libvirt.c, the default authentication callback uses uninitialized
data, and indeed strdup()'s it and this is then never released. This
simply disables that bit of code.
In qparams.c when free'ing the struct the 'p' struct field was not
released. I took the opportunity to switch it over to using the new
style memory.h functions
In remote.c there were a couple of handlers which forgot to free the
virDomainPtr object when they were done.
qemud/remote.c | 18 ++++++++++++++----
src/libvirt.c | 16 +++++++++-------
src/qparams.c | 31 +++++++++++++------------------
3 files changed, 36 insertions(+), 29 deletions(-)
Dan.
Index: qemud/remote.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote.c,v
retrieving revision 1.32
diff -u -p -r1.32 remote.c
--- qemud/remote.c 21 May 2008 20:53:30 -0000 1.32
+++ qemud/remote.c 21 May 2008 21:16:42 -0000
@@ -792,8 +792,11 @@ remoteDispatchDomainBlockStats (struct q
}
path = args->path;
- if (virDomainBlockStats (dom, path, &stats, sizeof stats) == -1)
+ if (virDomainBlockStats (dom, path, &stats, sizeof stats) == -1) {
+ virDomainFree (dom);
return -1;
+ }
+ virDomainFree (dom);
ret->rd_req = stats.rd_req;
ret->rd_bytes = stats.rd_bytes;
@@ -823,8 +826,11 @@ remoteDispatchDomainInterfaceStats (stru
}
path = args->path;
- if (virDomainInterfaceStats (dom, path, &stats, sizeof stats) == -1)
+ if (virDomainInterfaceStats (dom, path, &stats, sizeof stats) == -1) {
+ virDomainFree (dom);
return -1;
+ }
+ virDomainFree (dom);
ret->rx_bytes = stats.rx_bytes;
ret->rx_packets = stats.rx_packets;
@@ -1258,7 +1264,11 @@ remoteDispatchDomainMigratePerform (stru
args->cookie.cookie_len,
args->uri,
args->flags, dname, args->resource);
- if (r == -1) return -1;
+ if (r == -1) {
+ virDomainFree (dom);
+ return -1;
+ }
+ virDomainFree (dom);
return 0;
}
@@ -1281,7 +1291,7 @@ remoteDispatchDomainMigrateFinish (struc
if (ddom == NULL) return -1;
make_nonnull_domain (&ret->ddom, ddom);
-
+ virDomainFree (ddom);
return 0;
}
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.140
diff -u -p -r1.140 libvirt.c
--- src/libvirt.c 21 May 2008 20:53:31 -0000 1.140
+++ src/libvirt.c 21 May 2008 21:16:45 -0000
@@ -170,13 +170,15 @@ static int virConnectAuthCallbackDefault
return -1;
}
- if (STREQ(bufptr, "") && cred[i].defresult)
- cred[i].result = strdup(cred[i].defresult);
- else
- cred[i].result = strdup(bufptr);
- if (!cred[i].result)
- return -1;
- cred[i].resultlen = strlen(cred[i].result);
+ if (cred[i].type != VIR_CRED_EXTERNAL) {
+ if (STREQ(bufptr, "") && cred[i].defresult)
+ cred[i].result = strdup(cred[i].defresult);
+ else
+ cred[i].result = strdup(bufptr);
+ if (!cred[i].result)
+ return -1;
+ cred[i].resultlen = strlen(cred[i].result);
+ }
}
return 0;
Index: src/qparams.c
===================================================================
RCS file: /data/cvs/libvirt/src/qparams.c,v
retrieving revision 1.4
diff -u -p -r1.4 qparams.c
--- src/qparams.c 28 Apr 2008 15:14:59 -0000 1.4
+++ src/qparams.c 21 May 2008 21:16:45 -0000
@@ -27,7 +27,7 @@
#include <stdarg.h>
#include "buf.h"
-
+#include "memory.h"
#include "qparams.h"
struct qparam_set *
@@ -39,13 +39,12 @@ new_qparam_set (int init_alloc, ...)
if (init_alloc <= 0) init_alloc = 1;
- ps = malloc (sizeof (*ps));
- if (!ps) return NULL;
+ if (VIR_ALLOC(ps) < 0)
+ return NULL;
ps->n = 0;
ps->alloc = init_alloc;
- ps->p = malloc (init_alloc * sizeof (ps->p[0]));
- if (!ps->p) {
- free (ps);
+ if (VIR_ALLOC_N(ps->p, ps->alloc) < 0) {
+ VIR_FREE (ps);
return NULL;
}
@@ -87,13 +86,8 @@ append_qparams (struct qparam_set *ps, .
static int
grow_qparam_set (struct qparam_set *ps)
{
- struct qparam *old_p;
-
if (ps->n >= ps->alloc) {
- old_p = ps->p;
- ps->p = realloc (ps->p, 2 * ps->alloc * sizeof (ps->p[0]));
- if (!ps->p) {
- ps->p = old_p;
+ if (VIR_REALLOC_N(ps->p, ps->alloc * 2) < 0) {
perror ("realloc");
return -1;
}
@@ -115,13 +109,13 @@ append_qparam (struct qparam_set *ps,
pvalue = strdup (value);
if (!pvalue) {
- free (pname);
+ VIR_FREE (pname);
return -1;
}
if (grow_qparam_set (ps) == -1) {
- free (pname);
- free (pvalue);
+ VIR_FREE (pname);
+ VIR_FREE (pvalue);
return -1;
}
@@ -161,10 +155,11 @@ free_qparam_set (struct qparam_set *ps)
int i;
for (i = 0; i < ps->n; ++i) {
- free (ps->p[i].name);
- free (ps->p[i].value);
+ VIR_FREE (ps->p[i].name);
+ VIR_FREE (ps->p[i].value);
}
- free (ps);
+ VIR_FREE (ps->p);
+ VIR_FREE (ps);
}
struct qparam_set *
--
|: 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 :|
16 years, 6 months