[libvirt] [PATCH] util: fix build without macvtap
by Roman Bogorodskiy
Commit 370608b added new functions:
- virNetDevMacVLanReleaseName,
- virNetDevMacVLanReserveName.
Add stubbed versions of them to fix build without macvtap.
---
src/util/virnetdevmacvlan.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index da71eef..9293510 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -1330,4 +1330,21 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname ATTRIBUTE_UN
_("Cannot create macvlan devices on this platform"));
return -1;
}
+
+int
+virNetDevMacVLanReserveName(const char *name ATTRIBUTE_UNUSED,
+ bool quietFail ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("The macvlan devices are not supported on this platform"));
+ return -1;
+}
+
+int
+virNetDevMacVLanReleaseName(const char *name ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("The macvlan devices are not supported on this platform"));
+ return -1;
+}
#endif /* ! WITH_MACVTAP */
--
2.4.6
8 years, 10 months
[libvirt] [PATCH] Fix libvirtd free() segfault when migrating guest with deleted open vswitch port
by Jason J. Herne
libvirtd crashes on free()ing portData for an open vswitch port if that port
was deleted. To reproduce:
ovs-vsctl del-port vnet0
virsh migrate --live kvm1 qemu+ssh://dstHost/system
Error message:
libvirtd: *** Error in `/usr/sbin/libvirtd': free(): invalid pointer: 0x000003ff90001e20 ***
The problem is that virCommandRun can return an empty string in the event that
the port being queried does not exist. When this happens then we are
unconditionally overwriting a newline character at position strlen()-1. When
strlen is 0, we overwrite memory that does not belong to the string.
The fix: Only overwrite the newline if the string is not empty.
Reviewed-by: Bjoern Walk <bwalk(a)linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne(a)linux.vnet.ibm.com>
---
src/util/virnetdevopenvswitch.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 6780fb5..0f640d0 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -222,8 +222,10 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
goto cleanup;
}
- /* Wipeout the newline */
- (*migrate)[strlen(*migrate) - 1] = '\0';
+ /* Wipeout the newline, if it exists */
+ if (strlen(*migrate) > 0) {
+ (*migrate)[strlen(*migrate) - 1] = '\0';
+ }
ret = 0;
cleanup:
virCommandFree(cmd);
--
1.9.1
8 years, 10 months
[libvirt] [PATCH] virnetdevmacvlan: Provide stubs for build without macvtap
by Michal Privoznik
In 370608b4c76f we have introduced two new internal APIs.
However, there are no stubs for build without macvtap. Therefore
build on systems lacking macvtap support (e.g. mingw or freebds)
fails when trying to link.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under build breaker and trivial rules.
src/util/virnetdevmacvlan.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index da71eef..2409113 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -1330,4 +1330,19 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname ATTRIBUTE_UN
_("Cannot create macvlan devices on this platform"));
return -1;
}
+
+int virNetDevMacVLanReleaseName(const char *name ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Cannot create macvlan devices on this platform"));
+ return -1;
+}
+
+int virNetDevMacVLanReserveName(const char *name ATTRIBUTE_UNUSED,
+ bool quietFail ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Cannot create macvlan devices on this platform"));
+ return -1;
+}
#endif /* ! WITH_MACVTAP */
--
2.4.10
8 years, 10 months
[libvirt] high outage times for qemu virtio network links during live migration, trying to debug
by Chris Friesen
Hi,
I'm using libvirt (1.2.12) with qemu (2.2.0) in the context of OpenStack.
If I live-migrate a guest with virtio network interfaces, I see a ~1200msec
delay in processing the network packets, and several hundred of them get
dropped. I get the dropped packets, but I'm not sure why the delay is there.
I instrumented qemu and libvirt, and the strange thing is that this delay seems
to happen before qemu actually starts doing any migration-related work. (i.e.
before qmp_migrate() is called)
Looking at my timestamps, the start of the glitch seems to coincide with
libvirtd calling qemuDomainMigratePrepareTunnel3Params(), and the end of the
glitch occurs when the migration is complete and we're up and running on the
destination.
My question is, why doesn't qemu continue processing virtio packets while the
dirty page scanning and memory transfer over the network is proceeding?
Thanks,
Chris
(Please CC me on responses, I'm not subscribed to the lists.)
8 years, 10 months
[libvirt] [PATCH] vircgroup: Finish renaming of virCgroupIsolateMount
by Michal Privoznik
In dc576025c360 we renamed virCgroupIsolateMount function to
virCgroupBindMount. However, we forgot about one occurrence in
section of the code which provides stubs for platforms without
support for CGroups like *BSD for instance.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under build-breaker and trivial rules.
src/util/vircgroup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index d7f4065..9b56e27 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -4882,9 +4882,9 @@ virCgroupGetFreezerState(virCgroupPtr group ATTRIBUTE_UNUSED,
int
-virCgroupIsolateMount(virCgroupPtr group ATTRIBUTE_UNUSED,
- const char *oldroot ATTRIBUTE_UNUSED,
- const char *mountopts ATTRIBUTE_UNUSED)
+virCgroupBindMount(virCgroupPtr group ATTRIBUTE_UNUSED,
+ const char *oldroot ATTRIBUTE_UNUSED,
+ const char *mountopts ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
--
2.4.10
8 years, 10 months
[libvirt] [PATCH v2 0/4] various test fixes and handling of input devices
by Pavel Hrdina
Some of the patches from v1 series are already pushed, only those 4 left for
review.
Pavel Hrdina (4):
tests: use virtTestDifferenceFull in tests where we have output file
tests: add some missing tests to qemuxml2xmltest
device: cleanup input device code
tests: update test XML files to follow input changes
src/Makefile.am | 4 +-
src/conf/domain_conf.c | 82 +++-------------------
src/libxl/libxl_domain.c | 5 ++
src/qemu/qemu_domain.c | 23 ++++++
src/xen/xen_driver.c | 5 ++
src/xenapi/xenapi_driver.c | 5 ++
src/xenconfig/xen_common.c | 22 ++++++
src/xenconfig/xen_common.h | 2 +
.../disk_snapshot_redefine.xml | 2 +
.../external_vm_redefine.xml | 2 +
tests/domainsnapshotxml2xmlout/full_domain.xml | 2 +
tests/domainsnapshotxml2xmlout/metadata.xml | 2 +
tests/domainsnapshotxml2xmltest.c | 2 +-
tests/interfacexml2xmltest.c | 2 +-
tests/lxcconf2xmltest.c | 2 +-
tests/nodedevxml2xmltest.c | 2 +-
tests/qemuhotplugtest.c | 11 ++-
.../qemuhotplug-hotplug-base+disk-scsi.xml | 2 +
.../qemuhotplug-hotplug-base+disk-usb.xml | 2 +
.../qemuhotplug-hotplug-base+disk-virtio.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-bios-nvram.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 2 +
.../qemuxml2argv-blkiotune-device.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 2 +
.../qemuxml2argv-boot-menu-disable.xml | 2 +
.../qemuxml2argv-boot-menu-enable-with-timeout.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-boot-network.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml | 2 +
.../qemuxml2argv-channel-guestfwd.xml | 2 +
.../qemuxml2argv-channel-virtio.xml | 2 +
.../qemuxml2argv-chardev-label.xml | 2 +
.../qemuxml2argv-clock-catchup.xml | 2 +
.../qemuxml2argv-clock-localtime.xml | 2 +
.../qemuxml2argv-clock-timer-hyperv-rtc.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 2 +
.../qemuxml2argv-console-compat.xml | 2 +
.../qemuxml2argv-console-virtio-many.xml | 2 +
.../qemuxml2argv-cpu-eoi-disabled.xml | 2 +
.../qemuxml2argv-cpu-eoi-enabled.xml | 2 +
.../qemuxml2argv-cpu-host-kvmclock.xml | 2 +
.../qemuxml2argv-cpu-host-model-features.xml | 2 +
.../qemuxml2argv-cpu-host-passthrough-features.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml | 2 +
.../qemuxml2argv-cpu-numa-disjoint.xml | 2 +
.../qemuxml2argv-cpu-numa-memshared.xml | 2 +
...xml2argv-cputune-iothreadsched-zeropriority.xml | 2 +
.../qemuxml2argv-cputune-numatune.xml | 2 +
.../qemuxml2argv-cputune-zero-shares.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 2 +
.../qemuxml2argv-disk-active-commit.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml | 2 +
.../qemuxml2argv-disk-cdrom-empty.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 2 +
.../qemuxml2argv-disk-copy_on_read.xml | 2 +
.../qemuxml2argv-disk-drive-boot-cdrom.xml | 3 +
.../qemuxml2argv-disk-drive-boot-disk.xml | 3 +
.../qemuxml2argv-disk-drive-cache-directsync.xml | 2 +
.../qemuxml2argv-disk-drive-cache-unsafe.xml | 2 +
.../qemuxml2argv-disk-drive-cache-v2-none.xml | 2 +
.../qemuxml2argv-disk-drive-cache-v2-wb.xml | 2 +
.../qemuxml2argv-disk-drive-cache-v2-wt.xml | 2 +
.../qemuxml2argv-disk-drive-copy-on-read.xml | 2 +
...muxml2argv-disk-drive-error-policy-enospace.xml | 2 +
.../qemuxml2argv-disk-drive-error-policy-stop.xml | 2 +
...rgv-disk-drive-error-policy-wreport-rignore.xml | 2 +
.../qemuxml2argv-disk-drive-fat.xml | 2 +
.../qemuxml2argv-disk-drive-fmt-qcow.xml | 2 +
.../qemuxml2argv-disk-drive-network-gluster.xml | 2 +
.../qemuxml2argv-disk-drive-network-iscsi-auth.xml | 2 +
.../qemuxml2argv-disk-drive-network-iscsi.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd-export.xml | 2 +
...xml2argv-disk-drive-network-nbd-ipv6-export.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd-ipv6.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd-unix.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd.xml | 2 +
.../qemuxml2argv-disk-drive-network-rbd-auth.xml | 2 +
...emuxml2argv-disk-drive-network-rbd-ceph-env.xml | 2 +
.../qemuxml2argv-disk-drive-network-rbd-ipv6.xml | 2 +
.../qemuxml2argv-disk-drive-network-rbd.xml | 2 +
.../qemuxml2argv-disk-drive-network-sheepdog.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 2 +
.../qemuxml2argv-disk-scsi-device.xml | 2 +
.../qemuxml2argv-disk-scsi-disk-vpd.xml | 2 +
...qemuxml2argv-disk-scsi-lun-passthrough-sgio.xml | 2 +
.../qemuxml2argv-disk-scsi-megasas.xml | 2 +
.../qemuxml2argv-disk-scsi-virtio-scsi.xml | 2 +
.../qemuxml2argv-disk-scsi-vscsi.xml | 2 +
.../qemuxml2argv-disk-source-pool-mode.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-ioeventfd.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-max_sectors.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-num_queues.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 2 +
.../qemuxml2argv-encrypted-disk.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-eoi-disabled.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-eoi-enabled.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 2 +
.../qemuxml2argv-floppy-drive-fat.xml | 2 +
.../qemuxml2argv-hostdev-pci-address.xml | 2 +
.../qemuxml2argv-hostdev-scsi-large-unit.xml | 2 +
.../qemuxml2argv-hostdev-scsi-lsi-iscsi-auth.xml | 2 +
.../qemuxml2argv-hostdev-scsi-lsi-iscsi.xml | 2 +
.../qemuxml2argv-hostdev-scsi-lsi.xml | 2 +
.../qemuxml2argv-hostdev-scsi-rawio.xml | 2 +
.../qemuxml2argv-hostdev-scsi-readonly.xml | 2 +
.../qemuxml2argv-hostdev-scsi-sgio.xml | 2 +
.../qemuxml2argv-hostdev-scsi-shareable.xml | 2 +
...qemuxml2argv-hostdev-scsi-virtio-iscsi-auth.xml | 2 +
.../qemuxml2argv-hostdev-scsi-virtio-iscsi.xml | 2 +
.../qemuxml2argv-hostdev-scsi-virtio-scsi.xml | 2 +
.../qemuxml2argv-hostdev-usb-address.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-hostdev-vfio.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-hotplug-base.xml | 2 +
.../qemuxml2argv-hugepages-pages.xml | 2 +
.../qemuxml2argv-hugepages-pages2.xml | 2 +
.../qemuxml2argv-hugepages-pages3.xml | 2 +
.../qemuxml2argv-hugepages-shared.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-hyperv-off.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-hyperv.xml | 2 +
.../qemuxml2argv-input-usbmouse.xml | 2 +
.../qemuxml2argv-input-usbtablet.xml | 2 +
.../qemuxml2argv-interface-driver.xml | 2 +
.../qemuxml2argv-iothreads-disk.xml | 2 +
.../qemuxml2argv-iothreads-ids-partial.xml | 2 +
.../qemuxml2argv-iothreads-ids.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-iothreads.xml | 2 +
.../qemuxml2argv-kvm-features-off.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-kvm-features.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 2 +
.../qemuxml2argv-machine-core-off.xml | 2 +
.../qemuxml2argv-machine-core-on.xml | 2 +
.../qemuxml2argv-memory-hotplug-dimm.xml | 2 +
.../qemuxml2argv-memory-hotplug-nonuma.xml | 2 +
.../qemuxml2argv-memory-hotplug.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 2 +
.../qemuxml2argv-misc-disable-s3.xml | 2 +
.../qemuxml2argv-misc-disable-suspends.xml | 2 +
.../qemuxml2argv-misc-enable-s4.xml | 2 +
.../qemuxml2argv-misc-no-reboot.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 2 +
.../qemuxml2argv-net-eth-ifname.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 2 +
.../qemuxml2argv-net-hostdev-vfio.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-net-midonet.xml | 2 +
.../qemuxml2argv-net-openvswitch.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 2 +
.../qemuxml2argv-net-vhostuser.xml | 2 +
.../qemuxml2argv-net-virtio-device.xml | 2 +
.../qemuxml2argv-net-virtio-disable-offloads.xml | 2 +
.../qemuxml2argv-net-virtio-network-portgroup.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 2 +
.../qemuxml2argv-nographics-vga.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-nosharepages.xml | 2 +
.../qemuxml2argv-numad-static-vcpu-no-numatune.xml | 2 +
.../qemuxml2argv-numatune-memnode-no-memory.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-panic-double.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml | 2 +
.../qemuxml2argv-panic-no-address.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 2 +
.../qemuxml2argv-pci-serial-dev-chardev.xml | 2 +
.../qemuxml2argv-pcie-root-port-too-many.xml | 2 +
.../qemuxml2argv-pcie-root-port.xml | 2 +
.../qemuxml2argv-pcie-switch-downstream-port.xml | 2 +
.../qemuxml2argv-pcie-switch-upstream-port.xml | 2 +
.../qemuxml2argv-pcihole64-none.xml | 2 +
.../qemuxml2argv-pcihole64-q35.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml | 2 +
.../qemuxml2argv-pmu-feature-off.xml | 2 +
.../qemuxml2argv-pv-spinlock-disabled.xml | 2 +
.../qemuxml2argv-pv-spinlock-enabled.xml | 2 +
.../qemuxml2argv-qemu-ns-no-env.xml | 2 +
.../qemuxml2argv-reboot-timeout-disabled.xml | 2 +
.../qemuxml2argv-reboot-timeout-enabled.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 2 +
.../qemuxml2argv-seclabel-dac-none.xml | 2 +
.../qemuxml2argv-seclabel-device-multiple.xml | 2 +
.../qemuxml2argv-seclabel-dynamic-baselabel.xml | 2 +
.../qemuxml2argv-seclabel-dynamic-none.xml | 2 +
.../qemuxml2argv-seclabel-dynamic-override.xml | 2 +
.../qemuxml2argv-seclabel-static-labelskip.xml | 2 +
.../qemuxml2argv-seclabel-static.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-serial-file.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-serial-many.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 2 +
.../qemuxml2argv-serial-spiceport-nospice.xml | 2 +
.../qemuxml2argv-serial-tcp-telnet.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-shmem.xml | 2 +
.../qemuxml2argv-smbios-multiple-type2.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-sound-device.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml | 2 +
.../qemuxml2argv-tpm-passthrough.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 2 +
.../qemuxml2argv-vcpu-placement-static.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-vhost_queues.xml | 2 +
.../qemuxml2argv-video-virtio-gpu-device.xml | 2 +
.../qemuxml2argv-video-virtio-gpu-virgl.xml | 2 +
.../qemuxml2argv-virtio-input-passthrough.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-virtio-input.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 2 +
.../qemuxml2argv-virtio-rng-egd.xml | 2 +
.../qemuxml2argv-virtio-rng-random.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 2 +
tests/qemuxml2argvtest.c | 1 +
.../qemuxml2xmlout-balloon-device-auto.xml | 2 +
.../qemuxml2xmlout-balloon-device-period.xml | 2 +
.../qemuxml2xmlout-bios-nvram-os-interleave.xml | 2 +
...muxml2xmlout-boot-menu-disable-with-timeout.xml | 2 +
.../qemuxml2xmlout-channel-virtio-auto.xml | 2 +
.../qemuxml2xmlout-channel-virtio-state-active.xml | 2 +
...emuxml2xmlout-channel-virtio-state-inactive.xml | 2 +
.../qemuxml2xmlout-console-compat-auto.xml | 2 +
.../qemuxml2xmlout-console-compat2.xml | 2 +
.../qemuxml2xmlout-console-virtio.xml | 2 +
.../qemuxml2xmlout-controller-usb-order.xml | 2 +
.../qemuxml2xmlout-cpu-empty.xml | 2 +
.../qemuxml2xmlout-cpu-numa-disordered.xml | 2 +
.../qemuxml2xmlout-cpu-numa-no-memory-element.xml | 2 +
.../qemuxml2xmlout-cpu-numa1.xml | 2 +
.../qemuxml2xmlout-cpu-numa2.xml | 2 +
.../qemuxml2xmlout-cputune-iothreads.xml | 2 +
.../qemuxml2xmlout-cputune-iothreadsched.xml | 2 +
.../qemuxml2xmlout-default-kvm-host-arch.xml | 2 +
.../qemuxml2xmlout-default-qemu-host-arch.xml | 2 +
.../qemuxml2xmlout-disk-backing-chains-active.xml | 2 +
...qemuxml2xmlout-disk-backing-chains-inactive.xml | 2 +
.../qemuxml2xmlout-disk-drive-discard.xml | 2 +
.../qemuxml2xmlout-disk-mirror-old-inactive.xml | 2 +
.../qemuxml2xmlout-disk-mirror-old.xml | 2 +
.../qemuxml2xmlout-disk-mirror.xml | 2 +
.../qemuxml2xmlout-disk-scsi-device-auto.xml | 2 +
.../qemuxml2xmlout-disk-source-pool.xml | 2 +
...qemuxml2xmlout-hostdev-scsi-autogen-address.xml | 2 +
.../qemuxml2xmlout-memtune-unlimited.xml | 2 +
.../qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml | 2 +
.../qemuxml2xmlout-metadata-duplicate.xml | 2 +
.../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml | 2 +
...emuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml | 2 +
...ad-auto-memory-vcpu-no-cpuset-and-placement.xml | 2 +
.../qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml | 2 +
.../qemuxml2xmlout-numatune-auto-prefer.xml | 2 +
.../qemuxml2xmlout-numatune-memnode.xml | 2 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml | 2 +
.../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +
.../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +
.../qemuxml2xmlout-pci-bridge-many-disks.xml | 2 +
.../qemuxml2xmlout-pcie-root.xml | 2 +
.../qemuxml2xmlout-pcihole64-gib.xml | 2 +
.../qemuxml2xmlout-pmu-feature.xml | 2 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +
.../qemuxml2xmlout-seclabel-dynamic-labelskip.xml | 2 +
.../qemuxml2xmlout-seclabel-dynamic-relabel.xml | 2 +
.../qemuxml2xmlout-seclabel-none.xml | 2 +
.../qemuxml2xmlout-serial-target-port-auto.xml | 2 +
.../qemuxml2xmlout-tap-vhost-incorrect.xml | 2 +
.../qemuxml2xmlout-usb-ich9-ehci-addr.xml | 2 +
.../qemuxml2xmlout-usb-redir-filter-version.xml | 2 +
.../qemuxml2xmlout-usb-redir-filter.xml | 2 +
tests/qemuxml2xmltest.c | 23 ++++++
tests/sexpr2xmldata/sexpr2xml-boot-grub.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml | 2 +
.../sexpr2xml-disk-block-shareable.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-disk-block.xml | 2 +
.../sexpr2xml-disk-drv-blktap-qcow.xml | 2 +
.../sexpr2xml-disk-drv-blktap-raw.xml | 2 +
.../sexpr2xml-disk-drv-blktap2-raw.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-disk-file.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-net-bridged.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-net-e1000.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-net-routed.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pci-devs.xml | 2 +
.../sexpr2xml-pv-bootloader-cmdline.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv.xml | 2 +
tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 2 -
tests/xlconfigdata/test-paravirt-maxvcpus.xml | 2 +
tests/xmconfigdata/test-paravirt-maxvcpus.xml | 2 +
tests/xmconfigdata/test-paravirt-vcpu.xml | 2 +
303 files changed, 684 insertions(+), 85 deletions(-)
--
2.7.0
8 years, 10 months
[libvirt] [PATCH] lxc: don't try to hide parent cgroups inside container
by Daniel P. Berrange
On the host when we start a container, it will be
placed in a cgroup path of
/machine.slice/machine-lxc\x2ddemo.scope
under /sys/fs/cgroup/*
Inside the containers' namespace we need to setup
/sys/fs/cgroup mounts, and currently will bind
mount /machine.slice/machine-lxc\x2ddemo.scope on
the host to appear as / in the container.
While this may sound nice, it confuses applications
dealing with cgroups, because /proc/$PID/cgroup
now does not match the directory in /sys/fs/cgroup
This particularly causes problems for systems and
will make it create repeated path components in
the cgroup for apps run in the container eg
/machine.slice/machine-lxc\x2ddemo.scope/machine.slice/machine-lxc\x2ddemo.scope/user.slice/user-0.slice/session-61.scope
This also causes any systemd service that uses
sd-notify to fail to start, because when systemd
receives the notification it won't be able to
identify the corresponding unit it came from.
In particular this break rabbitmq-server startup
Future kernels will provide proper cgroup namespacing
which will handle this problem, but until that time
we should not try to play games with hiding parent
cgroups.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libvirt_private.syms | 2 +-
src/lxc/lxc_container.c | 2 +-
src/util/vircgroup.c | 9 ++++-----
src/util/vircgroup.h | 6 +++---
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5e05a98..1732421 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1194,6 +1194,7 @@ virCgroupAllowDevice;
virCgroupAllowDeviceMajor;
virCgroupAllowDevicePath;
virCgroupAvailable;
+virCgroupBindMount;
virCgroupControllerAvailable;
virCgroupControllerTypeFromString;
virCgroupControllerTypeToString;
@@ -1231,7 +1232,6 @@ virCgroupGetMemSwapUsage;
virCgroupGetPercpuStats;
virCgroupHasController;
virCgroupHasEmptyTasks;
-virCgroupIsolateMount;
virCgroupKill;
virCgroupKillPainfully;
virCgroupKillRecursive;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c5a70a1..a6805ac 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1827,7 +1827,7 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
/* Now we can re-mount the cgroups controllers in the
* same configuration as before */
- if (virCgroupIsolateMount(cgroup, "/.oldroot/", sec_mount_options) < 0)
+ if (virCgroupBindMount(cgroup, "/.oldroot/", sec_mount_options) < 0)
goto cleanup;
/* Mounts /dev */
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 7584ee4..d7f4065 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -3917,8 +3917,8 @@ virCgroupGetFreezerState(virCgroupPtr group, char **state)
int
-virCgroupIsolateMount(virCgroupPtr group, const char *oldroot,
- const char *mountopts)
+virCgroupBindMount(virCgroupPtr group, const char *oldroot,
+ const char *mountopts)
{
int ret = -1;
size_t i;
@@ -3954,10 +3954,9 @@ virCgroupIsolateMount(virCgroupPtr group, const char *oldroot,
if (!virFileExists(group->controllers[i].mountPoint)) {
char *src;
- if (virAsprintf(&src, "%s%s%s",
+ if (virAsprintf(&src, "%s%s",
oldroot,
- group->controllers[i].mountPoint,
- group->controllers[i].placement) < 0)
+ group->controllers[i].mountPoint) < 0)
goto cleanup;
VIR_DEBUG("Create mount point '%s'",
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 63a9e1c..d754b1f 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -286,9 +286,9 @@ int virCgroupKill(virCgroupPtr group, int signum);
int virCgroupKillRecursive(virCgroupPtr group, int signum);
int virCgroupKillPainfully(virCgroupPtr group);
-int virCgroupIsolateMount(virCgroupPtr group,
- const char *oldroot,
- const char *mountopts);
+int virCgroupBindMount(virCgroupPtr group,
+ const char *oldroot,
+ const char *mountopts);
bool virCgroupSupportsCpuBW(virCgroupPtr cgroup);
--
2.5.0
8 years, 10 months
[libvirt] Compiling libvirt on Cygwin
by Maarten Jacobs
Hello,
I have been trying to get libvirt compiled on Cygwin but I have run into a rather perplexing issue.
I am running a 32-bit installation of Cygwin on Windows 10:
CYGWIN_NT-10.0-WOW dell-desktop 2.4.0(0.293/5/3) 2016-01-15 16:14 i686 Cygwin
I have had to "fix" a number of problems in the Makefile that prevented the code from linking properly. I am not sure if the fixes are entirely correct - but as long as the linker was ok I pressed on.
After applying those changes to the Makefile, I ran into the following issue when creating libvirtd.exe:
CCLD libvirtd.exe../src/.libs/libvirt_driver_remote.a(libvirt_net_rpc_la-virnetmessage.o): In function `virNetMessageNew':/home/maart/source/libvirt/src/rpc/virnetmessage.c:39: multiple definition of `virNetMessageNew'/home/maart/source/libvirt/src/.libs/libvirt.dll.a(d002143.o):(.text+0x0): first defined here...collect2: error: ld returned 1 exit statusMakefile:2152: recipe for target 'libvirtd.exe' failedmake[3]: *** [libvirtd.exe] Error 1make[3]: Leaving directory '/cygdrive/c/cygwin64/home/maart/source/libvirt/daemon'Makefile:2050: recipe for target 'all' failedmake[2]: *** [all] Error 2make[2]: Leaving directory '/cygdrive/c/cygwin64/home/maart/source/libvirt/daemon'Makefile:1993: recipe for target 'all-recursive' failedmake[1]: *** [all-recursive] Error 1make[1]: Leaving directory '/cygdrive/c/cygwin64/home/maart/source/libvirt'Makefile:1887: recipe for target 'all' failedmake: *** [all] Error 2
It appears to me that somehow when the executable is linked together, it finds two separate definitions of the virNetMessageNew method, however I cannot figure out how that could be.
If anybody has any suggestions on how to debug this I'd appreciate it.
For clarity: my aim is to get the code to compile first, whether or not it will actually work under Cygwin. I do not believe there should be a specific reason why this code could not be made to compile/link - even if the end result may not work as intended... But I hope to find that out once I successfully create the resulting executables.
Thanks,
Maarten Jacobs
8 years, 10 months
[libvirt] [PATCH] qemu: turn on virtlockd by default
by Daniel P. Berrange
We have had virtlockd available for a long time now but
have always defaulted to the 'nop' lock driver which does
no locking. This gives users an unsafe deployment by
default unless they know to turn on lockd. virtlockd will
auto-activate via systemd when guests launch, so setting
it on by default will only cause upgrade pain for people
on non-systemd distros.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu.conf | 3 ++-
src/qemu/qemu_driver.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 4fa5e8a..73f4a0a 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -421,7 +421,8 @@
# share one writable disk, libvirt offers two approaches for
# locking files. The first one is sanlock, the other one,
# virtlockd, is then our own implementation. Accepted values
-# are "sanlock" and "lockd".
+# are "sanlock", "lockd" and "nop", with "lockd" being the
+# default.
#
#lock_manager = "lockd"
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e46404b..36fb047 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -728,7 +728,7 @@ qemuStateInitialize(bool privileged,
if (!(qemu_driver->lockManager =
virLockManagerPluginNew(cfg->lockManagerName ?
- cfg->lockManagerName : "nop",
+ cfg->lockManagerName : "lockd",
"qemu",
cfg->configBaseDir,
0)))
--
2.5.0
8 years, 10 months
[libvirt] [PATCH v2] qemu: add reporting of vCPU wait time
by Daniel P. Berrange
The VIR_DOMAIN_STATS_VCPU flag to virDomainListGetStats
enables reporting of stats about vCPUs. Currently we
only report the cumulative CPU running time and the
execution state.
This adds reporting of the wait time - time the vCPU
wants to run, but the host schedular has something else
running ahead of it.
The data is reported per-vCPU eg
$ virsh domstats --vcpu demo
Domain: 'demo'
vcpu.current=4
vcpu.maximum=4
vcpu.0.state=1
vcpu.0.time=1420000000
vcpu.0.wait=18403928
vcpu.1.state=1
vcpu.1.time=130000000
vcpu.1.wait=10612111
vcpu.2.state=1
vcpu.2.time=110000000
vcpu.2.wait=12759501
vcpu.3.state=1
vcpu.3.time=90000000
vcpu.3.wait=21825087
In implementing this I notice our reporting of CPU execute
time has very poor granularity, since we are getting it
from /proc/$PID/stat. As a future enhancement we should
prefer to get CPU execute time from /proc/$PID/schedstat
or /proc/$PID/sched (if either exist on the running kernel)
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 96 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 36fb047..40c52d4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1361,6 +1361,80 @@ static char *qemuConnectGetCapabilities(virConnectPtr conn) {
static int
+qemuGetSchedInfo(unsigned long long *cpuWait,
+ pid_t pid, pid_t tid)
+{
+ char *proc = NULL;
+ char *data = NULL;
+ char **lines = NULL;
+ size_t i;
+ int ret = -1;
+ double val;
+
+ *cpuWait = 0;
+
+ /* In general, we cannot assume pid_t fits in int; but /proc parsing
+ * is specific to Linux where int works fine. */
+ if (tid)
+ ret = virAsprintf(&proc, "/proc/%d/task/%d/sched", (int)pid, (int)tid);
+ else
+ ret = virAsprintf(&proc, "/proc/%d/sched", (int)pid);
+ if (ret < 0)
+ goto cleanup;
+ ret = -1;
+
+ /* The file is not guaranteed to exist (needs CONFIG_SCHED_DEBUG) */
+ if (access(proc, R_OK) < 0)
+ return 0;
+
+ if (virFileReadAll(proc, (1<<16), &data) < 0)
+ goto cleanup;
+
+ lines = virStringSplit(data, "\n", 0);
+ if (!lines)
+ goto cleanup;
+
+ for (i = 0; lines[i] != NULL; i++) {
+ const char *line = lines[i];
+
+ /* Needs CONFIG_SCHEDSTATS. The second check
+ * is the old name the kernel used in past */
+ if (STRPREFIX(line, "se.statistics.wait_sum") ||
+ STRPREFIX(line, "se.wait_sum")) {
+ line = strchr(line, ':');
+ if (!line) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing separate in sched info '%s'"),
+ lines[i]);
+ goto cleanup;
+ }
+ line++;
+ while (*line == ' ')
+ line++;
+
+ if (virStrToDouble(line, NULL, &val) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to parse sched info value '%s'"),
+ line);
+ goto cleanup;
+ }
+
+ *cpuWait = (unsigned long long)(val * 1000000);
+ break;
+ }
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(data);
+ VIR_FREE(proc);
+ VIR_FREE(lines);
+ return ret;
+}
+
+
+static int
qemuGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss,
pid_t pid, int tid)
{
@@ -1424,6 +1498,7 @@ qemuGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss,
static int
qemuDomainHelperGetVcpus(virDomainObjPtr vm,
virVcpuInfoPtr info,
+ unsigned long long *cpuwait,
int maxinfo,
unsigned char *cpumaps,
int maplen)
@@ -1476,6 +1551,11 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm,
virBitmapFree(map);
}
+ if (cpuwait) {
+ if (qemuGetSchedInfo(&(cpuwait[i]), vm->pid, vcpupid) < 0)
+ return -1;
+ }
+
ncpuinfo++;
}
@@ -5490,7 +5570,7 @@ qemuDomainGetVcpus(virDomainPtr dom,
goto cleanup;
}
- ret = qemuDomainHelperGetVcpus(vm, info, maxinfo, cpumaps, maplen);
+ ret = qemuDomainHelperGetVcpus(vm, info, NULL, maxinfo, cpumaps, maplen);
cleanup:
virDomainObjEndAPI(&vm);
@@ -19036,6 +19116,7 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int ret = -1;
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
virVcpuInfoPtr cpuinfo = NULL;
+ unsigned long long *cpuwait = NULL;
if (virTypedParamsAddUInt(&record->params,
&record->nparams,
@@ -19051,10 +19132,12 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainDefGetVcpusMax(dom->def)) < 0)
return -1;
- if (VIR_ALLOC_N(cpuinfo, virDomainDefGetVcpus(dom->def)) < 0)
- return -1;
+ if (VIR_ALLOC_N(cpuinfo, virDomainDefGetVcpus(dom->def)) < 0 ||
+ VIR_ALLOC_N(cpuwait, virDomainDefGetVcpus(dom->def)) < 0)
+ goto cleanup;
- if (qemuDomainHelperGetVcpus(dom, cpuinfo, virDomainDefGetVcpus(dom->def),
+ if (qemuDomainHelperGetVcpus(dom, cpuinfo, cpuwait,
+ virDomainDefGetVcpus(dom->def),
NULL, 0) < 0) {
virResetLastError();
ret = 0; /* it's ok to be silent and go ahead */
@@ -19083,12 +19166,21 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
param_name,
cpuinfo[i].cpuTime) < 0)
goto cleanup;
+ snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "vcpu.%zu.wait", i);
+ if (virTypedParamsAddULLong(&record->params,
+ &record->nparams,
+ maxparams,
+ param_name,
+ cpuwait[i]) < 0)
+ goto cleanup;
}
ret = 0;
cleanup:
VIR_FREE(cpuinfo);
+ VIR_FREE(cpuwait);
return ret;
}
--
2.5.0
8 years, 10 months