mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +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;
|
virFirewallRuleAddArgSet;
|
||||||
virFirewallRuleGetArgCount;
|
virFirewallRuleGetArgCount;
|
||||||
virFirewallSetBackend;
|
virFirewallSetBackend;
|
||||||
|
virFirewallSetLockOverride;
|
||||||
virFirewallStartRollback;
|
virFirewallStartRollback;
|
||||||
virFirewallStartTransaction;
|
virFirewallStartTransaction;
|
||||||
|
|
||||||
|
@ -107,6 +107,13 @@ VIR_ONCE_GLOBAL_INIT(virFirewall)
|
|||||||
static bool iptablesUseLock;
|
static bool iptablesUseLock;
|
||||||
static bool ip6tablesUseLock;
|
static bool ip6tablesUseLock;
|
||||||
static bool ebtablesUseLock;
|
static bool ebtablesUseLock;
|
||||||
|
static bool lockOverride; /* true to avoid lock probes */
|
||||||
|
|
||||||
|
void
|
||||||
|
virFirewallSetLockOverride(bool avoid)
|
||||||
|
{
|
||||||
|
lockOverride = avoid;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
virFirewallCheckUpdateLock(bool *lockflag,
|
virFirewallCheckUpdateLock(bool *lockflag,
|
||||||
@ -135,6 +142,8 @@ virFirewallCheckUpdateLocking(void)
|
|||||||
const char *ebtablesArgs[] = {
|
const char *ebtablesArgs[] = {
|
||||||
EBTABLES_PATH, "--concurrent", "-L", NULL,
|
EBTABLES_PATH, "--concurrent", "-L", NULL,
|
||||||
};
|
};
|
||||||
|
if (lockOverride)
|
||||||
|
return;
|
||||||
virFirewallCheckUpdateLock(&iptablesUseLock,
|
virFirewallCheckUpdateLock(&iptablesUseLock,
|
||||||
iptablesArgs);
|
iptablesArgs);
|
||||||
virFirewallCheckUpdateLock(&ip6tablesUseLock,
|
virFirewallCheckUpdateLock(&ip6tablesUseLock,
|
||||||
|
@ -106,4 +106,6 @@ void virFirewallStartRollback(virFirewallPtr firewall,
|
|||||||
|
|
||||||
int virFirewallApply(virFirewallPtr firewall);
|
int virFirewallApply(virFirewallPtr firewall);
|
||||||
|
|
||||||
|
void virFirewallSetLockOverride(bool avoid);
|
||||||
|
|
||||||
#endif /* __VIR_FIREWALL_H__ */
|
#endif /* __VIR_FIREWALL_H__ */
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
#include "nwfilter/nwfilter_ebiptables_driver.h"
|
#include "nwfilter/nwfilter_ebiptables_driver.h"
|
||||||
#include "virbuffer.h"
|
#include "virbuffer.h"
|
||||||
|
#include "virfirewall.h"
|
||||||
|
|
||||||
#define __VIR_FIREWALL_PRIV_H_ALLOW__
|
#define __VIR_FIREWALL_PRIV_H_ALLOW__
|
||||||
#include "virfirewallpriv.h"
|
#include "virfirewallpriv.h"
|
||||||
@ -522,6 +523,8 @@ mymain(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
virFirewallSetLockOverride(true);
|
||||||
|
|
||||||
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -474,6 +474,8 @@ mymain(void)
|
|||||||
ret = -1; \
|
ret = -1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
virFirewallSetLockOverride(true);
|
||||||
|
|
||||||
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user