[libvirt] [PATCH 00/14] Add support for XBZRLE migration compression
by Jiri Denemark
QEMU supports XBZRLE compression of repeatedly transferred pages during
live migration and this series makes it usable through libvirt. The first
two patches add support for VIR_MIGRATE_COMPRESSED flag that enables
XBZRLE compression. Patches 3--9 add an enhanced and extensible version
of virDomainGetJobInfo and make various migration statistics available
through it. The rest of the patches (10--14) add APIs for querying and
changing XBZRLE compression cache size.
Jiri Denemark (14):
Introduce VIR_MIGRATE_COMPRESSED flag
qemu: Add support for compressed migration
Introduce virDomainGetJobStats API
python: Implement virDomainGetJobStats wrapper
remote: Auto-allocate params in remoteDeserializeTypedParameters
remote: Implement virDomainGetJobStats
virsh: Use virDomainGetJobStats in domjobinfo if available
qemu: Parse more fields from query-migrate QMP command
qemu: Implement virDomainGetJobStats
Introduce virDomainMigrate*CompressionCache APIs
python: Implement virDomainMigrateGetCompressionCache wrapper
remote: Implement virDomainMigrate*CompressionCache
virsh: Add migrate-compcache command
qemu: Implement virDomainMigrate*CompressionCache
daemon/remote.c | 44 ++++++
include/libvirt/libvirt.h.in | 213 ++++++++++++++++++++++++++
python/generator.py | 2 +
python/libvirt-override-api.xml | 13 ++
python/libvirt-override.c | 70 +++++++++
src/driver.h | 18 +++
src/libvirt.c | 158 +++++++++++++++++++
src/libvirt_public.syms | 3 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 3 +-
src/qemu/qemu_driver.c | 235 ++++++++++++++++++++++++++++
src/qemu/qemu_migration.c | 103 ++++++++++---
src/qemu/qemu_migration.h | 3 +-
src/qemu/qemu_monitor.c | 101 ++++++++++--
src/qemu/qemu_monitor.h | 52 ++++++-
src/qemu/qemu_monitor_json.c | 331 ++++++++++++++++++++++++++++++++++------
src/qemu/qemu_monitor_json.h | 15 +-
src/qemu/qemu_monitor_text.c | 47 +++---
src/qemu/qemu_monitor_text.h | 5 +-
src/remote/remote_driver.c | 138 ++++++++++++-----
src/remote/remote_protocol.x | 31 +++-
src/remote_protocol-structs | 26 ++++
src/rpc/gendispatch.pl | 2 +-
tools/virsh-domain.c | 291 +++++++++++++++++++++++++++++------
tools/virsh.pod | 18 ++-
25 files changed, 1718 insertions(+), 205 deletions(-)
--
1.8.1.2
11 years, 10 months
[libvirt] [PATCH] qemu: only release SPICE TLS port if it has been allocated
by Ján Tomko
Silence the error message that happens during shutdown of a domain with
spice graphics, autoport enabled if spice_tls is disabled in qemu.conf:
error : virPortAllocatorRelease:174 : port 0 must be in range (5900, 65534)
---
src/qemu/qemu_process.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b560d2e..1e2bcae 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4321,8 +4321,10 @@ retry:
graphics->data.spice.autoport) {
ignore_value(virPortAllocatorRelease(driver->remotePorts,
graphics->data.spice.port));
- ignore_value(virPortAllocatorRelease(driver->remotePorts,
- graphics->data.spice.tlsPort));
+ if (cfg->spiceTLS) {
+ ignore_value(virPortAllocatorRelease(driver->remotePorts,
+ graphics->data.spice.tlsPort));
+ }
}
}
--
1.7.12.4
11 years, 10 months
[libvirt] Libvirt java build problems
by Daniel P. Berrange
The Fedora build of libvirt-java is currently broken with a strange
error:
http://kojipkgs.fedoraproject.org//work/tasks/4719/4994719/build.log
Buildfile: /builddir/build/BUILD/libvirt-java-0.4.9/build.xml
init:
[mkdir] Created dir: /builddir/build/BUILD/libvirt-java-0.4.9/target/classes
[mkdir] Created dir: /builddir/build/BUILD/libvirt-java-0.4.9/target/testclasses
[copy] Copying 1 file to /builddir/build/BUILD/libvirt-java-0.4.9
build:
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/build.xml:42: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 63 source files to /builddir/build/BUILD/libvirt-java-0.4.9/target/classes
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virError.java:9: error: virError is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virError extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virConnectAuth.java:9: error: virConnectAuth is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virConnectAuth extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virDomainBlockStats.java:8: error: virDomainBlockStats is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virDomainBlockStats extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virDomainBlockInfo.java:5: error: virDomainBlockInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virDomainBlockInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virDomainInfo.java:9: error: virDomainInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virDomainInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virDomainJobInfo.java:5: error: virDomainJobInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virDomainJobInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virSchedParameter.java:8: error: virSchedParameter is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virSchedParameter extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virVcpuInfo.java:8: error: virVcpuInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virVcpuInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virDomainInterfaceStats.java:8: error: virDomainInterfaceStats is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virDomainInterfaceStats extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virDomainMemoryStats.java:5: error: virDomainMemoryStats is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virDomainMemoryStats extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virNodeInfo.java:9: error: virNodeInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virNodeInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virStoragePoolInfo.java:8: error: virStoragePoolInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virStoragePoolInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virStorageVolInfo.java:8: error: virStorageVolInfo is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virStorageVolInfo extends Structure {
[javac] ^
[javac] /builddir/build/BUILD/libvirt-java-0.4.9/src/main/java/org/libvirt/jna/virConnectCredential.java:8: error: virConnectCredential is not abstract and does not override abstract method getFieldOrder() in Structure
[javac] public class virConnectCredential extends Structure implements Structure.ByReference {
[javac] ^
[javac] 14 errors
BUILD FAILED
/builddir/build/BUILD/libvirt-java-0.4.9/build.xml:42: Compile failed; see the compiler error output for details.
Not sure what we should do to fix this...so suggestions welcome.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
11 years, 10 months
[libvirt] [PATCH 0/2] qemu: allow multiple buses in PCI address allocation
by Ján Tomko
This miniseries converts the functions for reserving PCI addresses
to use virDevicePCIAddress which we use in virDeviceInfo for PCI addresses
(not to be confused with virPCIDeviceAddress from virpci.h used for host
devices which should probably be merged with virDevicePCIAddress in a followup
patch) and it makes them accept bus numbers up to 'maxbus', which should be set
when creating the address set if multiple buses are allowed.
Right now it's initialized to zero and these patches have no effect.
Ján Tomko (2):
qemu: switch PCI address alocation to use virDevicePCIAddress
qemu: allow multiple buses in PCI address alocation
src/qemu/qemu_command.c | 288 ++++++++++++++++++++++--------------------------
src/qemu/qemu_command.h | 13 +--
src/qemu/qemu_hotplug.c | 16 +--
3 files changed, 147 insertions(+), 170 deletions(-)
--
1.7.12.4
11 years, 10 months
[libvirt] How to connect to console of domain on PowerPC?
by Yin Olivia-R63875
Hi,
I tried to use libvirt to run KVM/QEMU on Freescale PowerPC platforms.
So far there's only one serial device (spapr-vty) defined in QEMU to work as console for IBM PSeries platform.
There's no serial device support in QEMU for Freescale PowerPC (ePAPR).
libvirt/src/qemu/qemu_command.c
/* This function generates the correct '-device' string for character
* devices of each architecture.
*/
char *
qemuBuildChrDeviceStr(virDomainChrDefPtr serial,
virBitmapPtr qemuCaps,
char *os_arch,
char *machine)
{
virBuffer cmd = VIR_BUFFER_INITIALIZER;
if (STREQ(os_arch, "ppc64") && STREQ(machine, "pseries")) {
if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
serial->source.type == VIR_DOMAIN_CHR_TYPE_PTY &&
serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
serial->info.alias);
if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0)
goto error;
}
} else
virBufferAsprintf(&cmd, "isa-serial,chardev=char%s,id=%s",
serial->info.alias, serial->info.alias);
if (virBufferError(&cmd)) {
virReportOOMError();
goto error;
}
return virBufferContentAndReset(&cmd);
error:
virBufferFreeAndReset(&cmd);
return NULL;
}
We usually connect guest with telnet.
For instance,
/usr/bin/qemu-system-ppc -name demo -M ppce500v2 -enable-kvm -m 256 -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk -append "root=/dev/ram rw console=ttyS0,115200" -serial tcp::4445,server
Then to run 'telnet 10.193.20.xxx 4445' could connect the guest.
The temporary workaround is not add '-device' string after '-serial' option.
diff -Nur libvirt-0.10.1.orig/src/qemu/qemu_command.c libvirt-0.10.1/src/qemu/qemu_command.c
--- libvirt-0.10.1.orig/src/qemu/qemu_command.c 2012-08-30 15:35:18.000000000 +0530
+++ libvirt-0.10.1/src/qemu/qemu_command.c 2012-10-05 17:19:32.060368755 +0530
@@ -5501,13 +5501,15 @@
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
- virCommandAddArg(cmd, "-device");
- if (!(devstr = qemuBuildChrDeviceStr(serial, qemuCaps,
+ if (!STREQ(def->os.arch, "ppc")) {
+ virCommandAddArg(cmd, "-device");
+ if (!(devstr = qemuBuildChrDeviceStr(serial,
+ qemuCaps,
def->os.arch,
def->os.machine)))
- goto error;
- virCommandAddArg(cmd, devstr);
- VIR_FREE(devstr);
+ goto error;
+ virCommandAddArg(cmd, devstr);
+ VIR_FREE(devstr);
+ }
} else {
virCommandAddArg(cmd, "-serial");
if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL)))
Applying the above patch to libvirt, all the other domain control commands could work except 'virsh console domain'.
# cat >demo.args <<EOF
> /usr/bin/qemu-system-ppc -name demo -M ppce500v2 -enable-kvm -m 256
> -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk
> -append "root=/dev/ram rw console=ttyS0,115200" -serial
> tcp::4445,server -net nic EOF
# vi demo.args
/usr/bin/qemu-system-ppc -name demo -M ppce500v2 -enable-kvm -m 256 -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk -append "root=/dev/ram rw console=ttyS0,115200" -serial tcp::4445,server -net nic
# virsh domxml-from-native qemu-argv demo.args >demo.xml # vi demo.xml <domain type='kvm'>
<name>demo</name>
<uuid>985d7154-83c8-0763-cbac-ecd159eee8a6</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='ppc' machine='ppce500v2'>hvm</type>
<kernel>/media/ram/uImage</kernel>
<initrd>/media/ram/ramdisk</initrd>
<cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<serial type='tcp'>
<source mode='bind' host='' service='4445'/>
<protocol type='raw'/>
<target port='0'/>
</serial>
<console type='tcp'>
<source mode='bind' host='' service='4445'/>
<protocol type='raw'/>
<target type='serial' port='0'/>
</console>
<memballoon model='virtio'/>
</devices>
</domain>
# virsh -c qemu:///system define demo.xml # virsh -c qemu:///system start demo
But it seemed that can't connect to the console.
# virsh -c qemu:///system console demo
Connected to domain test
Escape character is ^]
error: internal error character device (null) is not using a PTY
I tried also use '-serial pty' option,
/usr/bin/qemu-system-ppc -name test -M ppce500v2 -enable-kvm -m 256 -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk -append "root=/dev/ram rw console=ttyS0,115200" -serial pty
Then there's no other output after the below message:
# virsh -c qemu:///system console demo
Connected to domain test
Escape character is ^]
It seemed not libvirt group issue.
I also tried the LXC.
It could connect to the console if <init>/bin/sh/</init> instead of <init>/sbin/init</init>
Best Regards,
Olivia
11 years, 10 months
[libvirt] [PATCH 1/2] conf: Don't leak 'primary' video property on error
by Christophe Fergeau
It's only freed on normal returns from virDomainVideoDefParseXML,
but not when erroring out.
---
src/conf/domain_conf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 10f361c..258ee93 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7662,9 +7662,11 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
vram = virXMLPropString(cur, "vram");
heads = virXMLPropString(cur, "heads");
- if ((primary = virXMLPropString(cur, "primary")) != NULL)
+ if ((primary = virXMLPropString(cur, "primary")) != NULL) {
if (STREQ(primary, "yes"))
def->primary = 1;
+ VIR_FREE(primary);
+ }
def->accel = virDomainVideoAccelDefParseXML(cur);
}
@@ -7728,7 +7730,6 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
VIR_FREE(ram);
VIR_FREE(vram);
VIR_FREE(heads);
- VIR_FREE(primary);
return def;
--
1.8.1.2
11 years, 10 months
[libvirt] Reminder about coming freeze for 1.0.3
by Daniel Veillard
We are supposed to enter the freeze early Monday, so please
try to push features today or over the w.e. , if there is something
serious pending and that should go in and is in trouble please reply
so it gets the required attention and can be processed in time :-)
thanks !
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
11 years, 10 months
[libvirt] [PATCHv2 0/6] interface: udev backend bond support
by Doug Goldstein
Refactor code, clean up error handling, and finally add bond support. The
last patch optionally supports a patch I submitted to the Linux kernel
which should go in for 3.9 (it was just accepted for net-next).
After this patch when you have a bond device you'll get the following:
$ ./tools/virsh iface-dumpxml br0
<interface type='bridge' name='br0'>
<mtu size='1500'/>
<bridge stp='on' delay='1499'>
<interface type='bond' name='bond0'>
<mtu size='1500'/>
<bond mode='balance-rr'>
<interface type='ethernet' name='eth2'>
<mac address='d0:67:e5:fa:88:95'/>
<mtu size='1500'/>
</interface>
<interface type='ethernet' name='eth3'>
<mac address='d0:67:e5:fa:88:95'/>
<mtu size='1500'/>
</interface>
</bond>
</interface>
<!-- incorrectly including guest tap devices, but was an issue
prior and will be fixed in a later series -->
</bridge>
</interface>
Doug Goldstein (6):
interface: Refactor udev bridge to helper func
interface: udev bridge code error handling updates
interface: Refactor interface vlan to helper func
interface: Improve udev backend device type id
interface: add bond support to udev backend
interface: dev type support for bond interfaces
src/interface/interface_backend_udev.c | 546 +++++++++++++++++++++++++++------
1 file changed, 451 insertions(+), 95 deletions(-)
--
1.7.12.4
11 years, 10 months
[libvirt] [PATCH] qemu: check backing chains even when cgroup is omitted
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=896685 points out
a regression caused by commit 38c4a9c - libvirt only labels
the backing chain if the backing chain cache is populated, but
the code to populate the cache was only conditionally performed
if cgroup labeling was necessary.
* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Hoist cache setup...
* src/qemu/qemu_process.c (qemuProcessStart): ...earlier into
caller, where it is now unconditional.
---
src/qemu/qemu_cgroup.c | 4 +---
src/qemu/qemu_process.c | 5 +++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 4fde1af..e65b486 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -234,9 +234,7 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
}
for (i = 0; i < vm->def->ndisks ; i++) {
- if (qemuDomainDetermineDiskChain(driver, vm->def->disks[i],
- false) < 0 ||
- qemuSetupDiskCgroup(vm, cgroup, vm->def->disks[i]) < 0)
+ if (qemuSetupDiskCgroup(vm, cgroup, vm->def->disks[i]) < 0)
goto cleanup;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 476e3ed..af8222b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3706,6 +3706,11 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
VIR_DEBUG("Checking for CDROM and floppy presence");
+ for (i = 0; i < vm->def->ndisks ; i++) {
+ if (qemuDomainDetermineDiskChain(driver, vm->def->disks[i],
+ false) < 0)
+ goto cleanup;
+ }
if (qemuDomainCheckDiskPresence(driver, vm,
flags & VIR_QEMU_PROCESS_START_COLD) < 0)
goto cleanup;
--
1.8.1.2
11 years, 10 months
[libvirt] [PATCH] virsh: add --start option to the define command
by Doug Goldstein
I often find myself doing virsh "define blah.xml; start blah". I figured
adding this would be a easier^Hlazier way to do it.
---
tools/virsh-domain.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e91939c..1a3af34 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5597,6 +5597,7 @@ static const vshCmdInfo info_define[] = {
static const vshCmdOptDef opts_define[] = {
{"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("file containing an XML domain description")},
+ {"start", VSH_OT_BOOL, 0, N_("start the domain after creation")},
{NULL, 0, 0, NULL}
};
@@ -5607,6 +5608,7 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
const char *from = NULL;
bool ret = true;
char *buffer;
+ bool start;
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
@@ -5614,17 +5616,31 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
return false;
+ start = vshCommandOptBool(cmd, "start");
+
dom = virDomainDefineXML(ctl->conn, buffer);
VIR_FREE(buffer);
if (dom != NULL) {
vshPrint(ctl, _("Domain %s defined from %s\n"),
virDomainGetName(dom), from);
- virDomainFree(dom);
} else {
vshError(ctl, _("Failed to define domain from %s"), from);
- ret = false;
+ return false;
}
+
+ /* Start the domain if the user requested it and it was defined */
+ if (start) {
+ if (virDomainCreate(dom) < 0) {
+ vshError(ctl, _("Failed to start domain %s, which was "
+ "successfully defined."), virDomainGetName(dom));
+ ret = false;
+ } else {
+ vshPrint(ctl, _("Domain %s started\n"), virDomainGetName(dom));
+ }
+ }
+
+ virDomainFree(dom);
return ret;
}
--
1.7.8.6
11 years, 10 months