mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
test: fix nwfilter tests following changes in virfirewall.c
Some of the nwfilter tests are now failing since --concurrent shows up in the ebtables command. To avoid this, implement a function preventing the probing for lock support in the eb/iptables tools and use it in the tests. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
540c339a25
commit
3865941be1
@ -1370,6 +1370,7 @@ virFirewallRuleAddArgList;
|
||||
virFirewallRuleAddArgSet;
|
||||
virFirewallRuleGetArgCount;
|
||||
virFirewallSetBackend;
|
||||
virFirewallSetLockOverride;
|
||||
virFirewallStartRollback;
|
||||
virFirewallStartTransaction;
|
||||
|
||||
|
@ -107,6 +107,13 @@ VIR_ONCE_GLOBAL_INIT(virFirewall)
|
||||
static bool iptablesUseLock;
|
||||
static bool ip6tablesUseLock;
|
||||
static bool ebtablesUseLock;
|
||||
static bool lockOverride; /* true to avoid lock probes */
|
||||
|
||||
void
|
||||
virFirewallSetLockOverride(bool avoid)
|
||||
{
|
||||
lockOverride = avoid;
|
||||
}
|
||||
|
||||
static void
|
||||
virFirewallCheckUpdateLock(bool *lockflag,
|
||||
@ -135,6 +142,8 @@ virFirewallCheckUpdateLocking(void)
|
||||
const char *ebtablesArgs[] = {
|
||||
EBTABLES_PATH, "--concurrent", "-L", NULL,
|
||||
};
|
||||
if (lockOverride)
|
||||
return;
|
||||
virFirewallCheckUpdateLock(&iptablesUseLock,
|
||||
iptablesArgs);
|
||||
virFirewallCheckUpdateLock(&ip6tablesUseLock,
|
||||
|
@ -106,4 +106,6 @@ void virFirewallStartRollback(virFirewallPtr firewall,
|
||||
|
||||
int virFirewallApply(virFirewallPtr firewall);
|
||||
|
||||
void virFirewallSetLockOverride(bool avoid);
|
||||
|
||||
#endif /* __VIR_FIREWALL_H__ */
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "testutils.h"
|
||||
#include "nwfilter/nwfilter_ebiptables_driver.h"
|
||||
#include "virbuffer.h"
|
||||
#include "virfirewall.h"
|
||||
|
||||
#define __VIR_FIREWALL_PRIV_H_ALLOW__
|
||||
#include "virfirewallpriv.h"
|
||||
@ -522,6 +523,8 @@ mymain(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
virFirewallSetLockOverride(true);
|
||||
|
||||
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
|
@ -474,6 +474,8 @@ mymain(void)
|
||||
ret = -1; \
|
||||
} while (0)
|
||||
|
||||
virFirewallSetLockOverride(true);
|
||||
|
||||
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user