Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56811db0e1 | |||
| dbca8efc68 | |||
| 4230864da9 | |||
| 046121a814 | |||
| e353d4686f | |||
| d9f0d1b206 | |||
| f529859a7f | |||
| cc20dcc771 | |||
| 373a3ee987 | |||
| a53e7df138 | |||
| 60e98f8638 | |||
| f6005873fe | |||
| 8be9ccc297 |
@@ -1,31 +0,0 @@
|
||||
[suppress_function]
|
||||
symbol_version_regexp = LIBVIRT_PRIVATE.*
|
||||
soname_regexp = libvirt\\.so.*
|
||||
|
||||
[suppress_function]
|
||||
symbol_version_regexp = LIBVIRT_ADMIN_PRIVATE.*
|
||||
soname_regexp = libvirt-admin\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = LIBVIRT_PRIVATE.*
|
||||
soname_regexp = libvirt\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = LIBVIRT_ADMIN_PRIVATE.*
|
||||
soname_regexp = libvirt-admin\\.so.*
|
||||
|
||||
[suppress_function]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_storage_.*\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_storage_.*\\.so.*
|
||||
|
||||
[suppress_function]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_driver_.*\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_driver_.*\\.so.*
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
libvirt-0.0.3.tar.gz
|
||||
libvirt-0.0.4.tar.gz
|
||||
libvirt-0.0.5.tar.gz
|
||||
libvirt-0.0.6.tar.gz
|
||||
libvirt-0.1.0.tar.gz
|
||||
libvirt-0.1.2.tar.gz
|
||||
libvirt-0.1.1.tar.gz
|
||||
libvirt-0.1.3.tar.gz
|
||||
libvirt-0.1.4.tar.gz
|
||||
libvirt-0.1.5.tar.gz
|
||||
libvirt-0.1.6.tar.gz
|
||||
libvirt-0.1.7.tar.gz
|
||||
libvirt-0.1.8.tar.gz
|
||||
libvirt-0.1.9.tar.gz
|
||||
libvirt-0.1.10.tar.gz
|
||||
libvirt-0.1.11.tar.gz
|
||||
libvirt-0.2.0.tar.gz
|
||||
libvirt-0.2.1.tar.gz
|
||||
libvirt-0.2.2.tar.gz
|
||||
@@ -1,5 +0,0 @@
|
||||
.build*.log
|
||||
*.rpm
|
||||
i686
|
||||
x86_64
|
||||
libvirt-*.tar.xz
|
||||
@@ -1,36 +0,0 @@
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 9 Mar 2020 16:40:57 +0100
|
||||
Subject: [PATCH] virDomainDiskTranslateSourcePool: Check for disk type
|
||||
correctly
|
||||
|
||||
When rewriting the virDomainDiskTranslateSourcePool() function in
|
||||
v6.1.0-rc1~184 a typo was introduced. Previously, we allowed
|
||||
startup policy only for those volumes which translated to
|
||||
VIR_STORAGE_TYPE_FILE. But starting with the referenced commit,
|
||||
the value we checked for was changed to VIR_STORAGE_VOL_FILE
|
||||
which comes from a different enum and has a different value too.
|
||||
This is wrong, because virStorageSourceGetActualType() returns a
|
||||
value from the original enum.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1811728
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit 3918dbd84e4951b43f93fbf50ef52be00274850c)
|
||||
---
|
||||
src/conf/domain_conf.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 17867eeece..fd2e8f4eb5 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -31746,7 +31746,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
|
||||
}
|
||||
|
||||
if (def->startupPolicy != 0 &&
|
||||
- virStorageSourceGetActualType(def->src) != VIR_STORAGE_VOL_FILE) {
|
||||
+ virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_FILE) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("'startupPolicy' is only valid for "
|
||||
"'file' type volume"));
|
||||
@@ -1,55 +0,0 @@
|
||||
From: Laine Stump <laine@redhat.com>
|
||||
Date: Thu, 7 May 2020 22:32:59 -0400
|
||||
Subject: [PATCH] network: make it safe to call networkSetupPrivateChains()
|
||||
multiple times
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
networkSetupPrivateChains() is currently called only once per run of
|
||||
libvirtd, so it can assume that errInitV4 and errInitV6 are empty/null
|
||||
when it is called. In preparation for potentially calling this
|
||||
function multiple times during one run, this patch moves the reset of
|
||||
errInitV[46] to the top of the function, to assure no memory is
|
||||
leaked.
|
||||
|
||||
Signed-off-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit de110f110fb917a31b9f33ad8e4b3c1d3284766a)
|
||||
---
|
||||
src/network/bridge_driver_linux.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/network/bridge_driver_linux.c b/src/network/bridge_driver_linux.c
|
||||
index 7bbde5c6a9..80bd2409e1 100644
|
||||
--- a/src/network/bridge_driver_linux.c
|
||||
+++ b/src/network/bridge_driver_linux.c
|
||||
@@ -48,6 +48,10 @@ static void networkSetupPrivateChains(void)
|
||||
VIR_DEBUG("Setting up global firewall chains");
|
||||
|
||||
createdChains = false;
|
||||
+ virFreeError(errInitV4);
|
||||
+ errInitV4 = NULL;
|
||||
+ virFreeError(errInitV6);
|
||||
+ errInitV6 = NULL;
|
||||
|
||||
rc = iptablesSetupPrivateChains(VIR_FIREWALL_LAYER_IPV4);
|
||||
if (rc < 0) {
|
||||
@@ -56,8 +60,6 @@ static void networkSetupPrivateChains(void)
|
||||
errInitV4 = virSaveLastError();
|
||||
virResetLastError();
|
||||
} else {
|
||||
- virFreeError(errInitV4);
|
||||
- errInitV4 = NULL;
|
||||
if (rc) {
|
||||
VIR_DEBUG("Created global IPv4 chains");
|
||||
createdChains = true;
|
||||
@@ -73,8 +75,6 @@ static void networkSetupPrivateChains(void)
|
||||
errInitV6 = virSaveLastError();
|
||||
virResetLastError();
|
||||
} else {
|
||||
- virFreeError(errInitV6);
|
||||
- errInitV6 = NULL;
|
||||
if (rc) {
|
||||
VIR_DEBUG("Created global IPv6 chains");
|
||||
createdChains = true;
|
||||
@@ -1,265 +0,0 @@
|
||||
From: Laine Stump <laine@redhat.com>
|
||||
Date: Thu, 7 May 2020 21:54:39 -0400
|
||||
Subject: [PATCH] network: force re-creation of iptables private chains on
|
||||
firewalld restart
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When firewalld is stopped, it removes *all* iptables rules and chains,
|
||||
including those added by libvirt. Since restarting firewalld means
|
||||
stopping and then starting it, any time it is restarted, libvirt needs
|
||||
to recreate all the private iptables chains it uses, along with all
|
||||
the rules it adds.
|
||||
|
||||
We already have code in place to call networkReloadFirewallRules() any
|
||||
time we're notified of a firewalld start, and
|
||||
networkReloadFirewallRules() will call
|
||||
networkPreReloadFirewallRules(), which calls
|
||||
networkSetupPrivateChains(); unfortunately that last call is called
|
||||
using virOnce(), meaning that it will only be called the first time
|
||||
through networkPreReloadFirewallRules() after libvirtd starts - so of
|
||||
course when firewalld is later restarted, the call to
|
||||
networkSetupPrivateChains() is skipped.
|
||||
|
||||
The neat and tidy way to fix this would be if there was a standard way
|
||||
to reset a pthread_once_t object so that the next time virOnce was
|
||||
called, it would think the function hadn't been called, and call it
|
||||
again. Unfortunately, there isn't any official way of doing that (we
|
||||
*could* just fill it with 0 and hope for the best, but that doesn't
|
||||
seem very safe.
|
||||
|
||||
So instead, this patch just adds a static variable called
|
||||
chainInitDone, which is set to true after networkSetupPrivateChains()
|
||||
is called for the first time, and then during calls to
|
||||
networkPreReloadFirewallRules(), if chainInitDone is set, we call
|
||||
networkSetupPrivateChains() directly instead of via virOnce().
|
||||
|
||||
It may seem unsafe to directly call a function that is meant to be
|
||||
called only once, but I think in this case we're safe - there's
|
||||
nothing in the function that is inherently "once only" - it doesn't
|
||||
initialize anything that can't safely be re-initialized (as long as
|
||||
two threads don't try to do it at the same time), and it only happens
|
||||
when responding to a dbus message that firewalld has been started (and
|
||||
I don't think it's possible for us to be processing two of those at
|
||||
once), and even then only if the initial call to the function has
|
||||
already been completed (so we're safe if we receive a firewalld
|
||||
restart call at a time when we haven't yet called it, or even if
|
||||
another thread is already in the process of executing it. The only
|
||||
problematic bit I can think of is if another thread is in the process
|
||||
of adding an iptable rule at the time we're executing this function,
|
||||
but 1) none of those threads will be trying to add chains, and 2) if
|
||||
there was a concurrency problem with other threads adding iptables
|
||||
rules while firewalld was being restarted, it would still be a problem
|
||||
even without this change.
|
||||
|
||||
This is yet another patch that fixes an occurrence of this error:
|
||||
|
||||
COMMAND_FAILED: '/usr/sbin/iptables -w10 -w --table filter --insert LIBVIRT_INP --in-interface virbr0 --protocol tcp --destination-port 67 --jump ACCEPT' failed: iptables: No chain/target/match by that name.
|
||||
|
||||
In particular, this resolves: https://bugzilla.redhat.com/1813830
|
||||
|
||||
Signed-off-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit f5418b427e7d2f26803880309478de9103680826)
|
||||
---
|
||||
src/network/bridge_driver.c | 16 ++++---
|
||||
src/network/bridge_driver_linux.c | 69 ++++++++++++++++++----------
|
||||
src/network/bridge_driver_nop.c | 3 +-
|
||||
src/network/bridge_driver_platform.h | 2 +-
|
||||
4 files changed, 58 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
|
||||
index 369e80a889..aaf14defe4 100644
|
||||
--- a/src/network/bridge_driver.c
|
||||
+++ b/src/network/bridge_driver.c
|
||||
@@ -273,7 +273,9 @@ static int
|
||||
networkShutdownNetworkExternal(virNetworkObjPtr obj);
|
||||
|
||||
static void
|
||||
-networkReloadFirewallRules(virNetworkDriverStatePtr driver, bool startup);
|
||||
+networkReloadFirewallRules(virNetworkDriverStatePtr driver,
|
||||
+ bool startup,
|
||||
+ bool force);
|
||||
|
||||
static void
|
||||
networkRefreshDaemons(virNetworkDriverStatePtr driver);
|
||||
@@ -689,7 +691,7 @@ firewalld_dbus_filter_bridge(DBusConnection *connection G_GNUC_UNUSED,
|
||||
|
||||
if (reload) {
|
||||
VIR_DEBUG("Reload in bridge_driver because of firewalld.");
|
||||
- networkReloadFirewallRules(driver, false);
|
||||
+ networkReloadFirewallRules(driver, false, true);
|
||||
}
|
||||
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
@@ -798,7 +800,7 @@ networkStateInitialize(bool privileged,
|
||||
virNetworkObjListPrune(network_driver->networks,
|
||||
VIR_CONNECT_LIST_NETWORKS_INACTIVE |
|
||||
VIR_CONNECT_LIST_NETWORKS_TRANSIENT);
|
||||
- networkReloadFirewallRules(network_driver, true);
|
||||
+ networkReloadFirewallRules(network_driver, true, false);
|
||||
networkRefreshDaemons(network_driver);
|
||||
|
||||
if (virDriverShouldAutostart(network_driver->stateDir, &autostart) < 0)
|
||||
@@ -868,7 +870,7 @@ networkStateReload(void)
|
||||
network_driver->networkConfigDir,
|
||||
network_driver->networkAutostartDir,
|
||||
network_driver->xmlopt);
|
||||
- networkReloadFirewallRules(network_driver, false);
|
||||
+ networkReloadFirewallRules(network_driver, false, false);
|
||||
networkRefreshDaemons(network_driver);
|
||||
virNetworkObjListForEach(network_driver->networks,
|
||||
networkAutostartConfig,
|
||||
@@ -2236,14 +2238,16 @@ networkReloadFirewallRulesHelper(virNetworkObjPtr obj,
|
||||
|
||||
|
||||
static void
|
||||
-networkReloadFirewallRules(virNetworkDriverStatePtr driver, bool startup)
|
||||
+networkReloadFirewallRules(virNetworkDriverStatePtr driver,
|
||||
+ bool startup,
|
||||
+ bool force)
|
||||
{
|
||||
VIR_INFO("Reloading iptables rules");
|
||||
/* Ideally we'd not even register the driver when unprivilegd
|
||||
* but until we untangle the virt driver that's not viable */
|
||||
if (!driver->privileged)
|
||||
return;
|
||||
- networkPreReloadFirewallRules(driver, startup);
|
||||
+ networkPreReloadFirewallRules(driver, startup, force);
|
||||
virNetworkObjListForEach(driver->networks,
|
||||
networkReloadFirewallRulesHelper,
|
||||
NULL);
|
||||
diff --git a/src/network/bridge_driver_linux.c b/src/network/bridge_driver_linux.c
|
||||
index 80bd2409e1..b0bd207250 100644
|
||||
--- a/src/network/bridge_driver_linux.c
|
||||
+++ b/src/network/bridge_driver_linux.c
|
||||
@@ -36,11 +36,14 @@ VIR_LOG_INIT("network.bridge_driver_linux");
|
||||
#define PROC_NET_ROUTE "/proc/net/route"
|
||||
|
||||
static virOnceControl createdOnce;
|
||||
-static bool createdChains;
|
||||
+static bool chainInitDone; /* true iff networkSetupPrivateChains was ever called */
|
||||
+static bool createdChains; /* true iff networkSetupPrivateChains created chains during most recent call */
|
||||
static virErrorPtr errInitV4;
|
||||
static virErrorPtr errInitV6;
|
||||
|
||||
-/* Only call via virOnce */
|
||||
+/* Usually only called via virOnce, but can also be called directly in
|
||||
+ * response to firewalld reload (if chainInitDone == true)
|
||||
+ */
|
||||
static void networkSetupPrivateChains(void)
|
||||
{
|
||||
int rc;
|
||||
@@ -82,6 +85,8 @@ static void networkSetupPrivateChains(void)
|
||||
VIR_DEBUG("Global IPv6 chains already exist");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ chainInitDone = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +116,10 @@ networkHasRunningNetworks(virNetworkDriverStatePtr driver)
|
||||
}
|
||||
|
||||
|
||||
-void networkPreReloadFirewallRules(virNetworkDriverStatePtr driver, bool startup)
|
||||
+void
|
||||
+networkPreReloadFirewallRules(virNetworkDriverStatePtr driver,
|
||||
+ bool startup,
|
||||
+ bool force)
|
||||
{
|
||||
/*
|
||||
* If there are any running networks, we need to
|
||||
@@ -130,29 +138,42 @@ void networkPreReloadFirewallRules(virNetworkDriverStatePtr driver, bool startup
|
||||
* of starting the network though as that makes them
|
||||
* more likely to be seen by a human
|
||||
*/
|
||||
- if (!networkHasRunningNetworks(driver)) {
|
||||
- VIR_DEBUG("Delayed global rule setup as no networks are running");
|
||||
- return;
|
||||
- }
|
||||
+ if (chainInitDone && force) {
|
||||
+ /* The Private chains have already been initialized once
|
||||
+ * during this run of libvirtd, so 1) we can't do it again via
|
||||
+ * virOnce(), and 2) we need to re-add the private chains even
|
||||
+ * if there are currently no running networks, because the
|
||||
+ * next time a network is started, libvirt will expect that
|
||||
+ * the chains have already been added. So we call directly
|
||||
+ * instead of via virOnce().
|
||||
+ */
|
||||
+ networkSetupPrivateChains();
|
||||
|
||||
- ignore_value(virOnce(&createdOnce, networkSetupPrivateChains));
|
||||
+ } else {
|
||||
+ if (!networkHasRunningNetworks(driver)) {
|
||||
+ VIR_DEBUG("Delayed global rule setup as no networks are running");
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- /*
|
||||
- * If this is initial startup, and we just created the
|
||||
- * top level private chains we either
|
||||
- *
|
||||
- * - upgraded from old libvirt
|
||||
- * - freshly booted from clean state
|
||||
- *
|
||||
- * In the first case we must delete the old rules from
|
||||
- * the built-in chains, instead of our new private chains.
|
||||
- * In the second case it doesn't matter, since no existing
|
||||
- * rules will be present. Thus we can safely just tell it
|
||||
- * to always delete from the builin chain
|
||||
- */
|
||||
- if (startup && createdChains) {
|
||||
- VIR_DEBUG("Requesting cleanup of legacy firewall rules");
|
||||
- iptablesSetDeletePrivate(false);
|
||||
+ ignore_value(virOnce(&createdOnce, networkSetupPrivateChains));
|
||||
+
|
||||
+ /*
|
||||
+ * If this is initial startup, and we just created the
|
||||
+ * top level private chains we either
|
||||
+ *
|
||||
+ * - upgraded from old libvirt
|
||||
+ * - freshly booted from clean state
|
||||
+ *
|
||||
+ * In the first case we must delete the old rules from
|
||||
+ * the built-in chains, instead of our new private chains.
|
||||
+ * In the second case it doesn't matter, since no existing
|
||||
+ * rules will be present. Thus we can safely just tell it
|
||||
+ * to always delete from the builin chain
|
||||
+ */
|
||||
+ if (startup && createdChains) {
|
||||
+ VIR_DEBUG("Requesting cleanup of legacy firewall rules");
|
||||
+ iptablesSetDeletePrivate(false);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/network/bridge_driver_nop.c b/src/network/bridge_driver_nop.c
|
||||
index 08d737511f..db89c10023 100644
|
||||
--- a/src/network/bridge_driver_nop.c
|
||||
+++ b/src/network/bridge_driver_nop.c
|
||||
@@ -20,7 +20,8 @@
|
||||
#include <config.h>
|
||||
|
||||
void networkPreReloadFirewallRules(virNetworkDriverStatePtr driver G_GNUC_UNUSED,
|
||||
- bool startup G_GNUC_UNUSED)
|
||||
+ bool startup G_GNUC_UNUSED,
|
||||
+ bool force G_GNUC_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
diff --git a/src/network/bridge_driver_platform.h b/src/network/bridge_driver_platform.h
|
||||
index 169417a6c0..48ab52c160 100644
|
||||
--- a/src/network/bridge_driver_platform.h
|
||||
+++ b/src/network/bridge_driver_platform.h
|
||||
@@ -62,7 +62,7 @@ struct _virNetworkDriverState {
|
||||
typedef struct _virNetworkDriverState virNetworkDriverState;
|
||||
typedef virNetworkDriverState *virNetworkDriverStatePtr;
|
||||
|
||||
-void networkPreReloadFirewallRules(virNetworkDriverStatePtr driver, bool startup);
|
||||
+void networkPreReloadFirewallRules(virNetworkDriverStatePtr driver, bool startup, bool force);
|
||||
void networkPostReloadFirewallRules(bool startup);
|
||||
|
||||
int networkCheckRouteCollision(virNetworkDefPtr def);
|
||||
@@ -1,100 +0,0 @@
|
||||
From: Laine Stump <laine@redhat.com>
|
||||
Date: Fri, 1 May 2020 00:05:50 -0400
|
||||
Subject: [PATCH] systemd: start libvirtd after firewalld/iptables services
|
||||
|
||||
When a system has enabled the iptables/ip6tables services rather than
|
||||
firewalld, there is no explicit ordering of the start of those
|
||||
services vs. libvirtd. This creates a problem when libvirtd.service is
|
||||
started before ip[6]tables, as the latter, when it finally is started,
|
||||
will remove all of the iptables rules that had previously been added
|
||||
by libvirt, including the custom chains where libvirt's rules are
|
||||
kept. This results in an error message similar to the following when a
|
||||
user subsequently tries to start a new libvirt network:
|
||||
|
||||
"Error while activating network: Call to virNetworkCreate failed:
|
||||
internal error: Failed to apply firewall rules
|
||||
/usr/sbin/ip6tables -w --table filter --insert LIBVIRT_FWO \
|
||||
--in-interface virbr2 --jump REJECT:
|
||||
ip6tables: No chain/target/match by that name."
|
||||
|
||||
(Prior to logging this error, it also would have caused failure to
|
||||
forward (or block) traffic in some cases, e.g. for guests on a NATed
|
||||
network, since libvirt's rules to forward/block had all been deleted
|
||||
and libvirt didn't know about it, so it couldn't fix the problem)
|
||||
|
||||
When this happens, the problem can be remedied by simply restarting
|
||||
libvirtd.service (which has the side-effect of reloading all
|
||||
libvirt-generated firewall rules)
|
||||
|
||||
Instead, we can just explicitly stating in the libvirtd.service file
|
||||
that libvirtd.service should start after ip6tables.service and
|
||||
ip6tables.service, eliminating the race condition that leads to the
|
||||
error.
|
||||
|
||||
There is also nothing (that I can see) in the systemd .service files
|
||||
to guarantee that firewalld.service will be started (if enabled) prior
|
||||
to libvirtd.service. The same error scenario given above would occur
|
||||
if libvirtd.service started before firewalld.service. Even before
|
||||
that, though libvirtd would have detected that firewalld.service was
|
||||
disabled, and then turn off all firewalld support. So, for example,
|
||||
firewalld's libvirt zone wouldn't be used, and most likely traffic
|
||||
from guests would therefore be blocked (all with no external
|
||||
indication of the source of the problem other than a debug-level log
|
||||
when libvirtd was started saying that firewalld wasn't in use); also
|
||||
libvirtd wouldn't notice when firewalld reloaded its rules (which also
|
||||
simultaneously deletes all of libvirt's rules).
|
||||
|
||||
I'm not aware of any reports that have been traced back to
|
||||
libvirtd.service starting before firewalld.service, but have seen that
|
||||
error reported multiple times, and also don't see an existing
|
||||
dependency that would guarantee firewalld.service starts before
|
||||
libvirtd.service, so it's possible it's been happening and we just
|
||||
haven't gotten to the bottom of it.
|
||||
|
||||
This patch adds an After= line to the libvirtd.service file for each
|
||||
of iptables.service, ip6tables.service, and firewalld.servicee, which
|
||||
should guarantee that libvirtd.service isn't started until systemd has
|
||||
started whichever of the others is enabled.
|
||||
|
||||
This race was diagnosed, and patch proposed, by Jason Montleon in
|
||||
https://bugzilla.redhat.com/1723698 . At the time (April 2019) danpb
|
||||
agreed with him that this change to libvirtd.service was a reasonable
|
||||
thing to do, but I guess everyone thought someone else was going to
|
||||
post a patch, so in the end nobody did.
|
||||
|
||||
Signed-off-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 0756415f147dda15a417bd79eef9a62027d176e6)
|
||||
---
|
||||
src/network/virtnetworkd.service.in | 3 +++
|
||||
src/remote/libvirtd.service.in | 3 +++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/network/virtnetworkd.service.in b/src/network/virtnetworkd.service.in
|
||||
index 656e8b4f84..56182e1693 100644
|
||||
--- a/src/network/virtnetworkd.service.in
|
||||
+++ b/src/network/virtnetworkd.service.in
|
||||
@@ -5,6 +5,9 @@ Requires=virtnetworkd.socket
|
||||
Requires=virtnetworkd-ro.socket
|
||||
Requires=virtnetworkd-admin.socket
|
||||
After=network.target
|
||||
+After=firewalld.service
|
||||
+After=iptables.service
|
||||
+After=ip6tables.service
|
||||
After=dbus.service
|
||||
After=apparmor.service
|
||||
After=local-fs.target
|
||||
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
|
||||
index 90b2cad5b0..cc0d4e3693 100644
|
||||
--- a/src/remote/libvirtd.service.in
|
||||
+++ b/src/remote/libvirtd.service.in
|
||||
@@ -11,6 +11,9 @@ Wants=libvirtd-admin.socket
|
||||
Wants=systemd-machined.service
|
||||
Before=libvirt-guests.service
|
||||
After=network.target
|
||||
+After=firewalld.service
|
||||
+After=iptables.service
|
||||
+After=ip6tables.service
|
||||
After=dbus.service
|
||||
After=iscsid.service
|
||||
After=apparmor.service
|
||||
@@ -1,43 +0,0 @@
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Fri, 3 Apr 2020 15:51:48 -0600
|
||||
Subject: [PATCH] libxl: fix crash when initializing driver
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but
|
||||
then called it a bit late from libxlStateInitialize. The cfg is used in
|
||||
libxlDriverConfigLoadFile and when uninitialized results in a crash.
|
||||
Calling DriverConfigInit immediately after DriverConfigNew fixes the
|
||||
crash.
|
||||
|
||||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 88011ed280c4f946a7b8e7ffcea2335eb075de60)
|
||||
---
|
||||
src/libxl/libxl_driver.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
|
||||
index f2387e2a20..c4fb791fa0 100644
|
||||
--- a/src/libxl/libxl_driver.c
|
||||
+++ b/src/libxl/libxl_driver.c
|
||||
@@ -703,14 +703,14 @@ libxlStateInitialize(bool privileged,
|
||||
if (!(cfg = libxlDriverConfigNew()))
|
||||
goto error;
|
||||
|
||||
+ if (libxlDriverConfigInit(cfg) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
driverConf = g_strdup_printf("%s/libxl.conf", cfg->configBaseDir);
|
||||
|
||||
if (libxlDriverConfigLoadFile(cfg, driverConf) < 0)
|
||||
goto error;
|
||||
|
||||
- if (libxlDriverConfigInit(cfg) < 0)
|
||||
- goto error;
|
||||
-
|
||||
/* Register the callbacks providing access to libvirt's event loop */
|
||||
libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Makefile for source rpm: libvirt
|
||||
# $Id$
|
||||
NAME := libvirt
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
include ../common/Makefile.common
|
||||
@@ -0,0 +1,83 @@
|
||||
diff -rupN libvirt-0.4.0.orig/src/remote_internal.c libvirt-0.4.0.new/src/remote_internal.c
|
||||
--- libvirt-0.4.0.orig/src/remote_internal.c 2008-01-11 10:39:34.000000000 -0500
|
||||
+++ libvirt-0.4.0.new/src/remote_internal.c 2008-01-11 10:43:12.000000000 -0500
|
||||
@@ -3054,8 +3054,12 @@ remoteAuthSASL (virConnectPtr conn, stru
|
||||
if ((remoteAddr = addrToString(&sa, salen)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
- if ((saslcb = remoteAuthMakeCallbacks(auth->credtype, auth->ncredtype)) == NULL)
|
||||
- goto cleanup;
|
||||
+ if (auth) {
|
||||
+ if ((saslcb = remoteAuthMakeCallbacks(auth->credtype, auth->ncredtype)) == NULL)
|
||||
+ goto cleanup;
|
||||
+ } else {
|
||||
+ saslcb = NULL;
|
||||
+ }
|
||||
|
||||
/* Setup a handle for being a client */
|
||||
err = sasl_client_new("libvirt",
|
||||
@@ -3168,15 +3172,21 @@ remoteAuthSASL (virConnectPtr conn, stru
|
||||
goto cleanup;
|
||||
}
|
||||
/* Run the authentication callback */
|
||||
- if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
||||
+ if (auth && auth->cb) {
|
||||
+ if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
||||
+ __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
+ "Failed to collect auth credentials");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ remoteAuthFillInteract(cred, interact);
|
||||
+ goto restart;
|
||||
+ } else {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
- "Failed to collect auth credentials");
|
||||
+ "No authentication callback available");
|
||||
goto cleanup;
|
||||
- return -1;
|
||||
}
|
||||
- remoteAuthFillInteract(cred, interact);
|
||||
- goto restart;
|
||||
}
|
||||
free(iret.mechlist);
|
||||
|
||||
@@ -3240,15 +3250,22 @@ remoteAuthSASL (virConnectPtr conn, stru
|
||||
return -1;
|
||||
}
|
||||
/* Run the authentication callback */
|
||||
- if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
||||
+ if (auth && auth->cb) {
|
||||
+ if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
||||
+ __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
+ "Failed to collect auth credentials");
|
||||
+ goto cleanup;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ remoteAuthFillInteract(cred, interact);
|
||||
+ goto restep;
|
||||
+ } else {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
- "Failed to collect auth credentials");
|
||||
+ "No authentication callback available");
|
||||
goto cleanup;
|
||||
- return -1;
|
||||
}
|
||||
- remoteAuthFillInteract(cred, interact);
|
||||
- goto restep;
|
||||
}
|
||||
|
||||
if (serverin) {
|
||||
@@ -3319,7 +3336,8 @@ remoteAuthSASL (virConnectPtr conn, stru
|
||||
if (remoteAddr) free(remoteAddr);
|
||||
if (serverin) free(serverin);
|
||||
|
||||
- free(saslcb);
|
||||
+ if (saslcb)
|
||||
+ free(saslcb);
|
||||
remoteAuthFreeCredentials(cred, ncred);
|
||||
if (ret != 0 && saslconn)
|
||||
sasl_dispose(&saslconn);
|
||||
@@ -0,0 +1,44 @@
|
||||
diff -rup libvirt-0.4.0.orig/src/remote_internal.c libvirt-0.4.0.new/src/remote_internal.c
|
||||
--- libvirt-0.4.0.orig/src/remote_internal.c 2007-12-17 16:51:09.000000000 -0500
|
||||
+++ libvirt-0.4.0.new/src/remote_internal.c 2008-01-02 16:28:44.000000000 -0500
|
||||
@@ -3347,24 +3347,26 @@ remoteAuthPolkit (virConnectPtr conn, st
|
||||
};
|
||||
remoteDebug(priv, "Client initialize PolicyKit authentication");
|
||||
|
||||
- for (i = 0 ; i < auth->ncredtype ; i++) {
|
||||
- if (auth->credtype[i] == VIR_CRED_EXTERNAL)
|
||||
- allowcb = 1;
|
||||
- }
|
||||
+ if (auth && auth->cb) {
|
||||
+ /* Check if the neccessary credential type for PolicyKit is supported */
|
||||
+ for (i = 0 ; i < auth->ncredtype ; i++) {
|
||||
+ if (auth->credtype[i] == VIR_CRED_EXTERNAL)
|
||||
+ allowcb = 1;
|
||||
+ }
|
||||
|
||||
- /* Run the authentication callback */
|
||||
- if (allowcb) {
|
||||
- if (auth && auth->cb &&
|
||||
- (*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
|
||||
- __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
- "Failed to collect auth credentials");
|
||||
- return -1;
|
||||
+ if (allowcb) {
|
||||
+ /* Run the authentication callback */
|
||||
+ if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
|
||||
+ __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
+ "Failed to collect auth credentials");
|
||||
+ return -1;
|
||||
+ }
|
||||
} else {
|
||||
- remoteDebug(priv, "No auth callback provided for PolicyKit");
|
||||
+ remoteDebug(priv, "Client auth callback does not support PolicyKit");
|
||||
}
|
||||
} else {
|
||||
- remoteDebug(priv, "Client auth callback does not support PolicyKit");
|
||||
+ remoteDebug(priv, "No auth callback provided");
|
||||
}
|
||||
|
||||
memset (&ret, 0, sizeof ret);
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -rup libvirt-0.4.0.orig/src/conf.c libvirt-0.4.0.new/src/conf.c
|
||||
--- libvirt-0.4.0.orig/src/conf.c 2007-12-12 08:30:49.000000000 -0500
|
||||
+++ libvirt-0.4.0.new/src/conf.c 2008-01-02 16:30:12.000000000 -0500
|
||||
@@ -705,7 +705,7 @@ error:
|
||||
virConfPtr
|
||||
__virConfReadFile(const char *filename)
|
||||
{
|
||||
- char content[4096];
|
||||
+ char content[8192];
|
||||
int fd;
|
||||
int len;
|
||||
|
||||
+340
-1983
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user