From a6433aff70495ef66b8de66b29e58b17aa62076e Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 21 Jul 2015 16:56:00 +0200 Subject: [PATCH] tests/nbd: pass --format to qemu-nbd if possible Run `qemu-nbd --help` to know whether it supports --format, and if so pass it explicitly. This avoids warnings with newer qemu versions, where they really recommends to explicit the format of disk images being specified on command line. --- tests/nbd/test-nbd.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/nbd/test-nbd.pl b/tests/nbd/test-nbd.pl index c7361fd0a..6353b25b9 100755 --- a/tests/nbd/test-nbd.pl +++ b/tests/nbd/test-nbd.pl @@ -45,12 +45,17 @@ if (! -r $disk || -z $disk) { exit 77 } +my $has_format_opt = system ("qemu-nbd --help | grep -q -- --format") == 0; + sub run_test { my $readonly = shift; my $tcp = shift; my $server; my @qemu_nbd = ("qemu-nbd", $disk, "-t"); + if ($has_format_opt) { + push @qemu_nbd, "--format", "raw"; + } if ($tcp) { # Choose a random port number. XXX Should check it is not in use. my $port = int (60000 + rand (5000));