X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=perl%2Flib%2FSys%2FGuestfs%2FLib.pm;h=4305b1958b6d38b5f0aaff68f8cf852901b4041e;hb=c8e225b8e0cc29aca69a58128ea1faf33600c411;hp=8ec487dcd30499e9d9c795b06264c20caff2810f;hpb=a57f15a0c434797c45b334f9ace5f18a3bef610a;p=libguestfs.git diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index 8ec487d..4305b19 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -1101,7 +1101,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): @@ -1184,6 +1185,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; }