Re: [PATCH] test: fix nwfilter tests following changes in virfirewall.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/26/2014 08:58 AM, Stefan Berger wrote:
> Some of the nwfilter tests are now failing since --concurrent shows
> up in the ebtables command. To avoid this, implement a few functions
> that allow to set the booleans indicating how the locking is to be
> done to false, overriding the probing.
> 
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>
> ---
>  src/libvirt_private.syms         |  3 +++
>  src/util/virfirewall.c           | 18 ++++++++++++++++++
>  src/util/virfirewall.h           |  4 ++++
>  tests/nwfilterebiptablestest.c   |  5 +++++
>  tests/nwfilterxml2firewalltest.c |  4 ++++
>  5 files changed, 34 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 2647d36..376826a 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1353,7 +1353,10 @@ virFindFileInPath;
>  virFirewallAddRule;
>  virFirewallAddRuleFull;
>  virFirewallApply;
> +virFirewallEbtablesNotUseLock;

Awkward naming scheme.  If we keep it, I'd suggest
virFirewallEbtablesAvoidLock (and similar for the other functions).  But
see below for an alternative suggestion with fewer lines of code required:

> +++ b/src/util/virfirewall.c
> @@ -108,6 +108,24 @@ static bool iptablesUseLock;
>  static bool ip6tablesUseLock;
>  static bool ebtablesUseLock;
>  
> +void
> +virFirewallIptablesNotUseLock(void)
> +{
> +    iptablesUseLock = false;
> +}
> +
> +void
> +virFirewallIp6tablesNotUseLock(void)
> +{
> +    ip6tablesUseLock = false;
> +}

Rather than implementing 3 functions, why not just have one?  Something
like:

static bool lockOverride; /* true to avoid lock probes */
void
virFirewallSetLockOverride(bool avoid)
{
    lockOverride = avoid;
}

static void
virFirewallCheckUpdateLock(...)
{
    if (lockOverride)
        return;
    ... existing body
}

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]