[libvirt] [tck PATCH v2 05/13] scripts: portability fixes in checking command output

Laine Stump laine at laine.org
Fri Jun 1 22:05:41 UTC 2018


On 05/21/2018 12:46 PM, Daniel P. Berrangé wrote:
> Some versions of libvirt/dnsmasq will spawn a child process, so we must
> trim output from ps to only show the first (main) process.
>
> With IPv6 networking we might also get a link local address, which we
> should skip because it will be different each time, derived from the
> random MAC address.
>
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>

Reviewed-by: Laine Stump <laine at laine.org>

> ---
>  scripts/networks/networkxml2hostout/tck-testnet-1.dat | 2 +-
>  scripts/networks/networkxml2hostout/tck-testnet-2.dat | 2 +-
>  scripts/networks/networkxml2hostout/tck-testnet-3.dat | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/networks/networkxml2hostout/tck-testnet-1.dat b/scripts/networks/networkxml2hostout/tck-testnet-1.dat
> index fff6ca3..59cda2f 100644
> --- a/scripts/networks/networkxml2hostout/tck-testnet-1.dat
> +++ b/scripts/networks/networkxml2hostout/tck-testnet-1.dat
> @@ -9,7 +9,7 @@ ACCEPT     all  --  0.0.0.0/0            10.1.2.0/24         state RELATED,ESTAB
>  ACCEPT     all  --  10.1.2.0/24          0.0.0.0/0           
>  #ip -o route show dev tck-testbr | gawk '{print $1" "$7}'
>  10.1.2.0/24 10.1.2.1
> -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p'
> +#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p' | head -1
>  /dnsmasq/tck-testnet.conf
>  #grep bind-dynamic `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf-file=\(.*tck-testnet.conf\).*|\1|p'`
>  bind-dynamic
> diff --git a/scripts/networks/networkxml2hostout/tck-testnet-2.dat b/scripts/networks/networkxml2hostout/tck-testnet-2.dat
> index 7f8c86c..4f3d135 100644
> --- a/scripts/networks/networkxml2hostout/tck-testnet-2.dat
> +++ b/scripts/networks/networkxml2hostout/tck-testnet-2.dat
> @@ -4,7 +4,7 @@ ACCEPT     all  --  10.1.2.0/24          0.0.0.0/0
>  #iptables -t nat -L -n | grep ' 10\.1\.2\.'
>  #ip -o route show dev tck-testbr | gawk '{print $1" "$7}'
>  10.1.2.0/24 10.1.2.1
> -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p'
> +#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p' | head -1
>  /dnsmasq/tck-testnet.conf
>  #grep bind-dynamic `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf-file=\(.*tck-testnet.conf\).*|\1|p'`
>  bind-dynamic
> diff --git a/scripts/networks/networkxml2hostout/tck-testnet-3.dat b/scripts/networks/networkxml2hostout/tck-testnet-3.dat
> index 5fbf742..535a9c7 100644
> --- a/scripts/networks/networkxml2hostout/tck-testnet-3.dat
> +++ b/scripts/networks/networkxml2hostout/tck-testnet-3.dat
> @@ -12,7 +12,7 @@ ACCEPT     all      ::/0                 2001:db8:ac10:fd01::/64
>  ACCEPT     all      2001:db8:ac10:fd01::/64  ::/0                
>  ACCEPT     all      ::/0                 2001:db8:ac10:fe01::/64 
>  ACCEPT     all      2001:db8:ac10:fe01::/64  ::/0                
> -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p'
> +#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p' | head -1
>  /dnsmasq/tck-testnet.conf
>  #grep bind-dynamic `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf-file=\(.*tck-testnet.conf\).*|\1|p'`
>  bind-dynamic
> @@ -22,7 +22,7 @@ dhcp-range=2001:db8:ac10:fe01::1,ra-only
>  dhcp-range=2001:db8:ac10:fd01::1,ra-only
>  #brctl show | grep tck-testbr | gawk '{print $1" "$3}'
>  tck-testbr yes
> -#ip -o addr show dev tck-testbr | gawk '{print $4" "$6}'
> +#ip -o addr show dev tck-testbr | gawk '{print $4" "$6}' | grep -v link
>  10.1.2.1/24 10.1.2.255
>  192.168.123.1/24 192.168.123.255
>  172.28.255.241/28 172.28.255.255





More information about the libvir-list mailing list