On Fri, May 14, 2010 at 02:51:52PM +0100, Matthew Booth wrote:
We were previously forcing the augeas Modprobe lens to match
modules.conf and
conf.modules. It turns out that the contents of these files are quite different
to modprobe.conf, requiring a new lens.
This change keeps the logic which looks for where modules should go, but doesn't
update the augeas configuration. If there is no augeas lens for
/etc/modules.conf, any attempt to parse or modify it will fail.
---
lib/Sys/VirtV2V/GuestOS/RedHat.pm | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
index 77f0f3a..1a7afbd 100644
--- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
+++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
@@ -87,6 +87,7 @@ sub new
bless($self, $class);
$self->_init_selinux();
+ $self->_init_modules();
$self->_init_augeas();
return $self;
@@ -168,10 +169,9 @@ sub _init_selinux
$g->touch('/.autorelabel');
}
-sub _init_augeas
+sub _init_modules
{
my $self = shift;
-
my $g = $self->{g};
# Check how new modules should be configured. Possibilities, in descending
@@ -185,10 +185,8 @@ sub _init_augeas
# discovered method will be chosen
# Files which the augeas Modprobe lens doesn't look for by default
- my @modprobe_add = ();
foreach my $file qw(/etc/conf.modules /etc/modules.conf) {
if($g->exists($file)) {
- push(@modprobe_add, $file);
$self->{modules} = $file;
}
}
@@ -205,20 +203,18 @@ sub _init_augeas
die(user_message(__"Unable to find any valid modprobe configuration"))
unless(defined($self->{modules}));
+}
+
+sub _init_augeas
+{
+ my $self = shift;
+ my $g = $self->{g};
# Initialise augeas
eval {
$g->aug_close();
$g->aug_init("/", 1);
- # Add files which exist, but the augeas Modprobe lens doesn't look for
- # by default
- if(scalar(@modprobe_add) > 0) {
- foreach (@modprobe_add) {
- $g->aug_set("/augeas/load/Modprobe/incl[last()+1]", $_);
- }
- }
-
# Check if /boot/grub/menu.lst is included by the Grub lens
my $found = 0;
foreach my $incl ($g->aug_match("/augeas/load/Grub/incl")) {
--
1.6.6.1
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
I thought I had ACKed this one before, but in case I didn't, ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top