# Sys::Guestfs::Lib
-# Copyright (C) 2009 Red Hat Inc.
+# Copyright (C) 2009-2010 Red Hat Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
use strict;
use warnings;
+# The minor part of this version number is incremented when some
+# change is made to this module. The major part is incremented if we
+# make a change which is not backwards compatible. It is not related
+# to the libguestfs version number.
+use vars qw($VERSION);
+$VERSION = '0.2';
+
use Carp qw(croak);
use Sys::Guestfs;
'/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):
}
}
+ # 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;
}
# Initialise augeas
$g->aug_init("/", 16);
- # Register additional paths to the Modprobe lens
- $g->aug_set("/augeas/load/Modprobe/incl[last()+1]", "/etc/modules.conf");
- $g->aug_set("/augeas/load/Modprobe/incl[last()+1]", "/etc/conf.modules");
-
- # Make augeas reload
- $g->aug_load();
-
my %modprobe_aliases;
for my $pattern qw(/files/etc/conf.modules/alias