[libvirt] [PATCH tck 1/5] Ping test: use domifstats to wait for dhcp to be setup in guest
Cedric Bosdonnat
cbosdonnat at suse.com
Tue Sep 29 14:58:26 UTC 2015
On Tue, 2015-09-29 at 16:48 +0200, Cédric Bosdonnat wrote:
> From: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Ouch, the email address is the wrong one here. I'll resubmit the series
with the correct one.
--
Cedric
> Some guests may be slower to start than 30 seconds. Use domifstats
> to wait for 10 packets to be sent by the guest (usually the DHCP ones
> are the first ones).
> ---
> scripts/nwfilter/100-ping-still-working.t | 13 +++++++++++--
> scripts/nwfilter/210-no-mac-spoofing.t | 13 +++++++++++--
> scripts/nwfilter/230-no-mac-broadcast.t | 13 +++++++++++--
> scripts/nwfilter/240-no-arp-spoofing.t | 13 +++++++++++--
> 4 files changed, 44 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t
> index f65bf37..a20b95d 100644
> --- a/scripts/nwfilter/100-ping-still-working.t
> +++ b/scripts/nwfilter/100-ping-still-working.t
> @@ -54,8 +54,17 @@ diag "Start domain";
> $dom->create;
> ok($dom->get_id() > 0, "running domain has an ID > 0");
>
> -diag "Waiting 30 seconds for guest to finish booting";
> -sleep(30);
> +diag "Waiting for guest to finish booting";
> +my $stats;
> +my $tries = 0;
> +do {
> + sleep(10);
> + $stats = $dom->interface_stats("vnet0");
> + $tries++;
> +} while ($stats->{"tx_packets"} < 10 && $tries < 10);
> +
> +# Wait a little bit more to make sure dhcp is started in the guest
> +sleep(10);
>
> my $mac = get_first_macaddress($dom);
> diag "mac is $mac";
> diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t
> index 7e80216..b81fc4a 100644
> --- a/scripts/nwfilter/210-no-mac-spoofing.t
> +++ b/scripts/nwfilter/210-no-mac-spoofing.t
> @@ -53,8 +53,17 @@ diag "Start domain";
> $dom->create;
> ok($dom->get_id() > 0, "running domain has an ID > 0");
>
> -diag "Waiting 30 seconds for guest to finish booting";
> -sleep(30);
> +diag "Waiting for guest to finish booting";
> +my $stats;
> +my $tries = 0;
> +do {
> + sleep(10);
> + $stats = $dom->interface_stats("vnet0");
> + $tries++;
> +} while ($stats->{"tx_packets"} < 10 && $tries < 10);
> +
> +# Wait a little bit more to make sure dhcp is started in the guest
> +sleep(10);
>
> # ping guest first nic
> my $mac = get_first_macaddress($dom);
> diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t
> index 2e616d6..16ce60d 100644
> --- a/scripts/nwfilter/230-no-mac-broadcast.t
> +++ b/scripts/nwfilter/230-no-mac-broadcast.t
> @@ -52,8 +52,17 @@ diag "Start domain";
> $dom->create;
> ok($dom->get_id() > 0, "running domain has an ID > 0");
>
> -diag "Waiting 30 seconds for guest to finish booting";
> -sleep(30);
> +diag "Waiting for guest to finish booting";
> +my $stats;
> +my $tries = 0;
> +do {
> + sleep(10);
> + $stats = $dom->interface_stats("vnet0");
> + $tries++;
> +} while ($stats->{"tx_packets"} < 10 && $tries < 10);
> +
> +# Wait a little bit more to make sure dhcp is started in the guest
> +sleep(10);
>
> # ping guest first nic
> my $mac = get_first_macaddress($dom);
> diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t
> index 596a0ce..6b346aa 100644
> --- a/scripts/nwfilter/240-no-arp-spoofing.t
> +++ b/scripts/nwfilter/240-no-arp-spoofing.t
> @@ -54,8 +54,17 @@ diag "Start domain";
> $dom->create;
> ok($dom->get_id() > 0, "running domain has an ID > 0");
>
> -diag "Waiting 30 seconds for guest to finish booting";
> -sleep(30);
> +diag "Waiting for guest to finish booting";
> +my $stats;
> +my $tries = 0;
> +do {
> + sleep(10);
> + $stats = $dom->interface_stats("vnet0");
> + $tries++;
> +} while ($stats->{"tx_packets"} < 10 && $tries < 10);
> +
> +# Wait a little bit more to make sure dhcp is started in the guest
> +sleep(10);
>
> # ping guest first nic
> my $mac = get_first_macaddress($dom);
More information about the libvir-list
mailing list