[libvirt] Redesigning Libvirt: Adapting for the next 12 years
by Daniel P. Berrange
Hold tight, this is a long one...
It is hard for me to believe it, but the libvirt project is now 12 years old
(born on Nov 2, 2005), and I've been working on it since March 2006, making it
easily the most significant project I've worked on. It started off life as an
attempt to provide a stable application development API for the Xen hypervisor,
interfacing across XenD, XenStore and Xen hypercalls. It was initially just a
plain C library and Python binding, but when we added QEMU support in Feb 2007
the libvirtd daemon was born. That cemented a split of hypervisor drivers into
two distinct architectures, stateless drivers where all logic was in the library
(VMware ESX, VirtualBox, original Xen) and stateful drivers where all logic was
in the daemon (QEMU, LXC, UML, modern Xen).
The project has been wildly successful beyond our expectations, in particular
the hypervisor abstraction layer made it possible for RHEL to switch from using
Xen to KVM while keeping the userspace tooling the same for users. Libvirt is
now used, to some degree, by likely 100's of applications with KVM being the
dominant hypervisor choice by a long way. There is an old adage in the computer
industry though
"Adapt or die"
This is usually applied to companies who see their primary product suddenly
become a commodity, or disappear into irrelevance as new technology disrupts
the market, killing their revenue stream. It is, however, just as reasonable to
apply this to open source projects which can see their core usage scenarios
disrupted by new startup projects & technologies. While the open source code
will never go away, the companies who pay for the project's developers can
quickly reassign them elsewhere, seriously harming the viability of the
community thereafter.
IOW, while Libvirt has seen 12 years of great success, we must not be so naive
to assume we are going to see another 12 years without being disrupted.
Over time we've done alot of work refactoring libvirt code to introduce new
concepts and support new hypervisor targets, but I think its fair to say that at
a high level the architecture is unchanged since we first introduced libvirtd,
and then its multithreaded internals in the 2006-2008 timeframe. We've taken a
fairly conservative, evolutionary approach to our changes. This is good, because
providing stability to our users is a critically important reason for libvirt to
exist. This is bad, because we've not been willing to take risks in short term
that could potentially be very beneficial in the long term (5-10 year time).
I think that now is the time to consider some major architectural changes in the
approach we take. There's no single reason, rather a combination of factors all
coming together to form a compelling case for ambitious change.
Before going further though, I want to highlight one important point:
I am NOT suggesting changing the public API or the XML format in a backwards
incompatible manner. API & XML stability is the single most important part of
libvirt and MUST be maintained on a par with that's available today. IOW we can
add new features, but can't remove what's there already. This even leaves the
door open for providing a libvirt2.so, provided we're willing to still maintain
libvirt.so indefinitely alongside, though that's not something I'd encourage.
The majority of the hard problems we face are not in the API design, or in the
XML format, so that's not a significant limiting factor IMHO.
There are three core areas of libvirt I see that are problematic, and where
the fixes have major implications.
At a very high level what I'm going to suggest is
- Expose key hypervisor specific concepts as fully supported features to
applications. In particular provide a way for an application to launch
QEMU processes directly in their process execution environment, rather
than as a child of libvirtd.
- Explode the libvirtd daemon into a swarm of independant daemons. This
would provide a more reliable system where a single bug doesn't take
out the entire libvirt management daemon. It would allow for better
security isolation of components. It would let session libvirtd
use system daemons for networking & hostdev setup
- Adopt use of Go and gradually convert (all|most) our C code into Go.
This would improve the reliablity of libvirt, by giving us a memory
safe language with garbage collection. It would improve productivity
by letting us spend more time writing interesting code, rather than
wasting time on platform portability or building basic abstractions
for things like OO programming, hash tables, etc (much of the stuff
we have in src/util), no more XML parsers needed (just annotated
struct fields). It would increase the talent pool of potential
contributors to libvirt by lowering the bar to getting work done.
To avoid this mail getting too long, I'll cover each area in a separate mail.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
7 years, 5 months
[libvirt] [PATCH v3 00/28] Fix serial console behavior on non-x86 architectures
by Andrea Bolognani
Happy birthday to me.
Changes from [v2]:
* don't drop -serial suffix from existing target types;
* add capability and machine type checks for isa-serial;
* reduce code duplication;
* improve documentation.
Changes from [v1]:
* introduce target model to go along with target type and
store the actual hypervisor-specific device name, as
suggested by Pavel;
* shorten the names of the esisting target types;
* introduce a bunch of additional cleanups required for the
first item.
[v1] https://www.redhat.com/archives/libvir-list/2017-November/msg00545.html
[v2] https://www.redhat.com/archives/libvir-list/2017-November/msg00831.html
Andrea Bolognani (24):
docs: Improve documentation for serial consoles
qemu: Introduce qemuDomainChrDefPostParse()
conf: Run devicePostParse() again for the first serial device
conf: Introduce VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE
conf: Drop virDomainChrDeviceType.targetTypeAttr
conf: Introduce virDomainChrTargetDefFormat()
conf: Improve error handling in virDomainChrDefFormat()
conf: Check virDomainChrSourceDefFormat() return value
conf: Improve virDomainChrTargetDefFormat()
conf: Remove ATTRIBUTE_FALLTHROUGH from virDomainChrTargetDefFormat()
qemu: Introduce qemuDomainChrTargetDefValidate()
qemu: Improve qemuDomainChrTargetDefValidate()
conf: Parse and format virDomainChrSerialTargetModel
qemu: Set targetModel based on targetType for serial devices
qemu: Validate target model for serial devices
qemu: Format targetModel for serial devices
qemu: Remove redundancy in qemuBuildSerialChrDeviceStr()
conf: Add target type and model for spapr-vty
qemu: Support usb-serial and pci-serial on pSeries
conf: Add target type and model for pl011
qemu: Add QEMU_CAPS_DEVICE_ISA_SERIAL
qemu: Require QEMU_CAPS_DEVICE_ISA_SERIAL for isa-serial
qemu: Limit isa-serial usage to x86 guests
news: Update for serial console fixes
Pino Toscano (4):
conf: add VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP
conf: pass parseFlags down to virDomainDefAddConsoleCompat
conf: convert sclp/sclplm <console> as <serial>
qemu: switch s390/s390x default console back to serial
docs/formatdomain.html.in | 233 ++++++++++++----
docs/news.xml | 12 +
docs/schemas/domaincommon.rng | 22 ++
src/conf/domain_conf.c | 304 ++++++++++++++++-----
src/conf/domain_conf.h | 26 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 134 ++++-----
src/qemu/qemu_domain.c | 301 ++++++++++++++++++--
src/qemu/qemu_domain_address.c | 7 +-
src/vz/vz_sdk.c | 5 +-
.../qemuargv2xml-console-compat.xml | 4 +-
tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml | 4 +-
.../qemuargv2xmldata/qemuargv2xml-serial-file.xml | 4 +-
.../qemuargv2xmldata/qemuargv2xml-serial-many.xml | 8 +-
tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml | 4 +-
.../qemuargv2xml-serial-tcp-telnet.xml | 4 +-
tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml | 4 +-
tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml | 8 +-
.../qemuargv2xmldata/qemuargv2xml-serial-unix.xml | 4 +-
tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml | 4 +-
tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 +
.../caps_2.10.0-gicv2.aarch64.xml | 1 +
.../caps_2.10.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
tests/qemuhelptest.c | 5 +
...otplug-console-compat-2-live+console-virtio.xml | 12 +-
.../qemuhotplug-console-compat-2-live.xml | 12 +-
.../qemuxml2argv-mach-virt-console-native.args | 1 +
.../qemuxml2argv-mach-virt-console-native.xml | 17 ++
... => qemuxml2argv-mach-virt-console-virtio.args} | 15 +-
.../qemuxml2argv-mach-virt-console-virtio.xml | 19 ++
...muxml2argv-mach-virt-serial+console-native.args | 1 +
...emuxml2argv-mach-virt-serial+console-native.xml | 18 ++
.../qemuxml2argv-mach-virt-serial-compat.args | 1 +
.../qemuxml2argv-mach-virt-serial-compat.xml | 19 ++
...muxml2argv-mach-virt-serial-invalid-machine.xml | 21 ++
...s => qemuxml2argv-mach-virt-serial-native.args} | 12 +-
.../qemuxml2argv-mach-virt-serial-native.xml | 16 ++
.../qemuxml2argv-mach-virt-serial-pci.args | 26 ++
.../qemuxml2argv-mach-virt-serial-pci.xml | 18 ++
.../qemuxml2argv-mach-virt-serial-usb.args | 27 ++
.../qemuxml2argv-mach-virt-serial-usb.xml | 21 ++
.../qemuxml2argv-pseries-basic.args | 2 +-
.../qemuxml2argv-pseries-console-native.args | 1 +
.../qemuxml2argv-pseries-console-native.xml | 17 ++
...gs => qemuxml2argv-pseries-console-virtio.args} | 10 +-
.../qemuxml2argv-pseries-console-virtio.xml | 19 ++
.../qemuxml2argv-pseries-cpu-compat-power9.args | 2 +-
.../qemuxml2argv-pseries-cpu-compat.args | 2 +-
.../qemuxml2argv-pseries-cpu-exact.args | 2 +-
.../qemuxml2argv-pseries-cpu-le.args | 2 +-
.../qemuxml2argv-pseries-panic-missing.args | 2 +-
.../qemuxml2argv-pseries-panic-no-address.args | 2 +-
...qemuxml2argv-pseries-serial+console-native.args | 1 +
.../qemuxml2argv-pseries-serial+console-native.xml | 18 ++
.../qemuxml2argv-pseries-serial-compat.args | 1 +
.../qemuxml2argv-pseries-serial-compat.xml | 19 ++
...qemuxml2argv-pseries-serial-invalid-machine.xml | 19 ++
...rgs => qemuxml2argv-pseries-serial-native.args} | 7 +-
.../qemuxml2argv-pseries-serial-native.xml | 16 ++
...c.args => qemuxml2argv-pseries-serial-pci.args} | 7 +-
.../qemuxml2argv-pseries-serial-pci.xml | 18 ++
...c.args => qemuxml2argv-pseries-serial-usb.args} | 8 +-
.../qemuxml2argv-pseries-serial-usb.xml | 21 ++
.../qemuxml2argv-pseries-usb-default.args | 2 +-
.../qemuxml2argv-pseries-usb-kbd.args | 2 +-
.../qemuxml2argv-pseries-usb-multi.args | 2 +-
.../qemuxml2argv-pseries-vio-user-assigned.args | 4 +-
.../qemuxml2argvdata/qemuxml2argv-pseries-vio.args | 4 +-
....args => qemuxml2argv-s390-console2serial.args} | 11 +-
.../qemuxml2argv-s390-console2serial.xml | 19 ++
...power9.args => qemuxml2argv-s390-serial-2.args} | 14 +-
.../qemuxml2argv-s390-serial-2.xml | 19 ++
....args => qemuxml2argv-s390-serial-console.args} | 11 +-
.../qemuxml2argv-s390-serial-console.xml | 15 +
...es-basic.args => qemuxml2argv-s390-serial.args} | 11 +-
.../qemuxml2argvdata/qemuxml2argv-s390-serial.xml | 14 +
...muxml2argv-serial-tcp-tlsx509-chardev-notls.xml | 8 +-
.../qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 8 +-
tests/qemuxml2argvtest.c | 101 ++++++-
.../qemuxml2xmlout-aarch64-pci-serial.xml | 4 +-
.../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 4 +-
.../qemuxml2xmlout-bios-nvram-os-interleave.xml | 4 +-
.../qemuxml2xmlout-chardev-label.xml | 8 +-
.../qemuxml2xmlout-console-compat-auto.xml | 4 +-
.../qemuxml2xmlout-console-compat.xml | 4 +-
.../qemuxml2xmlout-console-compat2.xml | 4 +-
.../qemuxml2xmlout-console-virtio-many.xml | 4 +-
.../qemuxml2xmlout-interface-driver.xml | 4 +-
.../qemuxml2xmlout-interface-server.xml | 8 +-
.../qemuxml2xmlout-mach-virt-console-native.xml | 1 +
...=> qemuxml2xmlout-mach-virt-console-virtio.xml} | 19 +-
...uxml2xmlout-mach-virt-serial+console-native.xml | 1 +
.../qemuxml2xmlout-mach-virt-serial-compat.xml | 31 +++
.../qemuxml2xmlout-mach-virt-serial-native.xml | 1 +
...xml => qemuxml2xmlout-mach-virt-serial-pci.xml} | 15 +-
.../qemuxml2xmlout-mach-virt-serial-usb.xml | 41 +++
.../qemuxml2xmlout-net-bandwidth.xml | 4 +-
.../qemuxml2xmlout-net-bandwidth2.xml | 4 +-
.../qemuxml2xmlout-net-coalesce.xml | 4 +-
.../qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml | 4 +-
.../qemuxml2xmlout-panic-pseries.xml | 4 +-
.../qemuxml2xmlout-pci-serial-dev-chardev.xml | 4 +-
.../qemuxml2xmlout-pseries-console-native.xml | 1 +
...l => qemuxml2xmlout-pseries-console-virtio.xml} | 16 +-
.../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 4 +-
.../qemuxml2xmlout-pseries-cpu-compat.xml | 4 +-
.../qemuxml2xmlout-pseries-cpu-exact.xml | 4 +-
.../qemuxml2xmlout-pseries-panic-missing.xml | 4 +-
.../qemuxml2xmlout-pseries-panic-no-address.xml | 4 +-
...emuxml2xmlout-pseries-serial+console-native.xml | 1 +
.../qemuxml2xmlout-pseries-serial-compat.xml | 1 +
...ml => qemuxml2xmlout-pseries-serial-native.xml} | 10 +-
...g.xml => qemuxml2xmlout-pseries-serial-pci.xml} | 16 +-
...g.xml => qemuxml2xmlout-pseries-serial-usb.xml} | 13 +-
.../qemuxml2xmlout-q35-virt-manager-basic.xml | 4 +-
.../qemuxml2xmlout-s390-defaultconsole.xml | 8 +-
.../qemuxml2xmlout-s390-serial-2.xml | 33 +++
.../qemuxml2xmlout-s390-serial-console.xml | 28 ++
.../qemuxml2xmlout-s390-serial.xml | 28 ++
.../qemuxml2xmlout-serial-spiceport-nospice.xml | 4 +-
.../qemuxml2xmlout-serial-spiceport.xml | 4 +-
.../qemuxml2xmlout-serial-target-port-auto.xml | 12 +-
.../qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml | 8 +-
.../qemuxml2xmlout-tap-vhost-incorrect.xml | 4 +-
.../qemuxml2xmlout-tap-vhost.xml | 4 +-
.../qemuxml2xmlout-vhost_queues.xml | 4 +-
tests/qemuxml2xmltest.c | 54 ++++
147 files changed, 1883 insertions(+), 391 deletions(-)
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-mach-virt-console-virtio.args} (53%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-machine.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-mach-virt-serial-native.args} (62%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-pseries-console-virtio.args} (59%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machine.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-pseries-serial-native.args} (70%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-pseries-serial-pci.args} (70%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-pseries-serial-usb.args} (65%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-s390-console2serial.args} (71%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-console2serial.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-cpu-compat-power9.args => qemuxml2argv-s390-serial-2.args} (62%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-s390-serial-console.args} (71%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml
copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-basic.args => qemuxml2argv-s390-serial.args} (71%)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.xml
copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-s390-defaultconsole.xml => qemuxml2xmlout-mach-virt-console-virtio.xml} (50%)
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+console-native.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml
copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-aarch64-pci-serial.xml => qemuxml2xmlout-mach-virt-serial-pci.xml} (78%)
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml
copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-panic-pseries.xml => qemuxml2xmlout-pseries-console-virtio.xml} (75%)
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console-native.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml
copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-pseries-panic-missing.xml => qemuxml2xmlout-pseries-serial-native.xml} (82%)
copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-pseries-panic-missing.xml => qemuxml2xmlout-pseries-serial-pci.xml} (74%)
copy tests/qemuxml2xmloutdata/{qemuxml2xmlout-pseries-panic-missing.xml => qemuxml2xmlout-pseries-serial-usb.xml} (75%)
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml
--
2.14.3
7 years, 5 months
[libvirt] Plans for next releases
by Daniel Veillard
So November went through faster than expected and we are already a bit late
w.r.t. freezing for the release. I suggest to do this at the end of the day,
have RC2 on Thursday late or fFriday and the release over the week-end.
Then for Jan/Feb as usual between the end of year breaks and the short
month of February, egt only one release mid January, and the next one for
end of February,
hope this works for everybody,
thanks,
Daniel
--
Daniel Veillard | Red Hat Developers Tools http://developer.redhat.com/
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
7 years, 5 months
[libvirt] [PATCH] Adding POWER9 DD1.0/DD2.0 PVR value to cpu_map.xml
by Seeteena Thoufeek
DD1.0/DD2.0 PVR value is missing from cpu_map.xml. This patch
provides those details
Signed-off-by: Seeteena Thoufeek <s1seetee(a)linux.vnet.ibm.com>
---
src/cpu/cpu_map.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index e5da7a8..e4e4e68 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -1729,6 +1729,8 @@
<model name='POWER9'>
<vendor name='IBM'/>
<pvr value='0x004e0000' mask='0xffff0000'/>
+ <pvr value='0x004e0100' mask='0xffff0000'/>
+ <pvr value='0x004e0200' mask='0xffff0000'/>
</model>
<!-- Freescale-based CPU models -->
--
1.8.3.1
7 years, 5 months
[libvirt] [PATCH v2] qemu_domain: Error out eariler when configuring IDE controller incorrectly
by Lin Ma
Move error handling of IDE controller from qemuBuildControllerDevStr to
qemuDomainDeviceDefValidate for reminding users eariler.
Signed-off-by: Lin Ma <lma(a)suse.com>
---
src/qemu/qemu_command.c | 17 -----------------
src/qemu/qemu_domain.c | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b1cfafa79..463952d9b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3106,23 +3106,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
}
break;
- case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
- /* Since we currently only support the integrated IDE
- * controller on various boards, if we ever get to here, it's
- * because some other machinetype had an IDE controller
- * specified, or one with a single IDE contraller had multiple
- * ide controllers specified.
- */
- if (qemuDomainHasBuiltinIDE(domainDef))
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Only a single IDE controller is supported "
- "for this machine type"));
- else
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("IDE controllers are unsupported for "
- "this QEMU binary or machine type"));
- goto error;
-
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported controller type: %s"),
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ece8ee7dd..d0be2afaf 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3539,6 +3539,29 @@ qemuDomainWatchdogDefValidate(const virDomainWatchdogDef *dev,
}
+static int
+qemuDomainControllerDefValidate(const virDomainControllerDefPtr controller,
+ const virDomainDef *def)
+{
+ if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE) {
+ if (qemuDomainHasBuiltinIDE(def) && controller->idx != 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only a single IDE controller is supported "
+ "for this machine type"));
+ return -1;
+ }
+ if (qemuDomainIsQ35(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("IDE controllers are unsupported for q35 "
+ "machine type"));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def,
@@ -3650,6 +3673,9 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
} else if (dev->type == VIR_DOMAIN_DEVICE_WATCHDOG) {
if (qemuDomainWatchdogDefValidate(dev->data.watchdog, def) < 0)
goto cleanup;
+ } else if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
+ if (qemuDomainControllerDefValidate(dev->data.controller, def) < 0)
+ goto cleanup;
}
/* forbid capabilities mode hostdev in this kind of hypervisor */
--
2.14.0
7 years, 5 months
[libvirt] [PATCH] news: Document qemu image locking
by Peter Krempa
---
docs/news.xml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 81b7b68f95..76dfc92a20 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -135,6 +135,19 @@
can prepare the files if they need to do so.
</description>
</change>
+ <change>
+ <summary>
+ Shareable disks work properly with recent qemu
+ </summary>
+ <description>
+ Recent qemu versions added image locking to avoid potential corruption
+ of disk images. This broke shareable disks with libvirt since the
+ feature was turned on by default in qemu. Libvirt now enables sharing
+ of those disks in qemu so that the image locking is not applied in
+ that case. Additionally libvirt now checks that shareable disks have
+ supported format (raw) to avoid metadata corruption.
+ </description>
+ </change>
</section>
<section title="Bug fixes">
<change>
--
2.14.3
7 years, 5 months
[libvirt] [PATCH] qemu: Add support for hot unplug redirdev device
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
We lacked of hot unplugging redirdev device.
This patch adds support for it.
We could use detach-device --live now.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/qemu/qemu_driver.c | 4 +-
src/qemu/qemu_hotplug.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_hotplug.h | 3 ++
3 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6132bc4a9..2628699d8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7786,6 +7786,9 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_INPUT:
ret = qemuDomainDetachInputDevice(vm, dev->data.input);
break;
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
+ ret = qemuDomainDetachRedirdevDevice(driver, vm, dev->data.redirdev);
+ break;
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_SOUND:
@@ -7795,7 +7798,6 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
- case VIR_DOMAIN_DEVICE_REDIRDEV:
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index ce63b4a4d..497d7284b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4281,6 +4281,74 @@ qemuDomainRemoveInputDevice(virDomainObjPtr vm,
return 0;
}
+static int
+qemuDomainRemoveRedirdevDevice(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainRedirdevDefPtr redirdev)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ virObjectEventPtr event;
+ char *charAlias = NULL;
+ char *tlsAlias = NULL;
+ char *secAlias = NULL;
+ ssize_t idx;
+ int ret = -1;
+
+ VIR_DEBUG("Removing redirdev device %s from domain %p %s",
+ redirdev->info.alias, vm, vm->def->name);
+
+ if (!(charAlias = qemuAliasChardevFromDevAlias(redirdev->info.alias)))
+ goto cleanup;
+
+ if (redirdev->source->type == VIR_DOMAIN_CHR_TYPE_TCP &&
+ redirdev->source->data.tcp.haveTLS == VIR_TRISTATE_BOOL_YES) {
+
+ if (!(tlsAlias = qemuAliasTLSObjFromSrcAlias(charAlias)))
+ goto cleanup;
+
+ /* Best shot at this as the secinfo is destroyed after process launch
+ * and this path does not recreate it. Thus, if the config has the
+ * secret UUID and we have a serial TCP chardev, then formulate a
+ * secAlias which we'll attempt to destroy. */
+ if (cfg->chardevTLSx509secretUUID &&
+ !(secAlias = qemuDomainGetSecretAESAlias(charAlias, false)))
+ goto cleanup;
+ }
+
+ qemuDomainObjEnterMonitor(driver, vm);
+ /* Usually device_del will remove related chardev as well,
+ * So we don't need to check its return value.
+ */
+ ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias));
+
+ if (tlsAlias)
+ ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
+ if (secAlias)
+ ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
+
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ goto cleanup;
+
+ virDomainAuditRedirdev(vm, redirdev, "detach", true);
+
+ event = virDomainEventDeviceRemovedNewFromObj(vm, redirdev->info.alias);
+ qemuDomainEventQueue(driver, event);
+
+ if ((idx = virDomainRedirdevDefFind(vm->def, redirdev)) >= 0)
+ virDomainRedirdevDefRemove(vm->def, idx);
+ qemuDomainReleaseDeviceAddress(vm, &redirdev->info, NULL);
+ virDomainRedirdevDefFree(redirdev);
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(charAlias);
+ VIR_FREE(tlsAlias);
+ VIR_FREE(secAlias);
+ return ret;
+}
+
int
qemuDomainRemoveDevice(virQEMUDriverPtr driver,
@@ -5018,6 +5086,49 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
return ret;
}
+int
+qemuDomainDetachRedirdevDevice(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainRedirdevDefPtr redirdev)
+{
+ int ret = -1;
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ virDomainDefPtr vmdef = vm->def;
+ virDomainRedirdevDefPtr tmpRedirdevDef;
+ ssize_t idx;
+
+ if ((idx = virDomainRedirdevDefFind(vmdef, redirdev)) < 0) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("no matching redirdev was not found"));
+ return -1;
+ }
+
+ tmpRedirdevDef = vm->def->redirdevs[idx];
+
+ if (!tmpRedirdevDef->info.alias) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("alias not set for redirdev device"));
+ return -1;
+ }
+
+ qemuDomainMarkDeviceForRemoval(vm, &tmpRedirdevDef->info);
+
+ qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuMonitorDelDevice(priv->mon, tmpRedirdevDef->info.alias) < 0) {
+ ignore_value(qemuDomainObjExitMonitor(driver, vm));
+ goto cleanup;
+ }
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ goto cleanup;
+
+ if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
+ ret = qemuDomainRemoveRedirdevDevice(driver, vm, tmpRedirdevDef);
+
+ cleanup:
+ qemuDomainResetDeviceRemoval(vm);
+ return ret;
+}
+
int
qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index 3e0d618e0..6c642c4fd 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -125,6 +125,9 @@ int qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
int qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainWatchdogDefPtr watchdog);
+int qemuDomainDetachRedirdevDevice(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainRedirdevDefPtr redirdev);
int qemuDomainAttachInputDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
--
2.13.6
7 years, 5 months
[libvirt] New QEMU daemon for persistent reservations
by Paolo Bonzini
Hi all,
I am adding a new daemon to QEMU, that QEMU can connect to in order to
issue persistent reservation commands.
The daemon can only issue the commands on file descriptor that QEMU
already has. In addition normal users shouldn't have access to the
daemon's Unix socket in /run, so the daemon is protected against misuse.
My question is what is the best way to handle the connection to the
daemon socket. Currently, the path to the socket is passed to QEMU on
the command line:
-object pr-manager-helper,id=mgr,path=/run/qemu-pr-helper.sock \
-drive if=none,id=hd,driver=raw,filename=/dev/sdb,file.pr-manager=mgr \
-device scsi-block,drive=hd
(the new parts are "-object pr-manager-helper" and "file.pr-manager").
I could just make it root:root and pass a file descriptor from libvirt
to QEMU, but this would make it impossible for QEMU to reconnect to the
daemon in case someone does a "systemctl restart" or even just kills it
inadvertently. The daemon is stateless, so transparent reconnection
would be a nice feature to have.
The alternative is to somehow label the daemon socket so that it can be
accessed by QEMU, but I'm not very well versed in SELinux.
Any ideas?
Paolo
7 years, 5 months
[libvirt] [PATCH] s390: qemu-capabilities: Avoid error message when missing non-kvm host cpu info
by Boris Fiuczynski
From: "Jason J. Herne" <jjherne(a)linux.vnet.ibm.com>
Libvirt prints an error on startup when it is missing host cpu model
information for any queried qemu binary. On s390 we only have host cpu model
information for kvm enabled qemu instances. So when virt type is not kvm, this
is actually not an error on s390.
This patch adds virt type as a parameter to virQEMUCapsInitCPUModelS390, and a
new return code 2 for virQEMUCapsInitCPUModel and virQEMUCapsInitCPUModelS390.
If the virt type is not kvm then we skip printing the scary error message
and return 2 because this case is actually expected behavior. The new return
code is meant to differentiate between the failure case and the case where we
simply expect the cpu model information to be unattainable.
Signed-off-by: Jason J. Herne <jjherne(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
---
src/qemu/qemu_capabilities.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3adea66..b073841 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3306,22 +3306,28 @@ virQEMUCapsCPUFilterFeatures(const char *name,
/**
* Returns 0 when host CPU model provided by QEMU was filled in qemuCaps,
* 1 when the caller should fall back to using virCapsPtr->host.cpu,
+ * 2 when cpu model info is not supported for this configuration and
+ * fall back should not be used.
* -1 on error.
*/
static int
virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
qemuMonitorCPUModelInfoPtr modelInfo,
virCPUDefPtr cpu,
- bool migratable)
+ bool migratable,
+ virDomainVirtType type)
{
size_t i;
if (!modelInfo) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("missing host CPU model info from QEMU capabilities "
- "for binary %s"),
- qemuCaps->binary);
- return -1;
+ if (type == VIR_DOMAIN_VIRT_KVM) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("missing host CPU model info from QEMU "
+ "capabilities for binary %s"),
+ qemuCaps->binary);
+ return -1;
+ }
+ return 2;
}
if (VIR_STRDUP(cpu->model, modelInfo->name) < 0 ||
@@ -3429,6 +3435,8 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
/**
* Returns 0 when host CPU model provided by QEMU was filled in qemuCaps,
* 1 when the caller should fall back to other methods
+ * 2 when cpu model info is not supported for this configuration and
+ * fall back should not be used.
* -1 on error.
*/
int
@@ -3445,13 +3453,13 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
if (ARCH_IS_S390(qemuCaps->arch)) {
ret = virQEMUCapsInitCPUModelS390(qemuCaps, cpuData->info,
- cpu, migratable);
+ cpu, migratable, type);
} else if (ARCH_IS_X86(qemuCaps->arch)) {
ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, cpuData->info,
cpu, migratable);
}
- if (ret == 0)
+ if (ret == 0 || ret == 2)
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
return ret;
@@ -3504,6 +3512,12 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
virQEMUCapsCPUFilterFeatures,
&qemuCaps->arch) < 0)
goto error;
+ } else if (rc == 2) {
+ VIR_DEBUG("Qemu does not provide cpu model for arch=%s virttype=%s",
+ virArchToString(qemuCaps->arch),
+ virDomainVirtTypeToString(type));
+ virCPUDefFree(cpu);
+ goto cleanup;
} else if (type == VIR_DOMAIN_VIRT_KVM &&
virCPUGetHostIsSupported(qemuCaps->arch)) {
if (!(fullCPU = virCPUGetHost(qemuCaps->arch, VIR_CPU_TYPE_GUEST,
--
2.9.4
7 years, 5 months
[libvirt] [PATCH] virsh: fixing virsh prompt when connection changes to readonly mode.
by Julio Faracco
This commit, fixes the virsh prompt when reconnection to the same URI is
called: `virsh # connect --readonly` (Reconnect). The problem is happening
because the code is considering URI (name) as a mandatory parameter to change
the prompt. This commit remove the assignment into `priv->readonly` from
`if (name)` conditional.
Before:
virsh # uri
qemu:///system
virsh # connect --readonly
virsh #
After:
virsh # uri
qemu:///system
virsh # connect --readonly
virsh >
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1507737
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
tools/virsh.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index d1789f0..89a2bea 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -251,8 +251,10 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force)
if (name) {
VIR_FREE(ctl->connname);
ctl->connname = vshStrdup(ctl, name);
- priv->readonly = readonly;
}
+
+ priv->readonly = readonly;
+
if (virConnectRegisterCloseCallback(priv->conn, virshCatchDisconnect,
ctl, NULL) < 0)
vshError(ctl, "%s", _("Unable to register disconnect callback"));
--
2.7.4
7 years, 5 months