forked from pool/libvirt
- spec: Enable the same hypervisor drivers for openSUSE and SLE jsc#SLE-11772 - spec: Enable the same storage drivers for openSUSE and SLE jsc#SLE-11877 - qemu: Reprobe capabilities if the qemu modules directory changes 2ad009ea-qemu-check-modules-dir.patch boo#1175320 - Update to libvirt 6.7.0 - jsc#SLE-14253, jsc#SLE-15159 - CVE-2020-14339 - Many incremental improvements and bug fixes, see https://libvirt.org/news.html - Dropped patches: 2edd63a0-fix-virFileSetCOW-logic.patch, 82bb167f-dont-cache-devmapper-major.patch, feb8564a-handle-no-devmapper.patch, 53d9af1e-ignore-devmapper-open-errors.patch, support-managed-pci-xen-driver.patch, disable-multipath-pr-tests.patch OBS-URL: https://build.opensuse.org/request/show/831542 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=840
125 lines
5.1 KiB
Diff
125 lines
5.1 KiB
Diff
commit 2ad009eadde27491ff4248f481560953776b2a87
|
|
Author: Jim Fehlig <jfehlig@suse.com>
|
|
Date: Thu Aug 20 15:52:17 2020 -0600
|
|
|
|
qemu: Check for changes in qemu modules directory
|
|
|
|
Add a configuration option for specifying location of the qemu modules
|
|
directory, defaulting to /usr/lib64/qemu. Then use this location to
|
|
check for changes in the directory, indicating that a qemu module has
|
|
changed and capabilities need to be reprobed.
|
|
|
|
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
|
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
|
Index: libvirt-6.7.0/meson.build
|
|
===================================================================
|
|
--- libvirt-6.7.0.orig/meson.build
|
|
+++ libvirt-6.7.0/meson.build
|
|
@@ -1758,6 +1758,12 @@ if not get_option('driver_qemu').disable
|
|
if use_qemu
|
|
conf.set('WITH_QEMU', 1)
|
|
|
|
+ qemu_moddir = get_option('qemu_moddir')
|
|
+ if qemu_moddir == ''
|
|
+ qemu_moddir = '/usr' / libdir / 'qemu'
|
|
+ endif
|
|
+ conf.set_quoted('QEMU_MODDIR', qemu_moddir)
|
|
+
|
|
if host_machine.system() in ['freebsd', 'darwin']
|
|
default_qemu_user = 'root'
|
|
default_qemu_group = 'wheel'
|
|
Index: libvirt-6.7.0/meson_options.txt
|
|
===================================================================
|
|
--- libvirt-6.7.0.orig/meson_options.txt
|
|
+++ libvirt-6.7.0/meson_options.txt
|
|
@@ -60,6 +60,7 @@ option('driver_openvz', type: 'feature',
|
|
option('driver_qemu', type: 'feature', value: 'auto', description: 'QEMU/KVM driver')
|
|
option('qemu_user', type: 'string', value: '', description: 'username to run QEMU system instance as')
|
|
option('qemu_group', type: 'string', value: '', description: 'groupname to run QEMU system instance as')
|
|
+option('qemu_moddir', type: 'string', value: '', description: 'set the directory where QEMU modules are located')
|
|
option('driver_remote', type: 'feature', value: 'enabled', description: 'remote driver')
|
|
option('remote_default_mode', type: 'combo', choices: ['legacy', 'direct'], value: 'legacy', description: 'remote driver default mode')
|
|
option('driver_secrets', type: 'feature', value: 'auto', description: 'local secrets management driver')
|
|
Index: libvirt-6.7.0/src/qemu/qemu_capabilities.c
|
|
===================================================================
|
|
--- libvirt-6.7.0.orig/src/qemu/qemu_capabilities.c
|
|
+++ libvirt-6.7.0/src/qemu/qemu_capabilities.c
|
|
@@ -677,6 +677,7 @@ struct _virQEMUCaps {
|
|
char *binary;
|
|
time_t ctime;
|
|
time_t libvirtCtime;
|
|
+ time_t modDirMtime;
|
|
bool invalidation;
|
|
|
|
virBitmapPtr flags;
|
|
@@ -4194,6 +4195,7 @@ virQEMUCapsParseSEVInfo(virQEMUCapsPtr q
|
|
* <qemuCaps>
|
|
* <emulator>/some/path</emulator>
|
|
* <qemuctime>234235253</qemuctime>
|
|
+ * <qemumoddirmtime>234235253</qemumoddirmtime>
|
|
* <selfctime>234235253</selfctime>
|
|
* <selfvers>1002016</selfvers>
|
|
* <flag name='foo'/>
|
|
@@ -4283,6 +4285,9 @@ virQEMUCapsLoadCache(virArch hostArch,
|
|
}
|
|
qemuCaps->ctime = (time_t)l;
|
|
|
|
+ if (virXPathLongLong("string(./qemumoddirmtime)", ctxt, &l) == 0)
|
|
+ qemuCaps->modDirMtime = (time_t)l;
|
|
+
|
|
if ((n = virXPathNodeSet("./flag", ctxt, &nodes)) < 0) {
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
_("failed to parse qemu capabilities flags"));
|
|
@@ -4615,6 +4620,10 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qe
|
|
qemuCaps->binary);
|
|
virBufferAsprintf(&buf, "<qemuctime>%llu</qemuctime>\n",
|
|
(long long)qemuCaps->ctime);
|
|
+ if (qemuCaps->modDirMtime > 0) {
|
|
+ virBufferAsprintf(&buf, "<qemumoddirmtime>%llu</qemumoddirmtime>\n",
|
|
+ (long long)qemuCaps->modDirMtime);
|
|
+ }
|
|
virBufferAsprintf(&buf, "<selfctime>%llu</selfctime>\n",
|
|
(long long)qemuCaps->libvirtCtime);
|
|
virBufferAsprintf(&buf, "<selfvers>%lu</selfvers>\n",
|
|
@@ -4881,6 +4890,23 @@ virQEMUCapsIsValid(void *data,
|
|
if (!qemuCaps->binary)
|
|
return true;
|
|
|
|
+ if (virFileExists(QEMU_MODDIR)) {
|
|
+ if (stat(QEMU_MODDIR, &sb) < 0) {
|
|
+ VIR_DEBUG("Failed to stat QEMU module directory '%s': %s",
|
|
+ QEMU_MODDIR,
|
|
+ g_strerror(errno));
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ if (sb.st_mtime != qemuCaps->modDirMtime) {
|
|
+ VIR_DEBUG("Outdated capabilities for '%s': QEMU modules "
|
|
+ "directory '%s' changed (%lld vs %lld)",
|
|
+ qemuCaps->binary, QEMU_MODDIR,
|
|
+ (long long)sb.st_mtime, (long long)qemuCaps->modDirMtime);
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+
|
|
if (qemuCaps->libvirtCtime != virGetSelfLastChanged() ||
|
|
qemuCaps->libvirtVersion != LIBVIR_VERSION_NUMBER) {
|
|
VIR_DEBUG("Outdated capabilities for '%s': libvirt changed "
|
|
@@ -5463,6 +5489,15 @@ virQEMUCapsNewForBinaryInternal(virArch
|
|
goto error;
|
|
}
|
|
|
|
+ if (virFileExists(QEMU_MODDIR)) {
|
|
+ if (stat(QEMU_MODDIR, &sb) < 0) {
|
|
+ virReportSystemError(errno, _("Cannot check QEMU module directory %s"),
|
|
+ QEMU_MODDIR);
|
|
+ goto error;
|
|
+ }
|
|
+ qemuCaps->modDirMtime = sb.st_mtime;
|
|
+ }
|
|
+
|
|
if (virQEMUCapsInitQMP(qemuCaps, libDir, runUid, runGid) < 0)
|
|
goto error;
|
|
|