Accepting request 926063 from Virtualization

- supportconfig: Use systemctl command 'is-active' instead of
  'is-enabled' when checking if libvirtd is active

- Drop 'Requires: libvirt-daemon-driver-lxc' from the main libvirt
  package
  jsc#SLE-22296

- qemu: Do not report eof when processing monitor IO
  2703b0b5-qemu-dont-report-eof.patch
  bsc#1190917

OBS-URL: https://build.opensuse.org/request/show/926063
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=341
This commit is contained in:
Dominique Leuenberger 2021-10-19 21:03:34 +00:00 committed by Git OBS Bridge
commit ea2febc872
4 changed files with 145 additions and 4 deletions

View File

@ -0,0 +1,123 @@
commit 2703b0b5bf2751d523a4d8d61901e473c92ba198
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Oct 5 22:23:51 2021 -0600
qemu: Do not report eof when processing monitor IO
There have been countless reports from users concerned about the following
error reported by libvirtd when qemu domains are shutdown
internal error: End of file from qemu monitor
While the error is harmless, users often mistaken it for real problem with
their deployments. EOF from the monitor can't be entirely ignored since
other threads may be using the monitor and must be able to detect the EOF
condition.
One potential fix is to delay reporting EOF until the monitor is used
after EOF is detected. This patch adds a 'goteof' member to the
qemuMonitor structure, which is set when EOF is detected on the monitor
socket. If another thread later tries to send data on the monitor, the
EOF error is reported.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-7.8.0/src/qemu/qemu_monitor.c
===================================================================
--- libvirt-7.8.0.orig/src/qemu/qemu_monitor.c
+++ libvirt-7.8.0/src/qemu/qemu_monitor.c
@@ -98,6 +98,9 @@ struct _qemuMonitor {
* the next monitor msg */
virError lastError;
+ /* Set to true when EOF is detected on the monitor */
+ bool goteof;
+
int nextSerial;
bool waitGreeting;
@@ -526,7 +529,6 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNU
{
qemuMonitor *mon = opaque;
bool error = false;
- bool eof = false;
bool hangup = false;
virObjectRef(mon);
@@ -544,7 +546,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNU
if (mon->lastError.code != VIR_ERR_OK) {
if (cond & (G_IO_HUP | G_IO_ERR))
- eof = true;
+ mon->goteof = true;
error = true;
} else {
if (cond & G_IO_OUT) {
@@ -562,7 +564,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNU
if (errno == ECONNRESET)
hangup = true;
} else if (got == 0) {
- eof = true;
+ mon->goteof = true;
} else {
/* Ignore hangup/error cond if we read some data, to
* give time for that data to be consumed */
@@ -575,22 +577,19 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNU
if (cond & G_IO_HUP) {
hangup = true;
- if (!error) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("End of file from qemu monitor"));
- eof = true;
- }
+ if (!error)
+ mon->goteof = true;
}
- if (!error && !eof &&
+ if (!error && !mon->goteof &&
cond & G_IO_ERR) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Invalid file descriptor while waiting for monitor"));
- eof = true;
+ mon->goteof = true;
}
}
- if (error || eof) {
+ if (error || mon->goteof) {
if (hangup && mon->logFunc != NULL) {
/* Check if an error message from qemu is available and if so, use
* it to overwrite the actual message. It's done only in early
@@ -609,7 +608,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNU
/* Already have an error, so clear any new error */
virResetLastError();
} else {
- if (virGetLastErrorCode() == VIR_ERR_OK)
+ if (virGetLastErrorCode() == VIR_ERR_OK && !mon->goteof)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Error while processing monitor IO"));
virCopyLastError(&mon->lastError);
@@ -630,7 +629,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNU
/* We have to unlock to avoid deadlock against command thread,
* but is this safe ? I think it is, because the callback
* will try to acquire the virDomainObj *mutex next */
- if (eof) {
+ if (mon->goteof) {
qemuMonitorEofNotifyCallback eofNotify = mon->cb->eofNotify;
virDomainObj *vm = mon->vm;
@@ -949,6 +948,11 @@ qemuMonitorSend(qemuMonitor *mon,
virSetError(&mon->lastError);
return -1;
}
+ if (mon->goteof) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("End of file from qemu monitor"));
+ return -1;
+ }
mon->msg = msg;
qemuMonitorUpdateWatch(mon);

View File

@ -71,7 +71,7 @@ if ! rpm_verify libvirt-daemon; then
exit 0
fi
if systemctl is-enabled libvirtd.service 2>&1 > /dev/null; then
if systemctl is-active --quiet libvirtd.service; then
plugin_command "virsh version"
plugin_command "virsh capabilities"
plugin_command "virsh domcapabilities"

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Mon Oct 18 15:44:15 UTC 2021 - James Fehlig <jfehlig@suse.com>
- supportconfig: Use systemctl command 'is-active' instead of
'is-enabled' when checking if libvirtd is active
-------------------------------------------------------------------
Fri Oct 15 21:38:21 UTC 2021 - James Fehlig <jfehlig@suse.com>
- Drop 'Requires: libvirt-daemon-driver-lxc' from the main libvirt
package
jsc#SLE-22296
-------------------------------------------------------------------
Fri Oct 15 17:52:52 UTC 2021 - James Fehlig <jfehlig@suse.com>
- qemu: Do not report eof when processing monitor IO
2703b0b5-qemu-dont-report-eof.patch
bsc#1190917
-------------------------------------------------------------------
Fri Oct 8 20:47:47 UTC 2021 - James Fehlig <jfehlig@suse.com>

View File

@ -148,9 +148,6 @@ Requires: %{name}-daemon-config-nwfilter = %{version}-%{release}
%if %{with_libxl}
Requires: %{name}-daemon-driver-libxl = %{version}-%{release}
%endif
%if %{with_lxc}
Requires: %{name}-daemon-driver-lxc = %{version}-%{release}
%endif
%if %{with_qemu}
Requires: %{name}-daemon-driver-qemu = %{version}-%{release}
%endif
@ -287,6 +284,7 @@ Source100: %{name}-rpmlintrc
# Upstream patches
Patch0: 3f9c1a4b-fix-host-validate-sev.patch
Patch1: 1b9ce05c-lxc-fix-cgroupV1.patch
Patch2: 2703b0b5-qemu-dont-report-eof.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch