[libvirt] [PATCH 0/3] qemu: backup: Allow configuring and reading back of export an backup bitmap name
by Peter Krempa
These were already posted before.
oVirt folks would like to be able to read the export and bitmap names.
Given that I already wrote support for configuring it and it's rather
simple I'm re-posting these as they were before.
Peter Krempa (3):
conf: backup: Allow configuration of names exported via NBD
qemu: backup: Implement support for backup disk export name
configuration
qemu: backup: Implement support for backup disk bitmap name
configuration
docs/formatbackup.html.in | 9 +++++++++
docs/schemas/domainbackup.rng | 8 ++++++++
src/conf/backup_conf.c | 11 +++++++++++
src/conf/backup_conf.h | 2 ++
src/qemu/qemu_backup.c | 14 ++++++++++++--
.../domainbackupxml2xmlin/backup-pull-seclabel.xml | 2 +-
.../backup-pull-seclabel.xml | 2 +-
7 files changed, 44 insertions(+), 4 deletions(-)
--
2.24.1
4 years, 10 months
[PATCH 0/2] util: hash: Aid in debugging of duplicate keys
by Peter Krempa
See patch 1 for rationale.
Peter Krempa (2):
util: hash: Improve debugability of "Duplicate key" error message
tests: hash: Test case for adding duplicate hash entry
src/conf/domain_addr.c | 9 +++++++++
src/util/vircgroup.c | 8 ++++++++
src/util/virhash.c | 22 ++++++++++++++++++++--
src/util/virhash.h | 13 +++++++++++++
tests/virhashtest.c | 23 +++++++++++++++++++++++
5 files changed, 73 insertions(+), 2 deletions(-)
--
2.24.1
4 years, 10 months
[libvirt] [PATCH] qemu: Refuse to use "ps2" on machines that do not have this bus
by Thomas Huth
The "ps2" bus is only available on certain machines like x86. On
machines like s390x, we should refuse to add a device to this bus
instead of silently ignoring it.
Looking at the QEMU sources, PS/2 is only available if the QEMU binary
has the "i8042" device, so let's check for that and only allow "ps2"
devices if this QEMU device is available, or if we're on x86 anyway
(so we don't have to fake the QEMU_CAPS_DEVICE_I8042 capability in
all the tests that use <input ... bus='ps2'/> in their xml data).
Reported-by: Sebastian Mitterle <smitterl(a)redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1763191
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 10 +++++++++-
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 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.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 +
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/qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 +
.../qemuhotplug-base-ccw-live+ccw-virtio.xml | 6 ------
...cw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml | 6 ------
...ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 6 ------
.../qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml | 6 ------
...-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml | 6 ------
...plug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 6 ------
.../qemuhotplug-base-ccw-live-with-ccw-virtio.xml | 6 ------
.../qemuhotplug-base-ccw-live.xml | 6 ------
37 files changed, 38 insertions(+), 49 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 84c62a4e28..e22ef28662 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -553,6 +553,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"blockdev-file-dynamic-auto-read-only",
"savevm-monitor-nodes",
"drive-nvme",
+ "i8042",
);
@@ -1244,6 +1245,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "vhost-user-vga", QEMU_CAPS_DEVICE_VHOST_USER_VGA },
{ "ramfb", QEMU_CAPS_DEVICE_RAMFB },
{ "max-arm-cpu", QEMU_CAPS_ARM_MAX_CPU },
+ { "i8042", QEMU_CAPS_DEVICE_I8042 },
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 193c19fc81..c1ce590cab 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -534,6 +534,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC, /* the auto-read-only property of block backends for files is dynamic */
QEMU_CAPS_SAVEVM_MONITOR_NODES, /* 'savevm' handles monitor-owned nodes properly */
QEMU_CAPS_DRIVE_NVME, /* -drive file.driver=nvme */
+ QEMU_CAPS_DEVICE_I8042, /* PS/2 controller */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a6dde15bad..ada7d9b318 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8039,13 +8039,21 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef *graphics,
static int
qemuDomainDeviceDefValidateInput(const virDomainInputDef *input,
- const virDomainDef *def G_GNUC_UNUSED,
+ const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
const char *baseName;
int cap;
int ccwCap;
+ if (input->bus == VIR_DOMAIN_INPUT_BUS_PS2 && !ARCH_IS_X86(def->os.arch) &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_I8042)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("%s is not supported by this QEMU binary"),
+ virDomainInputBusTypeToString(input->bus));
+ return -1;
+ }
+
if (input->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO)
return 0;
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
index f2257d6bd2..b57cb2ab59 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
@@ -84,6 +84,7 @@
<flag name='isa-serial'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>1005003</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100245</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
index 3a70ec8146..5d0a14a5db 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
@@ -89,6 +89,7 @@
<flag name='isa-serial'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>1006000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
index cbb29ef2de..c196fe5e45 100644
--- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
@@ -91,6 +91,7 @@
<flag name='isa-serial'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>1007000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
index a6d0981224..1edcaa4657 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
@@ -107,6 +107,7 @@
<flag name='isa-serial'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>2001001</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
index 5a57cb7760..b95a9d42ad 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
@@ -139,6 +139,7 @@
<flag name='vhost-vsock'/>
<flag name='egl-headless'/>
<flag name='iothread.poll-max-ns'/>
+ <flag name='i8042'/>
<version>2010000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900287</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
index 53872abf2f..7ebe97b6ab 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
@@ -182,6 +182,7 @@
<flag name='egl-headless'/>
<flag name='iothread.poll-max-ns'/>
<flag name='x86-max-cpu'/>
+ <flag name='i8042'/>
<version>2010000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100287</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml
index f70335db8f..b8eb3abd40 100644
--- a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml
@@ -188,6 +188,7 @@
<flag name='egl-headless'/>
<flag name='iothread.poll-max-ns'/>
<flag name='x86-max-cpu'/>
+ <flag name='i8042'/>
<version>2011000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100288</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
index 74c80d2fe9..38a3103c4a 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
@@ -153,6 +153,7 @@
<flag name='iothread.poll-max-ns'/>
<flag name='memory-backend-file.align'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>2011090</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900289</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
index b51cee9f28..0c30cc75da 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
@@ -197,6 +197,7 @@
<flag name='memory-backend-file.align'/>
<flag name='x86-max-cpu'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>2011090</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100289</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
index 86d85faa73..9b486effe1 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
@@ -133,6 +133,7 @@
<flag name='sdl-gl'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>2004000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
index b217238307..147b179fdb 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
@@ -139,6 +139,7 @@
<flag name='sdl-gl'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>2005000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
index 862464c2f0..deb5c28790 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
@@ -118,6 +118,7 @@
<flag name='nbd-tls'/>
<flag name='sdl-gl'/>
<flag name='hda-output'/>
+ <flag name='i8042'/>
<version>2006000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
index 6b96e37a16..fc508aba8a 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
@@ -151,6 +151,7 @@
<flag name='sdl-gl'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>2006000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
index bc1359b0dd..ed199057dc 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
@@ -156,6 +156,7 @@
<flag name='sdl-gl'/>
<flag name='hda-output'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>2007000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100245</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
index c7f3be3a1b..489b67f99a 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
@@ -159,6 +159,7 @@
<flag name='hda-output'/>
<flag name='vhost-vsock'/>
<flag name='mch'/>
+ <flag name='i8042'/>
<version>2008000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100246</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
index a00d4b3d4c..3bc6ec8dab 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
@@ -131,6 +131,7 @@
<flag name='blockdev-del'/>
<flag name='vhost-vsock'/>
<flag name='iothread.poll-max-ns'/>
+ <flag name='i8042'/>
<version>2009000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900247</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index 3d96f5f5b3..83fc6cde97 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -176,6 +176,7 @@
<flag name='mch'/>
<flag name='iothread.poll-max-ns'/>
<flag name='x86-max-cpu'/>
+ <flag name='i8042'/>
<version>2009000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100247</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
index 3b5a021dcf..9a0b9c05c2 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
@@ -155,6 +155,7 @@
<flag name='bochs-display'/>
<flag name='ramfb'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>2012050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900239</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
index c955994ac0..9d12215600 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
@@ -202,6 +202,7 @@
<flag name='bochs-display'/>
<flag name='ramfb'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>3000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100239</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml
index cab38d442b..2cf2e4f655 100644
--- a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml
@@ -159,6 +159,7 @@
<flag name='overcommit'/>
<flag name='bochs-display'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>3000091</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml
index 3e89d7f933..5df9b5ef1b 100644
--- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml
@@ -205,6 +205,7 @@
<flag name='bochs-display'/>
<flag name='ramfb'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>3000092</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
index 4e13888042..964f02b062 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
@@ -173,6 +173,7 @@
<flag name='migration-file-drop-cache'/>
<flag name='machine.pseries.cap-ccf-assist'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index ba32d4c592..d545c3d9e8 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -210,6 +210,7 @@
<flag name='migration-file-drop-cache'/>
<flag name='ramfb'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
index a98945de0e..f54db10cd9 100644
--- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
@@ -215,6 +215,7 @@
<flag name='ramfb'/>
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>4001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index ee9fb23640..404a2a9168 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -176,6 +176,7 @@
<flag name='machine.pseries.cap-ccf-assist'/>
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>4001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
index 4857e2f5a5..fa87b72e2b 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
@@ -218,6 +218,7 @@
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='savevm-monitor-nodes'/>
<flag name='drive-nvme'/>
+ <flag name='i8042'/>
<version>4002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
index f501cde333..59c969e0f2 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
@@ -44,12 +44,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
index 301658178f..d10b29be7e 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
@@ -54,12 +54,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'>
<alias name='balloon0'/>
</memballoon>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
index 223e929ad5..6eadbdcd18 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
@@ -54,12 +54,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
index c745d48558..68561b50a3 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
@@ -44,12 +44,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
index 3189294b65..0900f3c8e3 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
@@ -53,12 +53,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
index 3189294b65..0900f3c8e3 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
@@ -53,12 +53,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
index edf57fcd3f..31979c40f0 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
@@ -43,12 +43,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
index b97bba78c6..844b951940 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
@@ -34,12 +34,6 @@
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
- <input type='mouse' bus='ps2'>
- <alias name='input0'/>
- </input>
- <input type='keyboard' bus='ps2'>
- <alias name='input1'/>
- </input>
<memballoon model='none'/>
<panic model='s390'/>
</devices>
--
2.18.1
4 years, 10 months
[PATCH] qemu-nbd: Removed deprecated --partition option
by Eric Blake
The option was deprecated in 4.0.0 (commit 0ae2d546); it's now been
long enough with no complaints to follow through with that process.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
qemu-deprecated.texi | 49 ++++++----------
qemu-nbd.c | 133 +------------------------------------------
qemu-nbd.texi | 13 ++---
3 files changed, 24 insertions(+), 171 deletions(-)
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 8471eef9c22d..1b4c638db8e0 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -304,37 +304,6 @@ The above, converted to the current supported format:
@section Related binaries
-@subsection qemu-nbd --partition (since 4.0.0)
-
-The ``qemu-nbd --partition $digit'' code (also spelled @option{-P})
-can only handle MBR partitions, and has never correctly handled
-logical partitions beyond partition 5. If you know the offset and
-length of the partition (perhaps by using @code{sfdisk} within the
-guest), you can achieve the effect of exporting just that subset of
-the disk by use of the @option{--image-opts} option with a raw
-blockdev using the @code{offset} and @code{size} parameters layered on
-top of any other existing blockdev. For example, if partition 1 is
-100MiB long starting at 1MiB, the old command:
-
-@code{qemu-nbd -t -P 1 -f qcow2 file.qcow2}
-
-can be rewritten as:
-
-@code{qemu-nbd -t --image-opts driver=raw,offset=1M,size=100M,file.driver=qcow2,file.backing.driver=file,file.backing.filename=file.qcow2}
-
-Alternatively, the @code{nbdkit} project provides a more powerful
-partition filter on top of its nbd plugin, which can be used to select
-an arbitrary MBR or GPT partition on top of any other full-image NBD
-export. Using this to rewrite the above example results in:
-
-@code{qemu-nbd -t -k /tmp/sock -f qcow2 file.qcow2 &}
-@code{nbdkit -f --filter=partition nbd socket=/tmp/sock partition=1}
-
-Note that if you are exposing the export via /dev/nbd0, it is easier
-to just export the entire image and then mount only /dev/nbd0p1 than
-it is to reinvoke @command{qemu-nbd -c /dev/nbd0} limited to just a
-subset of the image.
-
@subsection qemu-img convert -n -o (since 4.2.0)
All options specified in @option{-o} are image creation options, so
@@ -383,3 +352,21 @@ trouble after a recent upgrade.
The "autoload" parameter has been ignored since 2.12.0. All bitmaps
are automatically loaded from qcow2 images.
+
+@section Related binaries
+
+@subsection qemu-nbd --partition (removed in 5.0.0)
+
+The ``qemu-nbd --partition $digit'' code (also spelled @option{-P})
+could only handle MBR partitions, and never correctly handled logical
+partitions beyond partition 5. Exporting a partition can still be
+done by utilizing the @option{--image-opts} option with a raw blockdev
+using the @code{offset} and @code{size} parameters layered on top of
+any other existing blockdev. For example, if partition 1 is 100MiB
+long starting at 1MiB, the old command:
+
+@code{qemu-nbd -t -P 1 -f qcow2 file.qcow2}
+
+can be rewritten as:
+
+@code{qemu-nbd -t --image-opts driver=raw,offset=1M,size=100M,file.driver=qcow2,file.backing.driver=file,file.backing.filename=file.qcow2}
diff --git a/qemu-nbd.c b/qemu-nbd.c
index bc125370dd36..e6f2eb76a3f2 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -100,7 +100,6 @@ static void usage(const char *name)
"\n"
"Exposing part of the image:\n"
" -o, --offset=OFFSET offset into the image\n"
-" -P, --partition=NUM only expose partition NUM\n"
" -B, --bitmap=NAME expose a persistent dirty bitmap\n"
"\n"
"General purpose options:\n"
@@ -156,96 +155,6 @@ QEMU_COPYRIGHT "\n"
, name);
}
-struct partition_record
-{
- uint8_t bootable;
- uint8_t start_head;
- uint32_t start_cylinder;
- uint8_t start_sector;
- uint8_t system;
- uint8_t end_head;
- uint8_t end_cylinder;
- uint8_t end_sector;
- uint32_t start_sector_abs;
- uint32_t nb_sectors_abs;
-};
-
-static void read_partition(uint8_t *p, struct partition_record *r)
-{
- r->bootable = p[0];
- r->start_head = p[1];
- r->start_cylinder = p[3] | ((p[2] << 2) & 0x0300);
- r->start_sector = p[2] & 0x3f;
- r->system = p[4];
- r->end_head = p[5];
- r->end_cylinder = p[7] | ((p[6] << 2) & 0x300);
- r->end_sector = p[6] & 0x3f;
-
- r->start_sector_abs = ldl_le_p(p + 8);
- r->nb_sectors_abs = ldl_le_p(p + 12);
-}
-
-static int find_partition(BlockBackend *blk, int partition,
- uint64_t *offset, uint64_t *size)
-{
- struct partition_record mbr[4];
- uint8_t data[MBR_SIZE];
- int i;
- int ext_partnum = 4;
- int ret;
-
- ret = blk_pread(blk, 0, data, sizeof(data));
- if (ret < 0) {
- error_report("error while reading: %s", strerror(-ret));
- exit(EXIT_FAILURE);
- }
-
- if (data[510] != 0x55 || data[511] != 0xaa) {
- return -EINVAL;
- }
-
- for (i = 0; i < 4; i++) {
- read_partition(&data[446 + 16 * i], &mbr[i]);
-
- if (!mbr[i].system || !mbr[i].nb_sectors_abs) {
- continue;
- }
-
- if (mbr[i].system == 0xF || mbr[i].system == 0x5) {
- struct partition_record ext[4];
- uint8_t data1[MBR_SIZE];
- int j;
-
- ret = blk_pread(blk, mbr[i].start_sector_abs * MBR_SIZE,
- data1, sizeof(data1));
- if (ret < 0) {
- error_report("error while reading: %s", strerror(-ret));
- exit(EXIT_FAILURE);
- }
-
- for (j = 0; j < 4; j++) {
- read_partition(&data1[446 + 16 * j], &ext[j]);
- if (!ext[j].system || !ext[j].nb_sectors_abs) {
- continue;
- }
-
- if ((ext_partnum + j + 1) == partition) {
- *offset = (uint64_t)ext[j].start_sector_abs << 9;
- *size = (uint64_t)ext[j].nb_sectors_abs << 9;
- return 0;
- }
- }
- ext_partnum += 4;
- } else if ((i + 1) == partition) {
- *offset = (uint64_t)mbr[i].start_sector_abs << 9;
- *size = (uint64_t)mbr[i].nb_sectors_abs << 9;
- return 0;
- }
- }
-
- return -ENOENT;
-}
-
static void termsig_handler(int signum)
{
atomic_cmpxchg(&state, RUNNING, TERMINATE);
@@ -620,7 +529,7 @@ int main(int argc, char **argv)
int64_t fd_size;
QemuOpts *sn_opts = NULL;
const char *sn_id_or_name = NULL;
- const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:T:D:B:L";
+ const char *sopt = "hVb:o:p:rsnc:dvk:e:f:tl:x:T:D:B:L";
struct option lopt[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
@@ -629,7 +538,6 @@ int main(int argc, char **argv)
{ "socket", required_argument, NULL, 'k' },
{ "offset", required_argument, NULL, 'o' },
{ "read-only", no_argument, NULL, 'r' },
- { "partition", required_argument, NULL, 'P' },
{ "bitmap", required_argument, NULL, 'B' },
{ "connect", required_argument, NULL, 'c' },
{ "disconnect", no_argument, NULL, 'd' },
@@ -660,7 +568,6 @@ int main(int argc, char **argv)
int ch;
int opt_ind = 0;
int flags = BDRV_O_RDWR;
- int partition = 0;
int ret = 0;
bool seen_cache = false;
bool seen_discard = false;
@@ -796,15 +703,6 @@ int main(int argc, char **argv)
readonly = true;
flags &= ~BDRV_O_RDWR;
break;
- case 'P':
- warn_report("The '-P' option is deprecated; use --image-opts with "
- "a raw device wrapper for subset exports instead");
- if (qemu_strtoi(optarg, NULL, 0, &partition) < 0 ||
- partition < 1 || partition > 8) {
- error_report("Invalid partition '%s'", optarg);
- exit(EXIT_FAILURE);
- }
- break;
case 'B':
bitmap = optarg;
break;
@@ -901,7 +799,7 @@ int main(int argc, char **argv)
error_report("List mode is incompatible with a file name");
exit(EXIT_FAILURE);
}
- if (export_name || export_description || dev_offset || partition ||
+ if (export_name || export_description || dev_offset ||
device || disconnect || fmt || sn_id_or_name || bitmap ||
seen_aio || seen_discard || seen_cache) {
error_report("List mode is incompatible with per-device settings");
@@ -1165,33 +1063,6 @@ int main(int argc, char **argv)
}
fd_size -= dev_offset;
- if (partition) {
- uint64_t limit;
-
- if (dev_offset) {
- error_report("Cannot request partition and offset together");
- exit(EXIT_FAILURE);
- }
- ret = find_partition(blk, partition, &dev_offset, &limit);
- if (ret < 0) {
- error_report("Could not find partition %d: %s", partition,
- strerror(-ret));
- exit(EXIT_FAILURE);
- }
- /*
- * MBR partition limits are (32-bit << 9); this assert lets
- * the compiler know that we can't overflow 64 bits.
- */
- assert(dev_offset + limit >= dev_offset);
- if (dev_offset + limit > fd_size) {
- error_report("Discovered partition %d at offset %" PRIu64
- " size %" PRIu64 ", but size exceeds file length %"
- PRId64, partition, dev_offset, limit, fd_size);
- exit(EXIT_FAILURE);
- }
- fd_size = limit;
- }
-
export = nbd_export_new(bs, dev_offset, fd_size, export_name,
export_description, bitmap, readonly, shared > 1,
nbd_export_closed, writethrough, NULL,
diff --git a/qemu-nbd.texi b/qemu-nbd.texi
index 7f55657722bd..36f4188a3f27 100644
--- a/qemu-nbd.texi
+++ b/qemu-nbd.texi
@@ -55,11 +55,6 @@ Force the use of the block driver for format @var{fmt} instead of
auto-detecting.
@item -r, --read-only
Export the disk as read-only.
-@item -P, --partition=@var{num}
-Deprecated: Only expose MBR partition @var{num}. Understands physical
-partitions 1-4 and logical partition 5. New code should instead use
-@option{--image-opts} with the raw driver wrapping a subset of the
-original image.
@item -B, --bitmap=@var{name}
If @var{filename} has a qcow2 persistent bitmap @var{name}, expose
that bitmap via the ``qemu:dirty-bitmap:@var{name}'' context
@@ -161,13 +156,13 @@ qemu-nbd \
--image-opts driver=raw,offset=1M,size=1M,file.driver=file,file.filename=file.raw
@end example
-Serve a read-only copy of just the first MBR partition of a guest
-image over a Unix socket with as many as 5 simultaneous readers, with
-a persistent process forked as a daemon:
+Serve a read-only copy of a guest image over a Unix socket with as
+many as 5 simultaneous readers, with a persistent process forked as a
+daemon:
@example
qemu-nbd --fork --persistent --shared=5 --socket=/path/to/sock \
- --partition=1 --read-only --format=qcow2 file.qcow2
+ --read-only --format=qcow2 file.qcow2
@end example
Expose the guest-visible contents of a qcow2 file via a block device
--
2.24.1
4 years, 10 months
[libvirt PATCH v2] qemu: fixing auto-detecting binary in domain capabilities
by Daniel P. Berrangé
The virConnectGetDomainCapabilities API accepts either a binary path
to the emulator, or desired guest arch. If guest arch is not given,
then the host arch is assumed.
In the case where the binary is not given, the code tried to find the
emulator binary in the existing list of cached emulator capabilities.
This is not valid since we switched to lazy population of the cache in:
commit 3dd91af01f30c5bda6328454ef49f3afece755d6
Author: Daniel P. Berrangé <berrange(a)redhat.com>
Date: Mon Dec 2 13:04:26 2019 +0000
qemu: stop creating capabilities at driver startup
As a result of this change, if there are no persistent guests defined
using the requested guest architecture, virConnectGetDomainCapabilities
will fail to find an emulator binary.
The solution is to stop relying on the cached capabilities to find the
binary and instead use the same logic we use to pick default a binary
per arch when populating capabilities.
Tested-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 45 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 498348ad58..14c2aa34d2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5280,10 +5280,13 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache,
const char **retMachine)
{
int virttype = VIR_DOMAIN_VIRT_NONE;
- int arch = virArchFromHost();
+ virArch hostarch = virArchFromHost();
+ virArch arch = hostarch;
virDomainVirtType capsType;
virQEMUCapsPtr qemuCaps = NULL;
virQEMUCapsPtr ret = NULL;
+ virArch arch_from_caps;
+ g_autofree char *probedbinary = NULL;
if (virttypeStr &&
(virttype = virDomainVirtTypeFromString(virttypeStr)) < 0) {
@@ -5299,31 +5302,27 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache,
goto cleanup;
}
- if (binary) {
- virArch arch_from_caps;
+ if (!binary) {
+ probedbinary = virQEMUCapsGetDefaultEmulator(hostarch, arch);
+ binary = probedbinary;
+ }
- if (!(qemuCaps = virQEMUCapsCacheLookup(cache, binary)))
- goto cleanup;
+ if (!(qemuCaps = virQEMUCapsCacheLookup(cache, binary)))
+ goto cleanup;
- arch_from_caps = virQEMUCapsGetArch(qemuCaps);
+ arch_from_caps = virQEMUCapsGetArch(qemuCaps);
- if (arch_from_caps != arch &&
- !((ARCH_IS_X86(arch) && ARCH_IS_X86(arch_from_caps)) ||
- (ARCH_IS_PPC(arch) && ARCH_IS_PPC(arch_from_caps)) ||
- (ARCH_IS_ARM(arch) && ARCH_IS_ARM(arch_from_caps)) ||
- (ARCH_IS_S390(arch) && ARCH_IS_S390(arch_from_caps)))) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("architecture from emulator '%s' doesn't "
- "match given architecture '%s'"),
- virArchToString(arch_from_caps),
- virArchToString(arch));
- goto cleanup;
- }
- } else {
- if (!(qemuCaps = virQEMUCapsCacheLookupByArch(cache, arch)))
- goto cleanup;
-
- binary = virQEMUCapsGetBinary(qemuCaps);
+ if (arch_from_caps != arch &&
+ !((ARCH_IS_X86(arch) && ARCH_IS_X86(arch_from_caps)) ||
+ (ARCH_IS_PPC(arch) && ARCH_IS_PPC(arch_from_caps)) ||
+ (ARCH_IS_ARM(arch) && ARCH_IS_ARM(arch_from_caps)) ||
+ (ARCH_IS_S390(arch) && ARCH_IS_S390(arch_from_caps)))) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("architecture from emulator '%s' doesn't "
+ "match given architecture '%s'"),
+ virArchToString(arch_from_caps),
+ virArchToString(arch));
+ goto cleanup;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
--
2.23.0
4 years, 10 months
[PATCH 0/2] lxc: Implement lxcDomainInterfaceAddresses() function
by Julio Faracco
It is not able to retrieve IP addresses from LXC domains. This method
was not implemented before. LXC uses the same operations to retrieve
this information, but QEMU has their own functions to process this data.
This series turn them into global functions, moving them into domain
conf methods, to make them available for other drivers. The only source
that LXC does not support is agent which is a specific source from QEMU.
Julio Faracco (2):
qemu: Converting DHCP and ARP functions to domain conf
lxc: Add support to lxcDomainInterfaceAddresses() function
src/conf/domain_conf.c | 134 ++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 2 +
src/libvirt_private.syms | 2 +
src/lxc/lxc_driver.c | 44 +++++++++++++
src/qemu/qemu_driver.c | 137 +--------------------------------------
5 files changed, 184 insertions(+), 135 deletions(-)
--
2.20.1
4 years, 10 months
[libvirt] [PATCH] nodedev: use autofree for more local variables
by Jonathon Jongsma
Simplify function logic by using g_autofree to free local variables so
that we can remove some goto statements that are used for cleanup.
Introduce a g_autoptr cleanup function for virNodeDeviceDef.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/conf/node_device_conf.h | 2 ++
src/node_device/node_device_driver.c | 47 +++++++++++-----------------
2 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index bf7939fbb3..4ff616ee90 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -344,6 +344,8 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
void
virNodeDeviceDefFree(virNodeDeviceDefPtr def);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNodeDeviceDef, virNodeDeviceDefFree);
+
void
virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps);
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index b630be4399..fda77ede24 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -106,10 +106,9 @@ int nodeConnectIsAlive(virConnectPtr conn G_GNUC_UNUSED)
static int
nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def)
{
- char *driver_link = NULL;
- char *devpath = NULL;
+ g_autofree char *driver_link = NULL;
+ g_autofree char *devpath = NULL;
char *p;
- int ret = -1;
VIR_FREE(def->driver);
@@ -117,26 +116,20 @@ nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def)
/* Some devices don't have an explicit driver, so just return
without a name */
- if (access(driver_link, R_OK) < 0) {
- ret = 0;
- goto cleanup;
- }
+ if (access(driver_link, R_OK) < 0)
+ return 0;
if (virFileResolveLink(driver_link, &devpath) < 0) {
virReportSystemError(errno,
_("cannot resolve driver link %s"), driver_link);
- goto cleanup;
+ return -1;
}
p = strrchr(devpath, '/');
if (p)
def->driver = g_strdup(p + 1);
- ret = 0;
- cleanup:
- VIR_FREE(driver_link);
- VIR_FREE(devpath);
- return ret;
+ return 0;
}
#else
/* XXX: Implement me for non-linux */
@@ -468,8 +461,9 @@ nodeDeviceCreateXML(virConnectPtr conn,
const char *xmlDesc,
unsigned int flags)
{
- virNodeDeviceDefPtr def = NULL;
- char *wwnn = NULL, *wwpn = NULL;
+ g_autoptr(virNodeDeviceDef) def = NULL;
+ g_autofree char *wwnn = NULL;
+ g_autofree char *wwpn = NULL;
int parent_host = -1;
virNodeDevicePtr device = NULL;
const char *virt_type = NULL;
@@ -478,19 +472,19 @@ nodeDeviceCreateXML(virConnectPtr conn,
virt_type = virConnectGetType(conn);
if (!(def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, virt_type)))
- goto cleanup;
+ return NULL;
if (virNodeDeviceCreateXMLEnsureACL(conn, def) < 0)
- goto cleanup;
+ return NULL;
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
- goto cleanup;
+ return NULL;
if ((parent_host = virNodeDeviceObjListGetParentHost(driver->devs, def)) < 0)
- goto cleanup;
+ return NULL;
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_CREATE) < 0)
- goto cleanup;
+ return NULL;
device = nodeDeviceFindNewDevice(conn, wwnn, wwpn);
/* We don't check the return value, because one way or another,
@@ -501,10 +495,7 @@ nodeDeviceCreateXML(virConnectPtr conn,
_("no node device for '%s' with matching "
"wwnn '%s' and wwpn '%s'"),
def->name, wwnn, wwpn);
- cleanup:
- virNodeDeviceDefFree(def);
- VIR_FREE(wwnn);
- VIR_FREE(wwpn);
+
return device;
}
@@ -515,8 +506,9 @@ nodeDeviceDestroy(virNodeDevicePtr device)
int ret = -1;
virNodeDeviceObjPtr obj = NULL;
virNodeDeviceDefPtr def;
- char *parent = NULL;
- char *wwnn = NULL, *wwpn = NULL;
+ g_autofree char *parent = NULL;
+ g_autofree char *wwnn = NULL;
+ g_autofree char *wwpn = NULL;
unsigned int parent_host;
if (!(obj = nodeDeviceObjFindByName(device->name)))
@@ -554,9 +546,6 @@ nodeDeviceDestroy(virNodeDevicePtr device)
cleanup:
virNodeDeviceObjEndAPI(&obj);
- VIR_FREE(parent);
- VIR_FREE(wwnn);
- VIR_FREE(wwpn);
return ret;
}
--
2.21.0
4 years, 10 months
[libvirt PATCH] src: remove WITH_GNUTLS usage
by Pavel Hrdina
Since commit <60d9ad6f1e42618fce10baeb0f02c35e5ebd5b24> we require
GnuTLS so it doesn't make sense to ifdef the code.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/libvirt.c | 6 +-----
src/remote/remote_driver.c | 19 -------------------
src/rpc/virnetclient.c | 20 ++++----------------
src/rpc/virnetclient.h | 8 +-------
src/rpc/virnetsocket.c | 16 ----------------
src/rpc/virnetsocket.h | 6 +-----
src/util/virrandom.c | 36 ++----------------------------------
7 files changed, 9 insertions(+), 102 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index f1ffc97261..86bb6551ed 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -45,9 +45,7 @@
#include "viralloc.h"
#include "configmake.h"
#include "virconf.h"
-#if WITH_GNUTLS
-# include "rpc/virnettlscontext.h"
-#endif
+#include "rpc/virnettlscontext.h"
#include "vircommand.h"
#include "virfile.h"
#include "virrandom.h"
@@ -233,9 +231,7 @@ virGlobalInit(void)
virLogSetFromEnv();
-#ifdef WITH_GNUTLS
virNetTLSInit();
-#endif
#if WITH_CURL
curl_global_init(CURL_GLOBAL_DEFAULT);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 66472a6cc1..f6e725dcbf 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -124,9 +124,7 @@ struct private_data {
int counter; /* Serial number for RPC */
-#ifdef WITH_GNUTLS
virNetTLSContextPtr tls;
-#endif
int is_secure; /* Secure if TLS or SASL or UNIX sockets */
char *type; /* Cached return from remoteType. */
@@ -1132,7 +1130,6 @@ doRemoteOpen(virConnectPtr conn,
virConfGetValueString(conf, "tls_priority", &tls_priority) < 0)
goto failed;
-#ifdef WITH_GNUTLS
priv->tls = virNetTLSContextNewClientPath(pkipath,
geteuid() != 0 ? true : false,
tls_priority,
@@ -1141,27 +1138,17 @@ doRemoteOpen(virConnectPtr conn,
goto failed;
priv->is_secure = 1;
G_GNUC_FALLTHROUGH;
-#else
- (void)tls_priority;
- (void)sanity;
- (void)verify;
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("GNUTLS support not available in this build"));
- goto failed;
-#endif
case REMOTE_DRIVER_TRANSPORT_TCP:
priv->client = virNetClientNewTCP(priv->hostname, port, AF_UNSPEC);
if (!priv->client)
goto failed;
-#ifdef WITH_GNUTLS
if (priv->tls) {
VIR_DEBUG("Starting TLS session");
if (virNetClientSetTLSSession(priv->client, priv->tls) < 0)
goto failed;
}
-#endif
break;
@@ -1388,10 +1375,8 @@ doRemoteOpen(virConnectPtr conn,
priv->client = NULL;
virObjectUnref(priv->closeCallback);
priv->closeCallback = NULL;
-#ifdef WITH_GNUTLS
virObjectUnref(priv->tls);
priv->tls = NULL;
-#endif
VIR_FREE(priv->hostname);
return VIR_DRV_OPEN_ERROR;
@@ -1533,10 +1518,8 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv)
(xdrproc_t) xdr_void, (char *) NULL) == -1)
ret = -1;
-#ifdef WITH_GNUTLS
virObjectUnref(priv->tls);
priv->tls = NULL;
-#endif
virNetClientSetCloseCallback(priv->client,
NULL,
@@ -4271,7 +4254,6 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
/* saslcb is now owned by sasl */
saslcb = NULL;
-# ifdef WITH_GNUTLS
/* Initialize some connection props we care about */
if (priv->tls) {
if ((ssf = virNetClientGetTLSKeySize(priv->client)) < 0)
@@ -4283,7 +4265,6 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
if (virNetSASLSessionExtKeySize(sasl, ssf) < 0)
goto cleanup;
}
-# endif
/* If we've got a secure channel (TLS or UNIX sock), we don't care about SSF */
/* If we're not secure, then forbid any anonymous or trivially crackable auth */
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 50489b754c..000b937cdd 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -70,9 +70,7 @@ struct _virNetClient {
virNetSocketPtr sock;
bool asyncIO;
-#if WITH_GNUTLS
virNetTLSSessionPtr tls;
-#endif
char *hostname;
virNetClientProgramPtr *programs;
@@ -708,9 +706,7 @@ void virNetClientDispose(void *obj)
if (client->sock)
virNetSocketRemoveIOCallback(client->sock);
virObjectUnref(client->sock);
-#if WITH_GNUTLS
virObjectUnref(client->tls);
-#endif
#if WITH_SASL
virObjectUnref(client->sasl);
#endif
@@ -750,10 +746,8 @@ virNetClientCloseLocked(virNetClientPtr client)
virObjectUnref(client->sock);
client->sock = NULL;
-#if WITH_GNUTLS
virObjectUnref(client->tls);
client->tls = NULL;
-#endif
#if WITH_SASL
virObjectUnref(client->sasl);
client->sasl = NULL;
@@ -837,7 +831,6 @@ void virNetClientSetSASLSession(virNetClientPtr client,
#endif
-#if WITH_GNUTLS
int virNetClientSetTLSSession(virNetClientPtr client,
virNetTLSContextPtr tls)
{
@@ -848,12 +841,12 @@ int virNetClientSetTLSSession(virNetClientPtr client,
sigset_t oldmask, blockedsigs;
sigemptyset(&blockedsigs);
-# ifdef SIGWINCH
+#ifdef SIGWINCH
sigaddset(&blockedsigs, SIGWINCH);
-# endif
-# ifdef SIGCHLD
+#endif
+#ifdef SIGCHLD
sigaddset(&blockedsigs, SIGCHLD);
-# endif
+#endif
sigaddset(&blockedsigs, SIGPIPE);
virObjectLock(client);
@@ -940,16 +933,13 @@ int virNetClientSetTLSSession(virNetClientPtr client,
virObjectUnlock(client);
return -1;
}
-#endif
bool virNetClientIsEncrypted(virNetClientPtr client)
{
bool ret = false;
virObjectLock(client);
-#if WITH_GNUTLS
if (client->tls)
ret = true;
-#endif
#if WITH_SASL
if (client->sasl)
ret = true;
@@ -1041,7 +1031,6 @@ const char *virNetClientRemoteAddrStringSASL(virNetClientPtr client)
return virNetSocketRemoteAddrStringSASL(client->sock);
}
-#if WITH_GNUTLS
int virNetClientGetTLSKeySize(virNetClientPtr client)
{
int ret = 0;
@@ -1051,7 +1040,6 @@ int virNetClientGetTLSKeySize(virNetClientPtr client)
virObjectUnlock(client);
return ret;
}
-#endif
static int
virNetClientCallDispatchReply(virNetClientPtr client)
diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h
index 07b399c1a9..778910b575 100644
--- a/src/rpc/virnetclient.h
+++ b/src/rpc/virnetclient.h
@@ -20,9 +20,7 @@
#pragma once
-#ifdef WITH_GNUTLS
-# include "virnettlscontext.h"
-#endif
+#include "virnettlscontext.h"
#include "virnetmessage.h"
#ifdef WITH_SASL
# include "virnetsaslcontext.h"
@@ -120,10 +118,8 @@ void virNetClientSetSASLSession(virNetClientPtr client,
virNetSASLSessionPtr sasl);
#endif
-#ifdef WITH_GNUTLS
int virNetClientSetTLSSession(virNetClientPtr client,
virNetTLSContextPtr tls);
-#endif
bool virNetClientIsEncrypted(virNetClientPtr client);
bool virNetClientIsOpen(virNetClientPtr client);
@@ -131,9 +127,7 @@ bool virNetClientIsOpen(virNetClientPtr client);
const char *virNetClientLocalAddrStringSASL(virNetClientPtr client);
const char *virNetClientRemoteAddrStringSASL(virNetClientPtr client);
-#ifdef WITH_GNUTLS
int virNetClientGetTLSKeySize(virNetClientPtr client);
-#endif
void virNetClientClose(virNetClientPtr client);
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 973827ebde..23384e5250 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -93,9 +93,7 @@ struct _virNetSocket {
char *remoteAddrStrSASL;
char *remoteAddrStrURI;
-#if WITH_GNUTLS
virNetTLSSessionPtr tlsSession;
-#endif
#if WITH_SASL
virNetSASLSessionPtr saslSession;
@@ -1288,13 +1286,11 @@ virJSONValuePtr virNetSocketPreExecRestart(virNetSocketPtr sock)
goto error;
}
#endif
-#if WITH_GNUTLS
if (sock->tlsSession) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Unable to save socket state when TLS session is active"));
goto error;
}
-#endif
if (!(object = virJSONValueNewObject()))
goto error;
@@ -1358,12 +1354,10 @@ void virNetSocketDispose(void *obj)
unlink(sock->localAddr.data.un.sun_path);
#endif
-#if WITH_GNUTLS
/* Make sure it can't send any more I/O during shutdown */
if (sock->tlsSession)
virNetTLSSessionSetIOCallbacks(sock->tlsSession, NULL, NULL, NULL);
virObjectUnref(sock->tlsSession);
-#endif
#if WITH_SASL
virObjectUnref(sock->saslSession);
#endif
@@ -1660,7 +1654,6 @@ const char *virNetSocketRemoteAddrStringURI(virNetSocketPtr sock)
return sock->remoteAddrStrURI;
}
-#if WITH_GNUTLS
static ssize_t virNetSocketTLSSessionWrite(const char *buf,
size_t len,
void *opaque)
@@ -1691,7 +1684,6 @@ void virNetSocketSetTLSSession(virNetSocketPtr sock,
sock);
virObjectUnlock(sock);
}
-#endif
#if WITH_SASL
void virNetSocketSetSASLSession(virNetSocketPtr sock,
@@ -1789,17 +1781,13 @@ static ssize_t virNetSocketReadWire(virNetSocketPtr sock, char *buf, size_t len)
#endif
reread:
-#if WITH_GNUTLS
if (sock->tlsSession &&
virNetTLSSessionGetHandshakeStatus(sock->tlsSession) ==
VIR_NET_TLS_HANDSHAKE_COMPLETE) {
ret = virNetTLSSessionRead(sock->tlsSession, buf, len);
} else {
-#endif
ret = read(sock->fd, buf, len);
-#if WITH_GNUTLS
}
-#endif
if ((ret < 0) && (errno == EINTR))
goto reread;
@@ -1862,17 +1850,13 @@ static ssize_t virNetSocketWriteWire(virNetSocketPtr sock, const char *buf, size
#endif
rewrite:
-#if WITH_GNUTLS
if (sock->tlsSession &&
virNetTLSSessionGetHandshakeStatus(sock->tlsSession) ==
VIR_NET_TLS_HANDSHAKE_COMPLETE) {
ret = virNetTLSSessionWrite(sock->tlsSession, buf, len);
} else {
-#endif
ret = write(sock->fd, buf, len);
-#if WITH_GNUTLS
}
-#endif
if (ret < 0) {
if (errno == EINTR)
diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h
index 8d075464cb..f2b74f3ccb 100644
--- a/src/rpc/virnetsocket.h
+++ b/src/rpc/virnetsocket.h
@@ -23,9 +23,7 @@
#include "virsocketaddr.h"
#include "vircommand.h"
-#ifdef WITH_GNUTLS
-# include "virnettlscontext.h"
-#endif
+#include "virnettlscontext.h"
#include "virobject.h"
#ifdef WITH_SASL
# include "virnetsaslcontext.h"
@@ -152,10 +150,8 @@ ssize_t virNetSocketWrite(virNetSocketPtr sock, const char *buf, size_t len);
int virNetSocketSendFD(virNetSocketPtr sock, int fd);
int virNetSocketRecvFD(virNetSocketPtr sock, int *fd);
-#ifdef WITH_GNUTLS
void virNetSocketSetTLSSession(virNetSocketPtr sock,
virNetTLSSessionPtr sess);
-#endif
#ifdef WITH_SASL
void virNetSocketSetSASLSession(virNetSocketPtr sock,
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 39ac36a76e..eae7f3db3c 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -24,10 +24,8 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
-#ifdef WITH_GNUTLS
-# include <gnutls/gnutls.h>
-# include <gnutls/crypto.h>
-#endif
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
#include "virrandom.h"
#include "virthread.h"
@@ -116,7 +114,6 @@ int
virRandomBytes(unsigned char *buf,
size_t buflen)
{
-#if WITH_GNUTLS
int rv;
/* Generate the byte stream using gnutls_rnd() if possible */
@@ -127,35 +124,6 @@ virRandomBytes(unsigned char *buf,
return -1;
}
-#else /* !WITH_GNUTLS */
-
- int fd;
-
- if ((fd = open(RANDOM_SOURCE, O_RDONLY)) < 0) {
- virReportSystemError(errno,
- _("unable to open %s"),
- RANDOM_SOURCE);
- return -1;
- }
-
- while (buflen > 0) {
- ssize_t n;
-
- if ((n = saferead(fd, buf, buflen)) <= 0) {
- virReportSystemError(errno,
- _("unable to read from %s"),
- RANDOM_SOURCE);
- VIR_FORCE_CLOSE(fd);
- return n < 0 ? -errno : -ENODATA;
- }
-
- buf += n;
- buflen -= n;
- }
-
- VIR_FORCE_CLOSE(fd);
-#endif /* !WITH_GNUTLS */
-
return 0;
}
--
2.24.1
4 years, 10 months
[libvirt] [PATCH v2 0/2] fix segfaults on qemuhotplugtest
by Christian Ehrhardt
After debugging for a while and eventually finding the root cause we
discussed this on IRC today:
<cpaelzer> danpb: BTW the test crash in 6.0 that I'm tracing (asked yesterday)
is virHostdevManagerInitialize failing
<cpaelzer> the test goes on with mgr set to 0x0 and that is the segfault
later on
<cpaelzer> virSetError was helpful as "Could not initialize HostdevManager
operation failed: Failed to create state dir
'/sbuild-nonexistent/.cache/libvirt/hostdevmgr'" sounds like a
very testbed-specific issue that I might be able to solve when
invoking the tests
<danpb> hmm, seems like we're missing a mock for mkdir()
<danpb> i guess we should mock virFileMakePath in this case
This series got v6.0.0 building in Ubuntu, so I thought it is worth to
submit it for review.
Updates in v2:
- improve indent of virGetLastErrorMessage
- drop superfluous curly brackets
- added the Reviewed-by of Daniel Henrique Barboza (Thanks !)
Christian Ehrhardt (2):
test: let qemuhotplugtest report details of init fails
test: qemuhotplugtest mock virFileMakePath
tests/qemuhotplugmock.c | 17 +++++++++++++++++
tests/qemuhotplugtest.c | 5 +++++
2 files changed, 22 insertions(+)
--
2.25.0
4 years, 10 months
[PATCH] libxl: initialize shutdown inhibit callback
by Marek Marczykowski-Górecki
The libxl driver already tries to call shutdown inhibit callback in the
right places, but only if it's set. That last part was missing,
resulting in premature shutdown when running libvirtd
--timeout=...
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/libxl/libxl_driver.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index bece313ec5..d45e42c100 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -648,8 +648,8 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
static int
libxlStateInitialize(bool privileged,
- virStateInhibitCallback callback G_GNUC_UNUSED,
- void *opaque G_GNUC_UNUSED)
+ virStateInhibitCallback callback,
+ void *opaque)
{
libxlDriverConfigPtr cfg;
char *driverConf = NULL;
@@ -670,6 +670,9 @@ libxlStateInitialize(bool privileged,
return VIR_DRV_STATE_INIT_ERROR;
}
+ libxl_driver->inhibitCallback = callback;
+ libxl_driver->inhibitOpaque = opaque;
+
/* Allocate bitmap for vnc port reservation */
if (!(libxl_driver->reservedGraphicsPorts =
virPortAllocatorRangeNew(_("VNC"),
--
2.21.0
4 years, 10 months