diff options
author | Richard Jones <rjones@redhat.com> | 2010-05-12 18:11:37 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-05-13 16:22:10 +0100 |
commit | 94e310dcfbcd368cbe02dbc1643ed2ff9821cd48 (patch) | |
tree | b358649ef1e28475f06da6788a38b24a8756ac65 /perl/lib | |
parent | 287f8957fea3efe411c7ac55595d5d6c7b613e4e (diff) | |
download | libguestfs-94e310dcfbcd368cbe02dbc1643ed2ff9821cd48.tar.gz libguestfs-94e310dcfbcd368cbe02dbc1643ed2ff9821cd48.tar.xz libguestfs-94e310dcfbcd368cbe02dbc1643ed2ff9821cd48.zip |
Improved error if virt-inspector cannot find OSes in image (RHBZ#591142).
Diffstat (limited to 'perl/lib')
-rw-r--r-- | perl/lib/Sys/Guestfs/Lib.pm | 10 |
1 files changed, 8 insertions, 2 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; } |