summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl/lib/Sys/Guestfs/Lib.pm10
-rwxr-xr-xtools/virt-cat1
-rwxr-xr-xtools/virt-edit1
-rwxr-xr-xtools/virt-ls1
-rwxr-xr-xtools/virt-tar1
-rwxr-xr-xtools/virt-win-reg1
6 files changed, 8 insertions, 7 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index fc3163f1..2c5c8370 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -25,7 +25,7 @@ use warnings;
# make a change which is not backwards compatible. It is not related
# to the libguestfs version number.
use vars qw($VERSION);
-$VERSION = '0.1';
+$VERSION = '0.2';
use Carp qw(croak);
@@ -1119,7 +1119,8 @@ like:
'/dev/VG/Root' => \%os,
}
-(There can be multiple roots for a multi-boot VM).
+There can be multiple roots for a multi-boot VM, but this function
+will throw an error if no roots (ie. OSes) could be found.
The C<\%os> hash contains the following keys (any can be omitted):
@@ -1202,6 +1203,11 @@ sub inspect_operating_systems
}
}
+ # If we didn't find any operating systems then it's an error (RHBZ#591142).
+ if (0 == keys %oses) {
+ die __"No operating system could be detected inside this disk image.\n\nThis may be because the file is not a disk image, or is not a virtual machine\nimage, or because the OS type is not understood by virt-inspector.\n\nIf you feel this is an error, please file a bug report including as much\ninformation about the disk image as possible.\n";
+ }
+
return \%oses;
}
diff --git a/tools/virt-cat b/tools/virt-cat
index c8cdd193..e000e25f 100755
--- a/tools/virt-cat
+++ b/tools/virt-cat
@@ -150,7 +150,6 @@ my %fses =
my $oses = inspect_operating_systems ($g, \%fses);
my @roots = keys %$oses;
-die __"no root device found in this operating system image" if @roots == 0;
die __"multiboot operating systems are not supported by virt-cat" if @roots > 1;
my $root_dev = $roots[0];
diff --git a/tools/virt-edit b/tools/virt-edit
index c133e6a1..e00e4cfb 100755
--- a/tools/virt-edit
+++ b/tools/virt-edit
@@ -133,7 +133,6 @@ my %fses =
my $oses = inspect_operating_systems ($g, \%fses);
my @roots = keys %$oses;
-die __"no root device found in this operating system image" if @roots == 0;
die __"multiboot operating systems are not supported by virt-edit" if @roots > 1;
my $root_dev = $roots[0];
diff --git a/tools/virt-ls b/tools/virt-ls
index 8add52e3..8813d2fa 100755
--- a/tools/virt-ls
+++ b/tools/virt-ls
@@ -183,7 +183,6 @@ my %fses =
my $oses = inspect_operating_systems ($g, \%fses);
my @roots = keys %$oses;
-die __"no root device found in this operating system image\n" if @roots == 0;
die __"multiboot operating systems are not supported by virt-ls\n" if @roots > 1;
my $root_dev = $roots[0];
diff --git a/tools/virt-tar b/tools/virt-tar
index 839ff8eb..07c65f44 100755
--- a/tools/virt-tar
+++ b/tools/virt-tar
@@ -227,7 +227,6 @@ my %fses =
my $oses = inspect_operating_systems ($g, \%fses);
my @roots = keys %$oses;
-die __"no root device found in this operating system image\n" if @roots == 0;
die __"multiboot operating systems are not supported by virt-tar\n" if @roots > 1;
my $root_dev = $roots[0];
diff --git a/tools/virt-win-reg b/tools/virt-win-reg
index 74881b67..afa8087a 100755
--- a/tools/virt-win-reg
+++ b/tools/virt-win-reg
@@ -280,7 +280,6 @@ my %fses =
my $oses = inspect_operating_systems ($g, \%fses);
my @roots = keys %$oses;
-die __"no root device found in this operating system image" if @roots == 0;
die __"multiboot operating systems are not supported by virt-win-reg" if @roots > 1;
my $root_dev = $roots[0];