Accepting request 952832 from Virtualization

More bug fixes for the Factory libvirt package.

- qemu: fix inactive snapshot revert
  76deb656-qemu-fix-snapshot-revert.patch
  boo#1195690

- libxl: Mark auto-allocated graphics ports to used on reconnect
  e0241f33-libxl-mark-allocated-graphics-ports.patch
- libxl: Release all auto-allocated graphics ports
  18ec405a-libxl-release-graphics-ports.patch
  bsc#1191668

OBS-URL: https://build.opensuse.org/request/show/952832
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=348
This commit is contained in:
Dominique Leuenberger 2022-02-10 22:11:35 +00:00 committed by Git OBS Bridge
commit 4f881b068d
8 changed files with 185 additions and 7 deletions

View File

@ -23,7 +23,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-8.0.0.orig/src/libxl/libxl_driver.c
+++ libvirt-8.0.0/src/libxl/libxl_driver.c
@@ -5241,6 +5241,95 @@ libxlDomainMemoryStats(virDomainPtr dom,
@@ -5264,6 +5264,95 @@ libxlDomainMemoryStats(virDomainPtr dom,
#undef LIBXL_SET_MEMSTAT
@ -119,7 +119,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
static int
libxlDomainGetJobInfo(virDomainPtr dom,
virDomainJobInfoPtr info)
@@ -6554,6 +6643,7 @@ static virHypervisorDriver libxlHypervis
@@ -6577,6 +6666,7 @@ static virHypervisorDriver libxlHypervis
.domainGetNumaParameters = libxlDomainGetNumaParameters, /* 1.1.1 */
.nodeGetFreeMemory = libxlNodeGetFreeMemory, /* 0.9.0 */
.nodeGetCellsFreeMemory = libxlNodeGetCellsFreeMemory, /* 1.1.1 */

View File

@ -0,0 +1,69 @@
commit 18ec405a36e24c86abe1104699c0bffdc91d5169
Author: Jim Fehlig <jfehlig@suse.com>
Date: Mon Feb 7 13:57:07 2022 -0700
libxl: Release auto-allocated spice ports
While VNC ports auto-allocated by the libxl driver are released in
libxlDomainCleanup, spice ports are overlooked. Rework the existing
logic to release any auto-allocated graphics ports, not just the VNC
port of the first graphics device.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Index: libvirt-8.0.0/src/libxl/libxl_domain.c
===================================================================
--- libvirt-8.0.0.orig/src/libxl/libxl_domain.c
+++ libvirt-8.0.0/src/libxl/libxl_domain.c
@@ -906,10 +906,10 @@ libxlDomainCleanup(libxlDriverPrivate *d
{
libxlDomainObjPrivate *priv = vm->privateData;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
- int vnc_port;
char *file;
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
+ size_t i;
VIR_DEBUG("Cleaning up domain with id '%d' and name '%s'",
vm->def->id, vm->def->name);
@@ -944,13 +944,31 @@ libxlDomainCleanup(libxlDriverPrivate *d
if (!!g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
driver->inhibitCallback(false, driver->inhibitOpaque);
- if ((vm->def->ngraphics == 1) &&
- vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- vm->def->graphics[0]->data.vnc.autoport) {
- vnc_port = vm->def->graphics[0]->data.vnc.port;
- if (vnc_port >= LIBXL_VNC_PORT_MIN) {
- if (virPortAllocatorRelease(vnc_port) < 0)
- VIR_DEBUG("Could not mark port %d as unused", vnc_port);
+ /* Release auto-allocated graphics ports */
+ for (i = 0; i < vm->def->ngraphics; i++) {
+ virDomainGraphicsDef *graphics = vm->def->graphics[i];
+ int gport = -1;
+
+ switch (graphics->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ if (graphics->data.vnc.autoport &&
+ graphics->data.vnc.port >= LIBXL_VNC_PORT_MIN)
+ gport = graphics->data.vnc.port;
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ if (graphics->data.spice.autoport)
+ gport = graphics->data.spice.port;
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ break;
+ }
+ if (gport != -1) {
+ if (virPortAllocatorRelease(gport) < 0)
+ VIR_DEBUG("Could not mark port %d as unused", gport);
}
}

View File

@ -0,0 +1,30 @@
commit 76deb656132bb8817ddae4b7f417930c4db824c9
Author: Ján Tomko <jtomko@redhat.com>
Date: Thu Jan 20 14:53:33 2022 +0100
qemu: fix inactive snapshot revert
The commit splitting out the qemuSnapshotRevertInactive function
dropped the 'defined = true' line by accident and instead
returned -1, leaving the user with a cryptic error:
error: An error occurred, but the cause is unknown
https://bugzilla.redhat.com/show_bug.cgi?id=2039136
https://gitlab.com/libvirt/libvirt/-/issues/266
Fixes: 85e4a13c3f19078fb6af5ffb4a80022c142cbc7e
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Index: libvirt-8.0.0/src/qemu/qemu_snapshot.c
===================================================================
--- libvirt-8.0.0.orig/src/qemu/qemu_snapshot.c
+++ libvirt-8.0.0/src/qemu/qemu_snapshot.c
@@ -2193,7 +2193,7 @@ qemuSnapshotRevertInactive(virDomainObj
if (*inactiveConfig) {
virDomainObjAssignDef(vm, inactiveConfig, false, NULL);
- return -1;
+ defined = true;
}
if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |

View File

@ -0,0 +1,60 @@
commit e0241f334d4e8da2e36cda48c225d5a6edcc3a50
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Feb 1 17:03:11 2022 -0700
libxl: Set auto-allocated graphics ports to used on reconnect
The libxl driver reconnects to all running VMs when libvirtd is restarted,
but it failed to mark auto-allocated graphics ports as set in the port
allocator. If many VMs are running that use port auto-allocation and
libvirtd is restarted, the port allocator is likely to hand out a port
already in use when a new VM is created that uses auto-allocation. VM
creation will fail due to the port clash.
When reconnecting to running VMs after a libvirtd restart, let the port
allocator know about previously allocated ports.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Index: libvirt-8.0.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-8.0.0.orig/src/libxl/libxl_driver.c
+++ libvirt-8.0.0/src/libxl/libxl_driver.c
@@ -393,6 +393,7 @@ libxlReconnectDomain(virDomainObj *vm,
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
int ret = -1;
+ size_t i;
hostdev_flags |= VIR_HOSTDEV_SP_USB;
@@ -447,6 +448,28 @@ libxlReconnectDomain(virDomainObj *vm,
libxlReconnectNotifyNets(vm->def);
+ /* Set any auto-allocated graphics ports to used */
+ for (i = 0; i < vm->def->ngraphics; i++) {
+ virDomainGraphicsDef *graphics = vm->def->graphics[i];
+
+ switch (graphics->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ if (graphics->data.vnc.autoport)
+ virPortAllocatorSetUsed(graphics->data.vnc.port);
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ if (graphics->data.spice.autoport)
+ virPortAllocatorSetUsed(graphics->data.spice.port);
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ break;
+ }
+ }
+
if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
VIR_WARN("Cannot update XML for running Xen guest %s", vm->def->name);

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Feb 8 22:25:03 UTC 2022 - James Fehlig <jfehlig@suse.com>
- qemu: fix inactive snapshot revert
76deb656-qemu-fix-snapshot-revert.patch
boo#1195690
-------------------------------------------------------------------
Mon Feb 7 21:32:20 UTC 2022 - James Fehlig <jfehlig@suse.com>
- libxl: Mark auto-allocated graphics ports to used on reconnect
e0241f33-libxl-mark-allocated-graphics-ports.patch
- libxl: Release all auto-allocated graphics ports
18ec405a-libxl-release-graphics-ports.patch
bsc#1191668
-------------------------------------------------------------------
Wed Jan 26 19:13:24 UTC 2022 - James Fehlig <jfehlig@suse.com>

View File

@ -306,6 +306,9 @@ Patch1: 16172741-libvirt-guests-manpage.patch
Patch2: 8eb44616-remove-sysconfig-files.patch
Patch3: 31e937fb-libxl-save-lock-indicator.patch
Patch4: 105dace2-revert-virProcessGetStatInfo.patch
Patch5: e0241f33-libxl-mark-allocated-graphics-ports.patch
Patch6: 18ec405a-libxl-release-graphics-ports.patch
Patch7: 76deb656-qemu-fix-snapshot-revert.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch

View File

@ -12,7 +12,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-8.0.0.orig/src/libxl/libxl_driver.c
+++ libvirt-8.0.0/src/libxl/libxl_driver.c
@@ -1338,6 +1338,63 @@ libxlDomainReboot(virDomainPtr dom, unsi
@@ -1361,6 +1361,63 @@ libxlDomainReboot(virDomainPtr dom, unsi
}
static int
@ -76,7 +76,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
libxlDomainDestroyFlags(virDomainPtr dom,
unsigned int flags)
{
@@ -6432,6 +6489,7 @@ static virHypervisorDriver libxlHypervis
@@ -6455,6 +6512,7 @@ static virHypervisorDriver libxlHypervis
.domainShutdown = libxlDomainShutdown, /* 0.9.0 */
.domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
.domainReboot = libxlDomainReboot, /* 0.9.0 */

View File

@ -75,7 +75,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-8.0.0.orig/src/libxl/libxl_driver.c
+++ libvirt-8.0.0/src/libxl/libxl_driver.c
@@ -5973,6 +5973,9 @@ libxlDomainMigratePerform3Params(virDoma
@@ -5996,6 +5996,9 @@ libxlDomainMigratePerform3Params(virDoma
const char *dname = NULL;
const char *uri = NULL;
int ret = -1;
@ -85,7 +85,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
@@ -5989,6 +5992,15 @@ libxlDomainMigratePerform3Params(virDoma
@@ -6012,6 +6015,15 @@ libxlDomainMigratePerform3Params(virDoma
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_DEST_NAME,
&dname) < 0 ||
@ -101,7 +101,7 @@ Index: libvirt-8.0.0/src/libxl/libxl_driver.c
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_URI,
&uri) < 0)
@@ -6003,11 +6015,11 @@ libxlDomainMigratePerform3Params(virDoma
@@ -6026,11 +6038,11 @@ libxlDomainMigratePerform3Params(virDoma
if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) {
if (libxlDomainMigrationSrcPerformP2P(driver, vm, dom->conn, dom_xml,