[libvirt] [PATCH v3 0/3] qemu: Fix hotplug of guest agent
by Martin Kletzander
v3:
- Change qemuhotplugtest so that it runs tests of live hotplug in
every case, not only in the new one.
- https://www.redhat.com/archives/libvir-list/2016-June/msg00109.html
v2:
- mostly a rebase, it was almost ACKed but not completely, just to
make sure let's see it again with everything done.
- use /tmp for paths in tests (automatically fixed by rebasing on top
of commit 1893b6df117b)
- https://www.redhat.com/archives/libvir-list/2016-April/msg01911.html
v1:
- https://www.redhat.com/archives/libvir-list/2016-March/msg01454.html
Martin Kletzander (3):
qemu: Move channel path generation out of command creation
qemuhotplugtest: Test live data
qemu: Generate channel target paths on hotplug as well
src/qemu/qemu_command.c | 25 ++----------
src/qemu/qemu_command.h | 5 +--
src/qemu/qemu_domain.c | 20 ++++++++++
src/qemu/qemu_domain.h | 4 ++
src/qemu/qemu_hotplug.c | 3 ++
src/qemu/qemu_process.c | 12 ++++--
tests/qemuhotplugtest.c | 45 +++++++++++++---------
...tplug-console-compat-2-live+console-virtio.xml} | 36 ++++++++++++++---
...qemuhotplug-hotplug-base+qemu-agent-detach.xml} | 36 ++++++++++-------
...xml => qemuhotplug-hotplug-base+qemu-agent.xml} | 36 ++++++++++-------
...=> qemuhotplug-hotplug-base-live+disk-scsi.xml} | 24 +++++++++---
... => qemuhotplug-hotplug-base-live+disk-usb.xml} | 24 +++++++++---
... qemuhotplug-hotplug-base-live+disk-virtio.xml} | 24 +++++++++---
...otplug-hotplug-base-live+qemu-agent-detach.xml} | 36 ++++++++++-------
...> qemuhotplug-hotplug-base-live+qemu-agent.xml} | 36 ++++++++++-------
.../qemuhotplug-qemu-agent-detach.xml | 5 +++
.../qemuhotplugtestdata/qemuhotplug-qemu-agent.xml | 5 +++
.../qemuxml2argv-console-compat-2-live.xml} | 37 ++++++++++++++----
.../qemuxml2argv-hotplug-base-live.xml} | 30 ++++++++-------
19 files changed, 303 insertions(+), 140 deletions(-)
copy tests/qemuhotplugtestdata/{qemuhotplug-console-compat-2+console-virtio.xml => qemuhotplug-console-compat-2-live+console-virtio.xml} (79%)
copy tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-scsi.xml => qemuhotplug-hotplug-base+qemu-agent-detach.xml} (59%)
copy tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-scsi.xml => qemuhotplug-hotplug-base+qemu-agent.xml} (60%)
copy tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-scsi.xml => qemuhotplug-hotplug-base-live+disk-scsi.xml} (73%)
rename tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-usb.xml => qemuhotplug-hotplug-base-live+disk-usb.xml} (72%)
rename tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-virtio.xml => qemuhotplug-hotplug-base-live+disk-virtio.xml} (73%)
copy tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-scsi.xml => qemuhotplug-hotplug-base-live+qemu-agent-detach.xml} (59%)
copy tests/qemuhotplugtestdata/{qemuhotplug-hotplug-base+disk-scsi.xml => qemuhotplug-hotplug-base-live+qemu-agent.xml} (60%)
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-qemu-agent-detach.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-qemu-agent.xml
rename tests/{qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml => qemuxml2argvdata/qemuxml2argv-console-compat-2-live.xml} (80%)
rename tests/{qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-scsi.xml => qemuxml2argvdata/qemuxml2argv-hotplug-base-live.xml} (71%)
--
2.8.3
8 years, 5 months
[libvirt] [PATCH 00/41] Another round of CPU driver patches
by Jiri Denemark
This time it's mostly about CPU detection tests.
Jiri Denemark (41):
cpu_x86: Propagate vendor to guest's virCPUData
cpu_x86: Fix CPU data parser
cpu: Detect arch when parsing CPU data
cpu_x86: Rename CPUID function to eax_in
qemu: Refactor qemuMonitorJSONGetCPUx86Data
tests: Introduce qemuMonitorTestNewFromFile
tests: Fix "Reponse" typo
tests: Create simple monitor in qemuMonitorTestNewFromFile
cpu_x86: Avoid unnecessary pointers to virCPUx86Data
cpu_ppc64: Avoid unnecessary pointer to virCPUppc64Data
cpu_x86: Refactor internal KVM features
tests: Add CPU detection tests
tests: Add CPU detection test for AMD A10-5800K
tests: Add CPU detection test for Intel Atom D510
tests: Add CPU detection test for Intel Atom N450
tests: Add CPU detection test for Intel Core i5-2500
tests: Add CPU detection test for Intel Core i5-2540M
tests: Add CPU detection test for Intel Core i5-4670T
tests: Add CPU detection test for Intel Core i5-6600
tests: Add CPU detection test for Intel Core i7-2600
tests: Add CPU detection test for Intel Core i7-3520M
tests: Add CPU detection test for Intel Core i7-3740QM
tests: Add CPU detection test for Intel Core i7-3770
tests: Add CPU detection test for Intel Core i7-4600U
tests: Add CPU detection test for Intel Core i7-5600U
tests: Add CPU detection test for Intel Core2 Duo E6850
tests: Add CPU detection test for Intel Core2 Quad Q9500
tests: Add CPU detection test for AMD FX 8150
tests: Add CPU detection test for AMD Opteron 1352
tests: Add CPU detection test for AMD Opteron 2350
tests: Add CPU detection test for AMD Opteron 6234
tests: Add CPU detection test for AMD Opteron 6282 SE
tests: Add CPU detection test for Intel Pentium P6100
tests: Add CPU detection test for AMD Phenom II X4 B95
tests: Add CPU detection test for Intel Xeon 5110
tests: Add CPU detection test for Intel Xeon E3-1245
tests: Add CPU detection test for Intel Xeon E5-2630
tests: Add CPU detection test for Intel Xeon E5-2650
tests: Add CPU detection test for Intel Xeon E7-4820
tests: Add CPU detection test for Intel Xeon W3520
tests: Add CPU detection test for Intel Xeon X5460
src/cpu/cpu.c | 54 ++-
src/cpu/cpu.h | 11 +-
src/cpu/cpu_map.xml | 224 ++++-----
src/cpu/cpu_ppc64.c | 65 +--
src/cpu/cpu_ppc64_data.h | 2 +
src/cpu/cpu_x86.c | 530 ++++++++++-----------
src/cpu/cpu_x86.h | 4 +-
src/cpu/cpu_x86_data.h | 4 +-
src/libvirt_private.syms | 2 +-
src/qemu/qemu_monitor_json.c | 150 +++---
src/qemu/qemu_monitor_json.h | 4 +
tests/Makefile.am | 4 +
tests/cputest.c | 186 +++++++-
tests/cputestdata/cpu-gather.sh | 35 ++
tests/cputestdata/cpu-parse.sh | 57 +++
tests/cputestdata/x86-cpuid-A10-5800K-guest.xml | 26 +
tests/cputestdata/x86-cpuid-A10-5800K-host.xml | 26 +
tests/cputestdata/x86-cpuid-A10-5800K-json.xml | 16 +
tests/cputestdata/x86-cpuid-A10-5800K.json | 77 +++
tests/cputestdata/x86-cpuid-A10-5800K.xml | 50 ++
tests/cputestdata/x86-cpuid-Atom-D510-guest.xml | 20 +
tests/cputestdata/x86-cpuid-Atom-D510-host.xml | 21 +
tests/cputestdata/x86-cpuid-Atom-D510.xml | 27 ++
tests/cputestdata/x86-cpuid-Atom-N450-guest.xml | 21 +
tests/cputestdata/x86-cpuid-Atom-N450-host.xml | 22 +
tests/cputestdata/x86-cpuid-Atom-N450.xml | 27 ++
tests/cputestdata/x86-cpuid-Core-i5-2500-guest.xml | 24 +
tests/cputestdata/x86-cpuid-Core-i5-2500-host.xml | 24 +
tests/cputestdata/x86-cpuid-Core-i5-2500-json.xml | 9 +
tests/cputestdata/x86-cpuid-Core-i5-2500.json | 88 ++++
tests/cputestdata/x86-cpuid-Core-i5-2500.xml | 34 ++
.../cputestdata/x86-cpuid-Core-i5-2540M-guest.xml | 24 +
tests/cputestdata/x86-cpuid-Core-i5-2540M-host.xml | 24 +
tests/cputestdata/x86-cpuid-Core-i5-2540M-json.xml | 9 +
tests/cputestdata/x86-cpuid-Core-i5-2540M.json | 82 ++++
tests/cputestdata/x86-cpuid-Core-i5-2540M.xml | 34 ++
.../cputestdata/x86-cpuid-Core-i5-4670T-guest.xml | 28 ++
tests/cputestdata/x86-cpuid-Core-i5-4670T-host.xml | 28 ++
tests/cputestdata/x86-cpuid-Core-i5-4670T-json.xml | 13 +
tests/cputestdata/x86-cpuid-Core-i5-4670T.json | 77 +++
tests/cputestdata/x86-cpuid-Core-i5-4670T.xml | 34 ++
tests/cputestdata/x86-cpuid-Core-i5-6600-guest.xml | 30 ++
tests/cputestdata/x86-cpuid-Core-i5-6600-host.xml | 30 ++
tests/cputestdata/x86-cpuid-Core-i5-6600-json.xml | 14 +
tests/cputestdata/x86-cpuid-Core-i5-6600.json | 82 ++++
tests/cputestdata/x86-cpuid-Core-i5-6600.xml | 46 ++
tests/cputestdata/x86-cpuid-Core-i7-2600-guest.xml | 24 +
tests/cputestdata/x86-cpuid-Core-i7-2600-host.xml | 24 +
tests/cputestdata/x86-cpuid-Core-i7-2600-json.xml | 9 +
tests/cputestdata/x86-cpuid-Core-i7-2600.json | 77 +++
tests/cputestdata/x86-cpuid-Core-i7-2600.xml | 34 ++
.../cputestdata/x86-cpuid-Core-i7-3520M-guest.xml | 23 +
tests/cputestdata/x86-cpuid-Core-i7-3520M-host.xml | 23 +
tests/cputestdata/x86-cpuid-Core-i7-3520M.xml | 34 ++
.../cputestdata/x86-cpuid-Core-i7-3740QM-guest.xml | 23 +
.../cputestdata/x86-cpuid-Core-i7-3740QM-host.xml | 23 +
.../cputestdata/x86-cpuid-Core-i7-3740QM-json.xml | 9 +
tests/cputestdata/x86-cpuid-Core-i7-3740QM.json | 77 +++
tests/cputestdata/x86-cpuid-Core-i7-3740QM.xml | 34 ++
tests/cputestdata/x86-cpuid-Core-i7-3770-guest.xml | 23 +
tests/cputestdata/x86-cpuid-Core-i7-3770-host.xml | 23 +
tests/cputestdata/x86-cpuid-Core-i7-3770-json.xml | 8 +
tests/cputestdata/x86-cpuid-Core-i7-3770.json | 77 +++
tests/cputestdata/x86-cpuid-Core-i7-3770.xml | 34 ++
.../cputestdata/x86-cpuid-Core-i7-4600U-guest.xml | 28 ++
tests/cputestdata/x86-cpuid-Core-i7-4600U-host.xml | 28 ++
tests/cputestdata/x86-cpuid-Core-i7-4600U-json.xml | 13 +
tests/cputestdata/x86-cpuid-Core-i7-4600U.json | 82 ++++
tests/cputestdata/x86-cpuid-Core-i7-4600U.xml | 34 ++
.../cputestdata/x86-cpuid-Core-i7-5600U-guest.xml | 28 ++
tests/cputestdata/x86-cpuid-Core-i7-5600U-host.xml | 28 ++
tests/cputestdata/x86-cpuid-Core-i7-5600U-json.xml | 13 +
tests/cputestdata/x86-cpuid-Core-i7-5600U.json | 88 ++++
tests/cputestdata/x86-cpuid-Core-i7-5600U.xml | 41 ++
tests/cputestdata/x86-cpuid-Core2-E6850-guest.xml | 21 +
tests/cputestdata/x86-cpuid-Core2-E6850-host.xml | 21 +
tests/cputestdata/x86-cpuid-Core2-E6850-json.xml | 11 +
tests/cputestdata/x86-cpuid-Core2-E6850.json | 77 +++
tests/cputestdata/x86-cpuid-Core2-E6850.xml | 27 ++
tests/cputestdata/x86-cpuid-Core2-Q9500-guest.xml | 22 +
tests/cputestdata/x86-cpuid-Core2-Q9500-host.xml | 22 +
tests/cputestdata/x86-cpuid-Core2-Q9500.xml | 30 ++
tests/cputestdata/x86-cpuid-FX-8150-guest.xml | 24 +
tests/cputestdata/x86-cpuid-FX-8150-host.xml | 24 +
tests/cputestdata/x86-cpuid-FX-8150.xml | 49 ++
tests/cputestdata/x86-cpuid-Opteron-1352-guest.xml | 19 +
tests/cputestdata/x86-cpuid-Opteron-1352-host.xml | 19 +
tests/cputestdata/x86-cpuid-Opteron-1352.xml | 37 ++
tests/cputestdata/x86-cpuid-Opteron-2350-guest.xml | 19 +
tests/cputestdata/x86-cpuid-Opteron-2350-host.xml | 19 +
tests/cputestdata/x86-cpuid-Opteron-2350-json.xml | 19 +
tests/cputestdata/x86-cpuid-Opteron-2350.json | 71 +++
tests/cputestdata/x86-cpuid-Opteron-2350.xml | 37 ++
tests/cputestdata/x86-cpuid-Opteron-6234-guest.xml | 24 +
tests/cputestdata/x86-cpuid-Opteron-6234-host.xml | 24 +
tests/cputestdata/x86-cpuid-Opteron-6234-json.xml | 16 +
tests/cputestdata/x86-cpuid-Opteron-6234.json | 88 ++++
tests/cputestdata/x86-cpuid-Opteron-6234.xml | 51 ++
tests/cputestdata/x86-cpuid-Opteron-6282-guest.xml | 24 +
tests/cputestdata/x86-cpuid-Opteron-6282-host.xml | 24 +
tests/cputestdata/x86-cpuid-Opteron-6282.xml | 51 ++
.../cputestdata/x86-cpuid-Pentium-P6100-guest.xml | 23 +
tests/cputestdata/x86-cpuid-Pentium-P6100-host.xml | 23 +
tests/cputestdata/x86-cpuid-Pentium-P6100.xml | 30 ++
tests/cputestdata/x86-cpuid-Phenom-B95-guest.xml | 22 +
tests/cputestdata/x86-cpuid-Phenom-B95-host.xml | 31 ++
tests/cputestdata/x86-cpuid-Phenom-B95-json.xml | 20 +
tests/cputestdata/x86-cpuid-Phenom-B95.json | 77 +++
tests/cputestdata/x86-cpuid-Phenom-B95.xml | 38 ++
tests/cputestdata/x86-cpuid-Xeon-5110-guest.xml | 20 +
tests/cputestdata/x86-cpuid-Xeon-5110-host.xml | 20 +
tests/cputestdata/x86-cpuid-Xeon-5110.xml | 27 ++
tests/cputestdata/x86-cpuid-Xeon-E3-1245-guest.xml | 30 ++
tests/cputestdata/x86-cpuid-Xeon-E3-1245-host.xml | 30 ++
tests/cputestdata/x86-cpuid-Xeon-E3-1245-json.xml | 15 +
tests/cputestdata/x86-cpuid-Xeon-E3-1245.json | 88 ++++
tests/cputestdata/x86-cpuid-Xeon-E3-1245.xml | 46 ++
tests/cputestdata/x86-cpuid-Xeon-E5-2630-guest.xml | 29 ++
tests/cputestdata/x86-cpuid-Xeon-E5-2630-host.xml | 29 ++
tests/cputestdata/x86-cpuid-Xeon-E5-2630-json.xml | 12 +
tests/cputestdata/x86-cpuid-Xeon-E5-2630.json | 77 +++
tests/cputestdata/x86-cpuid-Xeon-E5-2630.xml | 37 ++
tests/cputestdata/x86-cpuid-Xeon-E5-2650-guest.xml | 29 ++
tests/cputestdata/x86-cpuid-Xeon-E5-2650-host.xml | 29 ++
tests/cputestdata/x86-cpuid-Xeon-E5-2650-json.xml | 12 +
tests/cputestdata/x86-cpuid-Xeon-E5-2650.json | 71 +++
tests/cputestdata/x86-cpuid-Xeon-E5-2650.xml | 37 ++
tests/cputestdata/x86-cpuid-Xeon-E7-4820-guest.xml | 28 ++
tests/cputestdata/x86-cpuid-Xeon-E7-4820-host.xml | 28 ++
tests/cputestdata/x86-cpuid-Xeon-E7-4820-json.xml | 12 +
tests/cputestdata/x86-cpuid-Xeon-E7-4820.json | 77 +++
tests/cputestdata/x86-cpuid-Xeon-E7-4820.xml | 30 ++
tests/cputestdata/x86-cpuid-Xeon-W3520-guest.xml | 23 +
tests/cputestdata/x86-cpuid-Xeon-W3520-host.xml | 23 +
tests/cputestdata/x86-cpuid-Xeon-W3520-json.xml | 10 +
tests/cputestdata/x86-cpuid-Xeon-W3520.json | 77 +++
tests/cputestdata/x86-cpuid-Xeon-W3520.xml | 30 ++
tests/cputestdata/x86-cpuid-Xeon-X5460-guest.xml | 21 +
tests/cputestdata/x86-cpuid-Xeon-X5460-host.xml | 21 +
tests/cputestdata/x86-cpuid-Xeon-X5460.xml | 27 ++
...6-host+host+host-model,models,Penryn-result.xml | 1 +
tests/qemucapabilitiestest.c | 57 +--
.../qemumonitorjson-getcpu-full.data | 6 +-
.../qemumonitorjson-getcpu-host.data | 8 +-
tests/qemumonitortestutils.c | 90 +++-
tests/qemumonitortestutils.h | 8 +-
146 files changed, 5114 insertions(+), 596 deletions(-)
create mode 100755 tests/cputestdata/cpu-gather.sh
create mode 100755 tests/cputestdata/cpu-parse.sh
create mode 100644 tests/cputestdata/x86-cpuid-A10-5800K-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-A10-5800K-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-A10-5800K-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-A10-5800K.json
create mode 100644 tests/cputestdata/x86-cpuid-A10-5800K.xml
create mode 100644 tests/cputestdata/x86-cpuid-Atom-D510-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Atom-D510-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Atom-D510.xml
create mode 100644 tests/cputestdata/x86-cpuid-Atom-N450-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Atom-N450-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Atom-N450.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2500-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2500-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2500-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2500.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2500.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2540M-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2540M-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2540M-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2540M.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-2540M.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-4670T-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-4670T-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-4670T-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-4670T.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-4670T.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-6600-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-6600-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-6600-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-6600.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i5-6600.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-2600-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-2600-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-2600-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-2600.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-2600.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3520M-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3520M-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3520M.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3740QM-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3740QM-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3740QM-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3740QM.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3740QM.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3770-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3770-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3770-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3770.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-3770.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-4600U-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-4600U-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-4600U-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-4600U.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-4600U.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-5600U-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-5600U-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-5600U-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-5600U.json
create mode 100644 tests/cputestdata/x86-cpuid-Core-i7-5600U.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-E6850-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-E6850-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-E6850-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-E6850.json
create mode 100644 tests/cputestdata/x86-cpuid-Core2-E6850.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-Q9500-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-Q9500-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Core2-Q9500.xml
create mode 100644 tests/cputestdata/x86-cpuid-FX-8150-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-FX-8150-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-FX-8150.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-1352-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-1352-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-1352.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-2350-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-2350-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-2350-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-2350.json
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-2350.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6234-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6234-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6234-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6234.json
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6234.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6282-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6282-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Opteron-6282.xml
create mode 100644 tests/cputestdata/x86-cpuid-Pentium-P6100-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Pentium-P6100-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Pentium-P6100.xml
create mode 100644 tests/cputestdata/x86-cpuid-Phenom-B95-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Phenom-B95-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Phenom-B95-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Phenom-B95.json
create mode 100644 tests/cputestdata/x86-cpuid-Phenom-B95.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-5110-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-5110-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-5110.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E3-1245-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E3-1245-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E3-1245-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E3-1245.json
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E3-1245.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2630-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2630-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2630-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2630.json
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2630.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2650-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2650-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2650-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2650.json
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E5-2650.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E7-4820-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E7-4820-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E7-4820-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E7-4820.json
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-E7-4820.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-W3520-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-W3520-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-W3520-json.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-W3520.json
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-W3520.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-X5460-guest.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-X5460-host.xml
create mode 100644 tests/cputestdata/x86-cpuid-Xeon-X5460.xml
--
2.8.3
8 years, 5 months
[libvirt] [PATCH] virsh-domain: fix memory leak in cmdDomDisplay
by Pavel Hrdina
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
tools/virsh-domain.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6f8edbb..11116a9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10637,8 +10637,10 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
* fails, if there is no listen_addr we will print "localhost". */
VIR_FREE(listen_addr);
- if (uri && VIR_STRDUP(listen_addr, uri->server) < 0)
- goto cleanup;
+ if (uri) {
+ listen_addr = vshStrdup(ctl, uri->server);
+ virURIFree(uri);
+ }
}
}
--
2.8.3
8 years, 5 months
[libvirt] [PATCH 0/5] Make virNetDevGetFeatures faster
by Ján Tomko
Reuse the socket across ioctl calls.
On my machine with one hardware network interface and three "software" ones,
this speeds the udev node_device driver startup 11x (from ~220 ms to ~20 ms)
Ján Tomko (5):
Move struct elem out of virNetDevGetFeatures
Split out virNetDevGetEthtoolFeatures
Split out virNetDevGetEthtoolGFeatures
Return bool in virNetDevFeatureAvailable
Reuse the socket in virNetDevGetFeatures
src/util/virnetdev.c | 212 +++++++++++++++++++++++++++++----------------------
1 file changed, 120 insertions(+), 92 deletions(-)
--
2.7.3
8 years, 5 months
[libvirt] [PATCH v2 Repost 0/5] bhyve: virConnectDomainXMLFromNative
by Fabian Freyer
I'm reposting this series because I got the following two error messages from
the redhat.com MX:
libvir-list(a)redhat.com
SMTP error from remote mail server after RCPT TO:<libvir-list(a)redhat.com>:
host mx1.redhat.com [209.132.183.28]: 554 5.7.1 <libvir-list(a)redhat.com>:
Recipient address rejected: Access denied
<libvir-list(a)redhat.com>: host int-mx.corp.redhat.com[10.4.122.10] said: 550
5.1.1 <libvir-list(a)redhat.com>... User unknown (in reply to RCPT TO
command)
Sorry for the noise.
Differences to v1:
- use gnulib's reentrant getopt implementation. This is necessary for thread
safety.
- config-post.h: __GNUC_PREREQ is defined here, since using gnulib's getopt
pulls in other gnulib headers, which rely on __GNUC_PREREQ, which doesn't
exist on FreeBSD.
This approach is open for discussion: I chose config-post.h as this would
likely always be the first header pulled in (through config.h).
Link to v1:
https://www.redhat.com/archives/libvir-list/2016-June/msg00001.html
Fabian Freyer (5):
config-post.h: define __GNUC_PREREQ if not defined
gnulib: add getopt module
bhyve: implement virConnectDomainXMLFromNative
bhyve: implement bhyve argument parser
bhyve: implement argument parser for loader
bootstrap.conf | 1 +
config-post.h | 11 +
m4/virt-driver-bhyve.m4 | 3 +
po/POTFILES.in | 1 +
src/Makefile.am | 2 +
src/bhyve/bhyve_driver.c | 42 ++
src/bhyve/bhyve_parse_command.c | 875 ++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_parse_command.h | 30 ++
8 files changed, 965 insertions(+)
create mode 100644 src/bhyve/bhyve_parse_command.c
create mode 100644 src/bhyve/bhyve_parse_command.h
--
2.7.0
8 years, 5 months
[libvirt] [PATCH 2/5] gnulib: add getopt module
by Fabian Freyer
Unconditionally use gnulib's getopt module. This is needed by the bhyve driver
to provide a reentrant interface for getopt.
---
bootstrap.conf | 1 +
m4/virt-driver-bhyve.m4 | 3 +++
2 files changed, 4 insertions(+)
diff --git a/bootstrap.conf b/bootstrap.conf
index 0db6b62..edea8c3 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -54,6 +54,7 @@ func
getaddrinfo
getcwd-lgpl
gethostname
+getopt-posix
getpass
getpeername
getsockname
diff --git a/m4/virt-driver-bhyve.m4 b/m4/virt-driver-bhyve.m4
index c65b15d..bbdd8b2 100644
--- a/m4/virt-driver-bhyve.m4
+++ b/m4/virt-driver-bhyve.m4
@@ -52,6 +52,9 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_BHYVE],[
AM_CONDITIONAL([WITH_BHYVE], [test "$with_bhyve" = "yes"])
])
+dnl Build with gnulib's getopt which contains a reentrant interface
+AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], [])
+
AC_DEFUN([LIBVIRT_DRIVER_RESULT_BHYVE],[
AC_MSG_NOTICE([ Bhyve: $with_bhyve])
])
--
2.7.0
8 years, 5 months
[libvirt] [PATCH 1/5] config-post.h: define __GNUC_PREREQ if not defined
by Fabian Freyer
Several gnulib headers rely on feature.h being included by ctype.h to provide
__GNUC_PREREQ, but on systems without glibc, this is not provided. In these
cases __GNUC_PREREQ gets redefined to 0, which causes build errors from checks
in src/internal.h.
Therefore, define __GNUC_PREREQ as early as possible. config.h is probably the
first header that is included, before any other headers.
---
config-post.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/config-post.h b/config-post.h
index 2398d3d..0aa8271 100644
--- a/config-post.h
+++ b/config-post.h
@@ -67,3 +67,14 @@
# undef WITH_SECDRIVER_APPARMOR
# undef WITH_CAPNG
#endif /* LIBVIRT_NSS */
+
+#ifdef __GNUC__
+# ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+# define __GNUC_PREREQ(maj, min) 0
+# endif
+# endif
+#endif
--
2.7.0
8 years, 5 months
[libvirt] [PATCH V2 1/6] driver config: Introduce virFirmware object
by Jim Fehlig
The virQEMUDriverConfig object contains lists of
loader:nvram pairs to advertise firmwares supported by
by the driver, and qemu_conf.c contains code to populate
the lists, all of which is useful for other drivers too.
To avoid code duplication, introduce a virFirmware object
to encapsulate firmware details and switch the qemu driver
to use it.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/libvirt_private.syms | 6 ++
src/qemu/qemu_capabilities.c | 22 +++----
src/qemu/qemu_capabilities.h | 5 +-
src/qemu/qemu_conf.c | 127 ++++++---------------------------------
src/qemu/qemu_conf.h | 7 +--
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_process.c | 6 +-
src/util/virfirmware.c | 137 +++++++++++++++++++++++++++++++++++++++++++
src/util/virfirmware.h | 51 ++++++++++++++++
tests/domaincapstest.c | 3 +-
12 files changed, 237 insertions(+), 131 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2a6fae4..85adaf3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -194,6 +194,7 @@ src/util/virerror.h
src/util/vireventpoll.c
src/util/virfile.c
src/util/virfirewall.c
+src/util/virfirmware.c
src/util/virhash.c
src/util/virhook.c
src/util/virhostdev.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 8c83b0c..9c4eb41 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -114,6 +114,7 @@ UTIL_SOURCES = \
util/virfile.c util/virfile.h \
util/virfirewall.c util/virfirewall.h \
util/virfirewallpriv.h \
+ util/virfirmware.c util/virfirmware.h \
util/virgettext.c util/virgettext.h \
util/virgic.c util/virgic.h \
util/virhash.c util/virhash.h \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 27ad7ff..bed4e11 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1561,6 +1561,12 @@ virFirewallStartRollback;
virFirewallStartTransaction;
+# util/virfirmware.h
+virFirmwareFreeList;
+virFirmwareParse;
+virFirmwareParseList;
+
+
# util/virgettext.h
virGettextInitialize;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 43ac906..cdb3b6c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4069,18 +4069,18 @@ virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps)
static int
virQEMUCapsFillDomainLoaderCaps(virDomainCapsLoaderPtr capsLoader,
- char **loader,
- size_t nloader)
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares)
{
size_t i;
capsLoader->supported = true;
- if (VIR_ALLOC_N(capsLoader->values.values, nloader) < 0)
+ if (VIR_ALLOC_N(capsLoader->values.values, nfirmwares) < 0)
return -1;
- for (i = 0; i < nloader; i++) {
- const char *filename = loader[i];
+ for (i = 0; i < nfirmwares; i++) {
+ const char *filename = firmwares[i]->name;
if (!virFileExists(filename)) {
VIR_DEBUG("loader filename=%s does not exist", filename);
@@ -4109,13 +4109,13 @@ virQEMUCapsFillDomainLoaderCaps(virDomainCapsLoaderPtr capsLoader,
static int
virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
- char **loader,
- size_t nloader)
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares)
{
virDomainCapsLoaderPtr capsLoader = &os->loader;
os->supported = true;
- if (virQEMUCapsFillDomainLoaderCaps(capsLoader, loader, nloader) < 0)
+ if (virQEMUCapsFillDomainLoaderCaps(capsLoader, firmwares, nfirmwares) < 0)
return -1;
return 0;
}
@@ -4328,8 +4328,8 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
int
virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
virQEMUCapsPtr qemuCaps,
- char **loader,
- size_t nloader)
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares)
{
virDomainCapsOSPtr os = &domCaps->os;
virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
@@ -4340,7 +4340,7 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
domCaps->maxvcpus = maxvcpus;
- if (virQEMUCapsFillDomainOSCaps(os, loader, nloader) < 0 ||
+ if (virQEMUCapsFillDomainOSCaps(os, firmwares, nfirmwares) < 0 ||
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps,
domCaps->machine, disk) < 0 ||
virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 ||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 77e4b98..39c642c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -29,6 +29,7 @@
# include "vircommand.h"
# include "qemu_monitor.h"
# include "domain_capabilities.h"
+# include "virfirmware.h"
/*
* Internal flags to keep track of qemu command line capabilities
@@ -490,7 +491,7 @@ int virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
int virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
virQEMUCapsPtr qemuCaps,
- char **loader,
- size_t nloader);
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares);
#endif /* __QEMU_CAPABILITIES_H__*/
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index e00ddca..030bd5a 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -124,47 +124,6 @@ void qemuDomainCmdlineDefFree(qemuDomainCmdlineDefPtr def)
}
-static int ATTRIBUTE_UNUSED
-virQEMUDriverConfigLoaderNVRAMParse(virQEMUDriverConfigPtr cfg,
- const char *list)
-{
- int ret = -1;
- char **token;
- size_t i, j;
-
- if (!(token = virStringSplit(list, ":", 0)))
- goto cleanup;
-
- for (i = 0; token[i]; i += 2) {
- if (!token[i] || !token[i + 1] ||
- STREQ(token[i], "") || STREQ(token[i + 1], "")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Invalid --with-loader-nvram list: %s"),
- list);
- goto cleanup;
- }
- }
-
- if (i) {
- if (VIR_ALLOC_N(cfg->loader, i / 2) < 0 ||
- VIR_ALLOC_N(cfg->nvram, i / 2) < 0)
- goto cleanup;
- cfg->nloader = i / 2;
-
- for (j = 0; j < i / 2; j++) {
- if (VIR_STRDUP(cfg->loader[j], token[2 * j]) < 0 ||
- VIR_STRDUP(cfg->nvram[j], token[2 * j + 1]) < 0)
- goto cleanup;
- }
- }
-
- ret = 0;
- cleanup:
- virStringFreeList(token);
- return ret;
-}
-
-
#define VIR_QEMU_OVMF_LOADER_PATH "/usr/share/OVMF/OVMF_CODE.fd"
#define VIR_QEMU_OVMF_NVRAM_PATH "/usr/share/OVMF/OVMF_VARS.fd"
#define VIR_QEMU_AAVMF_LOADER_PATH "/usr/share/AAVMF/AAVMF_CODE.fd"
@@ -327,20 +286,22 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
cfg->stdioLogD = true;
#ifdef DEFAULT_LOADER_NVRAM
- if (virQEMUDriverConfigLoaderNVRAMParse(cfg, DEFAULT_LOADER_NVRAM) < 0)
+ if (virFirmwareParseList(DEFAULT_LOADER_NVRAM,
+ &cfg->firmwares,
+ &cfg->nfirmwares) < 0)
goto error;
#else
-
- if (VIR_ALLOC_N(cfg->loader, 2) < 0 ||
- VIR_ALLOC_N(cfg->nvram, 2) < 0)
+ if (VIR_ALLOC_N(cfg->firmwares, 2) < 0)
+ goto error;
+ cfg->nfirmwares = 2;
+ if (VIR_ALLOC(cfg->firmwares[0]) < 0 || VIR_ALLOC(cfg->firmwares[1]) < 0)
goto error;
- cfg->nloader = 2;
- if (VIR_STRDUP(cfg->loader[0], VIR_QEMU_AAVMF_LOADER_PATH) < 0 ||
- VIR_STRDUP(cfg->nvram[0], VIR_QEMU_AAVMF_NVRAM_PATH) < 0 ||
- VIR_STRDUP(cfg->loader[1], VIR_QEMU_OVMF_LOADER_PATH) < 0 ||
- VIR_STRDUP(cfg->nvram[1], VIR_QEMU_OVMF_NVRAM_PATH) < 0)
+ if (VIR_STRDUP(cfg->firmwares[0]->name, VIR_QEMU_AAVMF_LOADER_PATH) < 0 ||
+ VIR_STRDUP(cfg->firmwares[0]->nvram, VIR_QEMU_AAVMF_NVRAM_PATH) < 0 ||
+ VIR_STRDUP(cfg->firmwares[1]->name, VIR_QEMU_OVMF_LOADER_PATH) < 0 ||
+ VIR_STRDUP(cfg->firmwares[1]->nvram, VIR_QEMU_OVMF_NVRAM_PATH) < 0)
goto error;
#endif
@@ -397,13 +358,7 @@ static void virQEMUDriverConfigDispose(void *obj)
VIR_FREE(cfg->lockManagerName);
- while (cfg->nloader) {
- VIR_FREE(cfg->loader[cfg->nloader - 1]);
- VIR_FREE(cfg->nvram[cfg->nloader - 1]);
- cfg->nloader--;
- }
- VIR_FREE(cfg->loader);
- VIR_FREE(cfg->nvram);
+ virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
}
@@ -427,43 +382,6 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
}
-static int
-virQEMUDriverConfigNVRAMParse(const char *str,
- char **loader,
- char **nvram)
-{
- int ret = -1;
- char **token;
-
- if (!(token = virStringSplit(str, ":", 0)))
- goto cleanup;
-
- if (token[0]) {
- virSkipSpaces((const char **) &token[0]);
- if (token[1])
- virSkipSpaces((const char **) &token[1]);
- }
-
- /* Exactly two tokens are expected */
- if (!token[0] || !token[1] || token[2] ||
- STREQ(token[0], "") || STREQ(token[1], "")) {
- virReportError(VIR_ERR_CONF_SYNTAX,
- _("Invalid nvram format: '%s'"),
- str);
- goto cleanup;
- }
-
- if (VIR_STRDUP(*loader, token[0]) < 0 ||
- VIR_STRDUP(*nvram, token[1]) < 0)
- goto cleanup;
-
- ret = 0;
- cleanup:
- virStringFreeList(token);
- return ret;
-}
-
-
int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
const char *filename)
{
@@ -854,14 +772,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
CHECK_TYPE("nvram", VIR_CONF_LIST);
- while (cfg->nloader) {
- VIR_FREE(cfg->loader[cfg->nloader - 1]);
- VIR_FREE(cfg->nvram[cfg->nloader - 1]);
- cfg->nloader--;
- }
- VIR_FREE(cfg->loader);
- VIR_FREE(cfg->nvram);
-
+ virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
/* Calc length and check items */
for (len = 0, pp = p->list; pp; len++, pp = pp->next) {
if (pp->type != VIR_CONF_STRING) {
@@ -871,16 +782,14 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
}
}
- if (len &&
- (VIR_ALLOC_N(cfg->loader, len) < 0 ||
- VIR_ALLOC_N(cfg->nvram, len) < 0))
+ if (len && VIR_ALLOC_N(cfg->firmwares, len) < 0)
goto cleanup;
- cfg->nloader = len;
+ cfg->nfirmwares = len;
for (i = 0, pp = p->list; pp; i++, pp = pp->next) {
- if (virQEMUDriverConfigNVRAMParse(pp->str,
- &cfg->loader[i],
- &cfg->nvram[i]) < 0)
+ if (VIR_ALLOC(cfg->firmwares[i]) < 0)
+ goto cleanup;
+ if (virFirmwareParse(pp->str, cfg->firmwares[i]) < 0)
goto cleanup;
}
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1fdef70..469b1dc 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -48,6 +48,7 @@
# include "virclosecallbacks.h"
# include "virhostdev.h"
# include "virfile.h"
+# include "virfirmware.h"
# ifdef CPU_SETSIZE /* Linux */
# define QEMUD_CPUMASK_LEN CPU_SETSIZE
@@ -177,10 +178,8 @@ struct _virQEMUDriverConfig {
bool logTimestamp;
bool stdioLogD;
- /* Pairs of loader:nvram paths. The list is @nloader items long */
- char **loader;
- char **nvram;
- size_t nloader;
+ virFirmwarePtr *firmwares;
+ size_t nfirmwares;
};
/* Main driver state */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e70d3ce..45f6a82 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18511,7 +18511,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
goto cleanup;
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
- cfg->loader, cfg->nloader) < 0)
+ cfg->firmwares, cfg->nfirmwares) < 0)
goto cleanup;
ret = virDomainCapsFormat(domCaps);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 397dac7..0b08df5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3727,9 +3727,9 @@ qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
master_nvram_path = loader->templt;
if (!loader->templt) {
size_t i;
- for (i = 0; i < cfg->nloader; i++) {
- if (STREQ(cfg->loader[i], loader->path)) {
- master_nvram_path = cfg->nvram[i];
+ for (i = 0; i < cfg->nfirmwares; i++) {
+ if (STREQ(cfg->firmwares[i]->name, loader->path)) {
+ master_nvram_path = cfg->firmwares[i]->nvram;
break;
}
}
diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c
new file mode 100644
index 0000000..6b20c06
--- /dev/null
+++ b/src/util/virfirmware.c
@@ -0,0 +1,137 @@
+/*
+ * virfirmware.c: Definition of firmware object and supporting functions
+ *
+ * Copyright (C) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Jim Fehlig <jfehlig(a)suse.com>
+ */
+
+#include <config.h>
+
+#include "viralloc.h"
+#include "virerror.h"
+#include "virfirmware.h"
+#include "virlog.h"
+#include "virstring.h"
+
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+VIR_LOG_INIT("util.firmware");
+
+
+static void
+virFirmwareFree(virFirmwarePtr firmware)
+{
+ if (!firmware)
+ return;
+
+ VIR_FREE(firmware->name);
+ VIR_FREE(firmware->nvram);
+ VIR_FREE(firmware);
+}
+
+
+void
+virFirmwareFreeList(virFirmwarePtr *firmwares, size_t nfirmwares)
+{
+ size_t i;
+
+ for (i = 0; i < nfirmwares; i++)
+ virFirmwareFree(firmwares[i]);
+
+ VIR_FREE(firmwares);
+}
+
+
+int
+virFirmwareParse(const char *str, virFirmwarePtr firmware)
+{
+ int ret = -1;
+ char **token;
+
+ if (!(token = virStringSplit(str, ":", 0)))
+ goto cleanup;
+
+ if (token[0]) {
+ virSkipSpaces((const char **) &token[0]);
+ if (token[1])
+ virSkipSpaces((const char **) &token[1]);
+ }
+
+ /* Exactly two tokens are expected */
+ if (!token[0] || !token[1] || token[2] ||
+ STREQ(token[0], "") || STREQ(token[1], "")) {
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Invalid nvram format: '%s'"),
+ str);
+ goto cleanup;
+ }
+
+ if (VIR_STRDUP(firmware->name, token[0]) < 0 ||
+ VIR_STRDUP(firmware->nvram, token[1]) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ virStringFreeList(token);
+ return ret;
+}
+
+
+int
+virFirmwareParseList(const char *list,
+ virFirmwarePtr **firmwares,
+ size_t *nfirmwares)
+{
+ int ret = -1;
+ char **token;
+ size_t i, j;
+
+ if (!(token = virStringSplit(list, ":", 0)))
+ goto cleanup;
+
+ for (i = 0; token[i]; i += 2) {
+ if (!token[i] || !token[i + 1] ||
+ STREQ(token[i], "") || STREQ(token[i + 1], "")) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid --with-loader-nvram list: %s"),
+ list);
+ goto cleanup;
+ }
+ }
+
+ if (i) {
+ if (VIR_ALLOC_N(*firmwares, i / 2) < 0)
+ goto cleanup;
+ *nfirmwares = i / 2;
+
+ for (j = 0; j < i / 2; j++) {
+ virFirmwarePtr *fws = *firmwares;
+
+ if (VIR_ALLOC(fws[j]) < 0)
+ goto cleanup;
+ if (VIR_STRDUP(fws[j]->name, token[2 * j]) < 0 ||
+ VIR_STRDUP(fws[j]->nvram, token[2 * j + 1]) < 0)
+ goto cleanup;
+ }
+ }
+
+ ret = 0;
+ cleanup:
+ virStringFreeList(token);
+ return ret;
+}
diff --git a/src/util/virfirmware.h b/src/util/virfirmware.h
new file mode 100644
index 0000000..682a865
--- /dev/null
+++ b/src/util/virfirmware.h
@@ -0,0 +1,51 @@
+/*
+ * virfirmware.h: Declaration of firmware object and supporting functions
+ *
+ * Copyright (C) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Jim Fehlig <jfehlig(a)suse.com>
+ */
+
+#ifndef __VIR_FIRMWARE_H__
+# define __VIR_FIRMWARE_H__
+
+# include "internal.h"
+
+typedef struct _virFirmware virFirmware;
+typedef virFirmware *virFirmwarePtr;
+
+struct _virFirmware {
+ char *name;
+ char *nvram;
+};
+
+
+void
+virFirmwareFreeList(virFirmwarePtr *firmwares, size_t nfirmwares);
+
+int
+virFirmwareParse(const char *str, virFirmwarePtr firmware)
+ ATTRIBUTE_NONNULL(2);
+
+int
+virFirmwareParseList(const char *list,
+ virFirmwarePtr **firmwares,
+ size_t *nfirmwares)
+ ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+
+
+#endif /* __VIR_FIRMWARE_H__ */
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index e1d0671..83ce0e5 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -128,7 +128,8 @@ fillQemuCaps(virDomainCapsPtr domCaps,
goto cleanup;
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
- cfg->loader, cfg->nloader) < 0)
+ cfg->firmwares,
+ cfg->nfirmwares) < 0)
goto cleanup;
/* The function above tries to query host's KVM & VFIO capabilities by
--
2.1.4
8 years, 5 months
[libvirt] [PATCH V2 5/6] xenconfig: support bios=ovmf xl.cfg
by Jim Fehlig
Add support to xenconfig for conversion of xl.cfg(5) bios config
to/from libvirt domXml <loader> config. SeaBIOS is the default
for HVM guests using upstream QEMU. ROMBIOS is the default when
using the old qemu-dm. This patch allows specifying OVMF as an
alternate firmware.
Example xl.cfg:
bios = "ovmf"
Example domXML:
<os>
...
<loader readonly='yes' type='pflash'>/usr/lib/xen/boot/ovmf.bin</loader>
</os>
An alternate OVMF firmware (from the one advertised in
domaincapabilities) can be specified with
bios = "ovmf"
bios_override = "/path/to/my/ovmf.bin"
Note that currently, Xen does not support a separate nvram for
non-volatile variables.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/Makefile.am | 2 +-
src/xenconfig/xen_xl.c | 50 ++++++++++++++++---
tests/xlconfigdata/test-fullvirt-ovmf-override.cfg | 27 ++++++++++
tests/xlconfigdata/test-fullvirt-ovmf-override.xml | 58 ++++++++++++++++++++++
tests/xlconfigdata/test-fullvirt-ovmf.cfg | 26 ++++++++++
tests/xlconfigdata/test-fullvirt-ovmf.xml | 58 ++++++++++++++++++++++
tests/xlconfigtest.c | 2 +
7 files changed, 216 insertions(+), 7 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9e7fe75..8fd4382 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1149,7 +1149,7 @@ noinst_LTLIBRARIES += libvirt_xenconfig.la
libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la
libvirt_xenconfig_la_LIBADD = $(LIBXL_LIBS)
libvirt_xenconfig_la_CFLAGS = \
- -I$(srcdir)/conf $(AM_CFLAGS)
+ -I$(srcdir)/conf -I$(srcdir)/libxl $(AM_CFLAGS)
libvirt_xenconfig_la_SOURCES = $(XENCONFIG_SOURCES)
endif WITH_XENCONFIG
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 9b8306f..bbe53ee 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -33,6 +33,7 @@
#include "virstring.h"
#include "virstoragefile.h"
#include "xen_xl.h"
+#include "libxl_capabilities.h"
#define VIR_FROM_THIS VIR_FROM_XENXL
@@ -103,15 +104,40 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
size_t i;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+ const char *bios;
+ const char *alt_bios;
const char *boot;
- for (i = 0; i < caps->nguests; i++) {
- if (caps->guests[i]->ostype == VIR_DOMAIN_OSTYPE_HVM &&
- caps->guests[i]->arch.id == def->os.arch) {
- if (VIR_ALLOC(def->os.loader) < 0 ||
- VIR_STRDUP(def->os.loader->path,
- caps->guests[i]->arch.defaultInfo.loader) < 0)
+ if (xenConfigGetString(conf, "bios", &bios, NULL) < 0)
+ return -1;
+
+ if (xenConfigGetString(conf, "bios_override", &alt_bios, NULL) < 0)
+ return -1;
+
+ if (bios && STREQ(bios, "ovmf")) {
+ if (VIR_ALLOC(def->os.loader) < 0)
+ return -1;
+
+ def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
+ def->os.loader->readonly = VIR_TRISTATE_BOOL_YES;
+
+ if (alt_bios) {
+ if (VIR_STRDUP(def->os.loader->path, alt_bios) < 0)
return -1;
+ } else {
+ if (VIR_STRDUP(def->os.loader->path,
+ LIBXL_FIRMWARE_DIR "/ovmf.bin") < 0)
+ return -1;
+ }
+ } else {
+ for (i = 0; i < caps->nguests; i++) {
+ if (caps->guests[i]->ostype == VIR_DOMAIN_OSTYPE_HVM &&
+ caps->guests[i]->arch.id == def->os.arch) {
+ if (VIR_ALLOC(def->os.loader) < 0 ||
+ VIR_STRDUP(def->os.loader->path,
+ caps->guests[i]->arch.defaultInfo.loader) < 0)
+ return -1;
+ }
}
}
@@ -535,6 +561,18 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
if (xenConfigSetString(conf, "builder", "hvm") < 0)
return -1;
+ if (def->os.loader &&
+ def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) {
+ if (xenConfigSetString(conf, "bios", "ovmf") < 0)
+ return -1;
+
+ if (STRNEQ(def->os.loader->path, LIBXL_FIRMWARE_DIR "/ovmf.bin")) {
+ if (xenConfigSetString(conf, "bios_override",
+ def->os.loader->path) < 0)
+ return -1;
+ }
+ }
+
#ifdef LIBXL_HAVE_BUILDINFO_KERNEL
if (def->os.kernel &&
xenConfigSetString(conf, "kernel", def->os.kernel) < 0)
diff --git a/tests/xlconfigdata/test-fullvirt-ovmf-override.cfg b/tests/xlconfigdata/test-fullvirt-ovmf-override.cfg
new file mode 100644
index 0000000..46bd684
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-ovmf-override.cfg
@@ -0,0 +1,27 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-dm"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+bios = "ovmf"
+bios_override = "/usr/share/qemu/ovmf-x86_64.bin"
+boot = "d"
+disk = [ "format=raw,vdev=hda,access=rw,backendtype=phy,target=/dev/HostVG/XenGuest2", "format=qcow2,vdev=hdb,access=rw,backendtype=qdisk,target=/var/lib/libvirt/images/XenGuest2-home", "format=raw,vdev=hdc,access=ro,backendtype=qdisk,devtype=cdrom,target=/root/boot.iso" ]
diff --git a/tests/xlconfigdata/test-fullvirt-ovmf-override.xml b/tests/xlconfigdata/test-fullvirt-ovmf-override.xml
new file mode 100644
index 0000000..435a791
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-ovmf-override.xml
@@ -0,0 +1,58 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>592896</memory>
+ <currentMemory unit='KiB'>403456</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='xenfv'>hvm</type>
+ <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x86_64.bin</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='variable' adjustment='0' basis='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest2'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/XenGuest2-home'/>
+ <target dev='hdb' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='8192' heads='1' primary='yes'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/xlconfigdata/test-fullvirt-ovmf.cfg b/tests/xlconfigdata/test-fullvirt-ovmf.cfg
new file mode 100644
index 0000000..af0735e
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-ovmf.cfg
@@ -0,0 +1,26 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-dm"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+bios = "ovmf"
+boot = "d"
+disk = [ "format=raw,vdev=hda,access=rw,backendtype=phy,target=/dev/HostVG/XenGuest2", "format=qcow2,vdev=hdb,access=rw,backendtype=qdisk,target=/var/lib/libvirt/images/XenGuest2-home", "format=raw,vdev=hdc,access=ro,backendtype=qdisk,devtype=cdrom,target=/root/boot.iso" ]
diff --git a/tests/xlconfigdata/test-fullvirt-ovmf.xml b/tests/xlconfigdata/test-fullvirt-ovmf.xml
new file mode 100644
index 0000000..b6980e6
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-ovmf.xml
@@ -0,0 +1,58 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>592896</memory>
+ <currentMemory unit='KiB'>403456</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='xenfv'>hvm</type>
+ <loader readonly='yes' type='pflash'>/usr/lib/xen/boot/ovmf.bin</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='variable' adjustment='0' basis='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest2'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/XenGuest2-home'/>
+ <target dev='hdb' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='8192' heads='1' primary='yes'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 62bb144..474697b 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -219,6 +219,8 @@ mymain(void)
DO_TEST_FORMAT("paravirt-cmdline-extra-root");
DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root");
DO_TEST("rbd-multihost-noauth");
+ DO_TEST("fullvirt-ovmf");
+ DO_TEST("fullvirt-ovmf-override");
#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
DO_TEST("fullvirt-multiusb");
--
2.1.4
8 years, 5 months
[libvirt] [PATCH V2 4/6] libxl: implement connectGetDomainCapabilities
by Jim Fehlig
Add domain capabilities for PV and HVM domains.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_capabilities.c | 140 +++++++++++++++++++++++++++++
src/libxl/libxl_capabilities.h | 7 ++
src/libxl/libxl_driver.c | 74 +++++++++++++++
tests/Makefile.am | 5 ++
tests/domaincapsschemadata/libxl-xenfv.xml | 68 ++++++++++++++
tests/domaincapsschemadata/libxl-xenpv.xml | 58 ++++++++++++
tests/domaincapstest.c | 61 +++++++++++++
tests/testutilsxen.h | 1 +
8 files changed, 414 insertions(+)
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index aef2c2d..45f0988 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -30,8 +30,10 @@
#include "virerror.h"
#include "virfile.h"
#include "viralloc.h"
+#include "virstring.h"
#include "domain_conf.h"
#include "capabilities.h"
+#include "domain_capabilities.h"
#include "vircommand.h"
#include "libxl_capabilities.h"
@@ -396,6 +398,109 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
return 0;
}
+static int
+libxlMakeDomainOSCaps(const char *machine,
+ virDomainCapsOSPtr os,
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares)
+{
+ virDomainCapsLoaderPtr capsLoader = &os->loader;
+ size_t i;
+
+ os->supported = true;
+
+ if (STREQ(machine, "xenpv"))
+ return 0;
+
+ capsLoader->supported = true;
+ if (VIR_ALLOC_N(capsLoader->values.values, nfirmwares) < 0)
+ return -1;
+
+ for (i = 0; i < nfirmwares; i++) {
+ if (VIR_STRDUP(capsLoader->values.values[capsLoader->values.nvalues],
+ firmwares[i]->name) < 0)
+ return -1;
+ capsLoader->values.nvalues++;
+ }
+
+ VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->type,
+ VIR_DOMAIN_LOADER_TYPE_ROM,
+ VIR_DOMAIN_LOADER_TYPE_PFLASH);
+ VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->readonly,
+ VIR_TRISTATE_BOOL_YES);
+
+ return 0;
+}
+
+static int
+libxlMakeDomainDeviceDiskCaps(virDomainCapsDeviceDiskPtr dev)
+{
+ dev->supported = true;
+
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->diskDevice,
+ VIR_DOMAIN_DISK_DEVICE_DISK,
+ VIR_DOMAIN_DISK_DEVICE_CDROM);
+
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->bus,
+ VIR_DOMAIN_DISK_BUS_IDE,
+ VIR_DOMAIN_DISK_BUS_SCSI,
+ VIR_DOMAIN_DISK_BUS_XEN);
+
+ return 0;
+}
+
+static int
+libxlMakeDomainDeviceGraphicsCaps(virDomainCapsDeviceGraphicsPtr dev)
+{
+ dev->supported = true;
+
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->type,
+ VIR_DOMAIN_GRAPHICS_TYPE_SDL,
+ VIR_DOMAIN_GRAPHICS_TYPE_VNC,
+ VIR_DOMAIN_GRAPHICS_TYPE_SPICE);
+
+ return 0;
+}
+
+static int
+libxlMakeDomainDeviceVideoCaps(virDomainCapsDeviceVideoPtr dev)
+{
+ dev->supported = true;
+
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType,
+ VIR_DOMAIN_VIDEO_TYPE_VGA,
+ VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
+ VIR_DOMAIN_VIDEO_TYPE_XEN);
+
+ return 0;
+}
+
+static int
+libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdevPtr dev)
+{
+ dev->supported = true;
+ /* VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES is for containers only */
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->mode,
+ VIR_DOMAIN_HOSTDEV_MODE_SUBSYS);
+
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->startupPolicy,
+ VIR_DOMAIN_STARTUP_POLICY_DEFAULT,
+ VIR_DOMAIN_STARTUP_POLICY_MANDATORY,
+ VIR_DOMAIN_STARTUP_POLICY_REQUISITE,
+ VIR_DOMAIN_STARTUP_POLICY_OPTIONAL);
+
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI);
+
+ /* No virDomainHostdevCapsType for libxl */
+ virDomainCapsEnumClear(&dev->capsType);
+
+ virDomainCapsEnumClear(&dev->pciBackend);
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->pciBackend,
+ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN);
+ return 0;
+}
+
virCapsPtr
libxlMakeCapabilities(libxl_ctx *ctx)
{
@@ -424,6 +529,41 @@ libxlMakeCapabilities(libxl_ctx *ctx)
return NULL;
}
+/*
+ * Currently Xen has no interface to report maxvcpus supported
+ * for the various domain types (PV, HVM, PVH). HVM_MAX_VCPUS
+ * is defined in $xensrc/xen/include/public/hvm/hvm_info_table.h
+ * PV has no equivalent and is relunctantly set here until Xen
+ * can report such capabilities.
+ */
+#define HVM_MAX_VCPUS 128
+#define PV_MAX_VCPUS 512
+
+int
+libxlMakeDomainCapabilities(virDomainCapsPtr domCaps,
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares)
+{
+ virDomainCapsOSPtr os = &domCaps->os;
+ virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
+ virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
+ virDomainCapsDeviceVideoPtr video = &domCaps->video;
+ virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
+
+ if (STREQ(domCaps->machine, "xenfv"))
+ domCaps->maxvcpus = HVM_MAX_VCPUS;
+ else
+ domCaps->maxvcpus = PV_MAX_VCPUS;
+
+ if (libxlMakeDomainOSCaps(domCaps->machine, os, firmwares, nfirmwares) < 0 ||
+ libxlMakeDomainDeviceDiskCaps(disk) < 0 ||
+ libxlMakeDomainDeviceGraphicsCaps(graphics) < 0 ||
+ libxlMakeDomainDeviceVideoCaps(video) < 0 ||
+ libxlMakeDomainDeviceHostdevCaps(hostdev) < 0)
+ return -1;
+ return 0;
+}
+
#define LIBXL_QEMU_DM_STR "Options specific to the Xen version:"
int
diff --git a/src/libxl/libxl_capabilities.h b/src/libxl/libxl_capabilities.h
index df1c327..992b780 100644
--- a/src/libxl/libxl_capabilities.h
+++ b/src/libxl/libxl_capabilities.h
@@ -27,6 +27,8 @@
# include "virobject.h"
# include "capabilities.h"
+# include "domain_capabilities.h"
+# include "virfirmware.h"
# ifndef LIBXL_FIRMWARE_DIR
@@ -45,6 +47,11 @@ virCapsPtr
libxlMakeCapabilities(libxl_ctx *ctx);
int
+libxlMakeDomainCapabilities(virDomainCapsPtr domCaps,
+ virFirmwarePtr *firmwares,
+ size_t nfirmwares);
+
+int
libxlDomainGetEmulatorType(const virDomainDef *def);
#endif /* LIBXL_CAPABILITIES_H */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index afc5ac3..82b8b83 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -5562,6 +5562,79 @@ libxlDomainInterfaceAddresses(virDomainPtr dom,
}
+static char *
+libxlConnectGetDomainCapabilities(virConnectPtr conn,
+ const char *emulatorbin,
+ const char *arch_str,
+ const char *machine,
+ const char *virttype_str,
+ unsigned int flags)
+{
+ libxlDriverPrivatePtr driver = conn->privateData;
+ libxlDriverConfigPtr cfg;
+ char *ret = NULL;
+ int virttype = VIR_DOMAIN_VIRT_XEN;
+ virDomainCapsPtr domCaps = NULL;
+ int arch = virArchFromHost(); /* virArch */
+
+ virCheckFlags(0, ret);
+
+ if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
+ return ret;
+
+ cfg = libxlDriverConfigGet(driver);
+
+ if (virttype_str &&
+ (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown virttype: %s"),
+ virttype_str);
+ goto cleanup;
+ }
+
+ if (virttype != VIR_DOMAIN_VIRT_XEN) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown virttype: %s"),
+ virttype_str);
+ goto cleanup;
+ }
+
+ if (arch_str && (arch = virArchFromString(arch_str)) == VIR_ARCH_NONE) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown architecture: %s"),
+ arch_str);
+ goto cleanup;
+ }
+
+ if (emulatorbin == NULL)
+ emulatorbin = "/usr/bin/qemu-system-x86_64";
+
+ if (machine) {
+ if (STRNEQ(machine, "xenpv") && STRNEQ(machine, "xenfv")) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Xen only supports 'xenpv' and 'xenfv' machines"));
+ goto cleanup;
+ }
+ } else {
+ machine = "xenpv";
+ }
+
+ if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
+ goto cleanup;
+
+ if (libxlMakeDomainCapabilities(domCaps, cfg->firmwares,
+ cfg->nfirmwares) < 0)
+ goto cleanup;
+
+ ret = virDomainCapsFormat(domCaps);
+
+ cleanup:
+ virObjectUnref(domCaps);
+ virObjectUnref(cfg);
+ return ret;
+}
+
+
static virHypervisorDriver libxlHypervisorDriver = {
.name = LIBXL_DRIVER_NAME,
.connectOpen = libxlConnectOpen, /* 0.9.0 */
@@ -5663,6 +5736,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
.domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
.nodeGetSecurityModel = libxlNodeGetSecurityModel, /* 1.2.16 */
.domainInterfaceAddresses = libxlDomainInterfaceAddresses, /* 1.3.5 */
+ .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 1.3.5 */
};
static virConnectDriver libxlConnectDriver = {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 28070ea..a301068 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -926,6 +926,11 @@ domaincapstest_SOURCES += testutilsqemu.c testutilsqemu.h
domaincapstest_LDADD += $(qemu_LDADDS) $(GNULIB_LIBS)
endif WITH_QEMU
+if WITH_LIBXL
+domaincapstest_SOURCES += testutilsxen.c testutilsxen.h
+domaincapstest_LDADD += ../src/libvirt_driver_libxl_impl.la
+endif WITH_LIBXL
+
if WITH_LIBVIRTD
libvirtdconftest_SOURCES = \
libvirtdconftest.c testutils.h testutils.c \
diff --git a/tests/domaincapsschemadata/libxl-xenfv.xml b/tests/domaincapsschemadata/libxl-xenfv.xml
new file mode 100644
index 0000000..9436ef8
--- /dev/null
+++ b/tests/domaincapsschemadata/libxl-xenfv.xml
@@ -0,0 +1,68 @@
+<domainCapabilities>
+ <path>/usr/bin/qemu-system-x86_64</path>
+ <domain>xen</domain>
+ <machine>xenfv</machine>
+ <arch>x86_64</arch>
+ <vcpu max='128'/>
+ <os supported='yes'>
+ <loader supported='yes'>
+ <value>/usr/lib/xen/boot/hvmloader</value>
+ <value>/usr/lib/xen/boot/ovmf.bin</value>
+ <enum name='type'>
+ <value>rom</value>
+ <value>pflash</value>
+ </enum>
+ <enum name='readonly'>
+ <value>yes</value>
+ </enum>
+ </loader>
+ </os>
+ <devices>
+ <disk supported='yes'>
+ <enum name='diskDevice'>
+ <value>disk</value>
+ <value>cdrom</value>
+ </enum>
+ <enum name='bus'>
+ <value>ide</value>
+ <value>scsi</value>
+ <value>xen</value>
+ </enum>
+ </disk>
+ <graphics supported='yes'>
+ <enum name='type'>
+ <value>sdl</value>
+ <value>vnc</value>
+ <value>spice</value>
+ </enum>
+ </graphics>
+ <video supported='yes'>
+ <enum name='modelType'>
+ <value>vga</value>
+ <value>cirrus</value>
+ <value>xen</value>
+ </enum>
+ </video>
+ <hostdev supported='yes'>
+ <enum name='mode'>
+ <value>subsystem</value>
+ </enum>
+ <enum name='startupPolicy'>
+ <value>default</value>
+ <value>mandatory</value>
+ <value>requisite</value>
+ <value>optional</value>
+ </enum>
+ <enum name='subsysType'>
+ <value>pci</value>
+ </enum>
+ <enum name='capsType'/>
+ <enum name='pciBackend'>
+ <value>xen</value>
+ </enum>
+ </hostdev>
+ </devices>
+ <features>
+ <gic supported='no'/>
+ </features>
+</domainCapabilities>
diff --git a/tests/domaincapsschemadata/libxl-xenpv.xml b/tests/domaincapsschemadata/libxl-xenpv.xml
new file mode 100644
index 0000000..ab00a28
--- /dev/null
+++ b/tests/domaincapsschemadata/libxl-xenpv.xml
@@ -0,0 +1,58 @@
+<domainCapabilities>
+ <path>/usr/bin/qemu-system-x86_64</path>
+ <domain>xen</domain>
+ <machine>xenpv</machine>
+ <arch>x86_64</arch>
+ <vcpu max='512'/>
+ <os supported='yes'>
+ <loader supported='no'/>
+ </os>
+ <devices>
+ <disk supported='yes'>
+ <enum name='diskDevice'>
+ <value>disk</value>
+ <value>cdrom</value>
+ </enum>
+ <enum name='bus'>
+ <value>ide</value>
+ <value>scsi</value>
+ <value>xen</value>
+ </enum>
+ </disk>
+ <graphics supported='yes'>
+ <enum name='type'>
+ <value>sdl</value>
+ <value>vnc</value>
+ <value>spice</value>
+ </enum>
+ </graphics>
+ <video supported='yes'>
+ <enum name='modelType'>
+ <value>vga</value>
+ <value>cirrus</value>
+ <value>xen</value>
+ </enum>
+ </video>
+ <hostdev supported='yes'>
+ <enum name='mode'>
+ <value>subsystem</value>
+ </enum>
+ <enum name='startupPolicy'>
+ <value>default</value>
+ <value>mandatory</value>
+ <value>requisite</value>
+ <value>optional</value>
+ </enum>
+ <enum name='subsysType'>
+ <value>pci</value>
+ </enum>
+ <enum name='capsType'/>
+ <enum name='pciBackend'>
+ <value>xen</value>
+ </enum>
+ </hostdev>
+ </devices>
+ <features>
+ <gic supported='no'/>
+ </features>
+</domainCapabilities>
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 83ce0e5..9fb2c97 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -162,10 +162,41 @@ fillQemuCaps(virDomainCapsPtr domCaps,
#endif /* WITH_QEMU */
+#ifdef WITH_LIBXL
+# include "testutilsxen.h"
+
+static int
+fillXenCaps(virDomainCapsPtr domCaps)
+{
+ virFirmwarePtr *firmwares;
+ int ret = -1;
+
+ if (VIR_ALLOC_N(firmwares, 2) < 0)
+ return ret;
+
+ if (VIR_ALLOC(firmwares[0]) < 0 || VIR_ALLOC(firmwares[1]) < 0)
+ goto cleanup;
+ if (VIR_STRDUP(firmwares[0]->name, "/usr/lib/xen/boot/hvmloader") < 0 ||
+ VIR_STRDUP(firmwares[1]->name, "/usr/lib/xen/boot/ovmf.bin") < 0)
+ goto cleanup;
+
+ if (libxlMakeDomainCapabilities(domCaps, firmwares, 2) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ virFirmwareFreeList(firmwares, 2);
+ return ret;
+}
+#endif /* WITH_LIBXL */
+
+
enum testCapsType {
CAPS_NONE,
CAPS_ALL,
CAPS_QEMU,
+ CAPS_LIBXL,
};
struct testData {
@@ -213,6 +244,13 @@ test_virDomainCapsFormat(const void *opaque)
goto cleanup;
#endif
break;
+
+ case CAPS_LIBXL:
+#if WITH_LIBXL
+ if (fillXenCaps(domCaps) < 0)
+ goto cleanup;
+#endif
+ break;
}
if (!(domCapsXML = virDomainCapsFormat(domCaps)))
@@ -280,6 +318,20 @@ mymain(void)
VIR_FREE(name); \
} while (0)
+#define DO_TEST_LIBXL(Name, Emulator, Machine, Arch, Type) \
+ do { \
+ struct testData data = { \
+ .name = Name, \
+ .emulator = Emulator, \
+ .machine = Machine, \
+ .arch = Arch, \
+ .type = Type, \
+ .capsType = CAPS_LIBXL, \
+ }; \
+ if (virTestRun(Name, test_virDomainCapsFormat, &data) < 0) \
+ ret = -1; \
+ } while (0)
+
DO_TEST("basic", "/bin/emulatorbin", "my-machine-type",
"x86_64", VIR_DOMAIN_VIRT_UML, CAPS_NONE);
DO_TEST("full", "/bin/emulatorbin", "my-machine-type",
@@ -313,6 +365,15 @@ mymain(void)
#endif /* WITH_QEMU */
+#if WITH_LIBXL
+
+ DO_TEST_LIBXL("libxl-xenpv", "/usr/bin/qemu-system-x86_64",
+ "xenpv", "x86_64", VIR_DOMAIN_VIRT_XEN);
+ DO_TEST_LIBXL("libxl-xenfv", "/usr/bin/qemu-system-x86_64",
+ "xenfv", "x86_64", VIR_DOMAIN_VIRT_XEN);
+
+#endif /* WITH_LIBXL */
+
return ret;
}
diff --git a/tests/testutilsxen.h b/tests/testutilsxen.h
index c78350d..8b997c3 100644
--- a/tests/testutilsxen.h
+++ b/tests/testutilsxen.h
@@ -2,6 +2,7 @@
# define _TESTUTILSXEN_H_
# include "capabilities.h"
+# include "libxl/libxl_capabilities.h"
virCapsPtr testXenCapsInit(void);
--
2.1.4
8 years, 5 months