mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
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.
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user