From: Ian Campbell Date: Fri, 18 Sep 2015 15:34:43 +0000 (+0100) Subject: make_qcow2: Look for qemu-img under /usr as well as /usr/local X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d46a5b7f70b1edace5876286d7cbc6302f3c8a84;p=osstest.git make_qcow2: Look for qemu-img under /usr as well as /usr/local Older Xen's installed in /usr by default, so we need to check where qemu-img if we want these tests to work on those versions. Signed-off-by: Ian Campbell Acked-by: Ian Jackson --- diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 168aa9c..2b67e32 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -1647,7 +1647,16 @@ sub make_vhd ($$$) { sub make_qcow2 ($$$) { my ($ho, $gho, $disk_mb) = @_; # upstream qemu's version. Seems preferable to qemu-xen-img from qemu-trad. - my $qemu_img = "/usr/local/lib/xen/bin/qemu-img"; + my $qemu_img; + foreach (qw(/usr/local /usr)) { + my $try = "$_/lib/xen/bin/qemu-img"; + if (target_file_exists($ho, $try)) { + $qemu_img=$try; + last; + } + } + die "no qemu-img" unless $qemu_img; + target_cmd_root($ho, "$qemu_img create -f qcow2 $gho->{Rootimg} ${disk_mb}M"); } sub make_raw ($$$) {