X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=inspector%2Fvirt-inspector.pl;h=3557a38aa57c8032c3a1fa7f1d890d1ee91a8254;hp=f12af42f529211ef93d02855fd732ceec3cf9761;hb=a7b73d4a1e09f12b2002083618056f0c823c1dcf;hpb=4dff42aa13dd726fb6b02843d0f4db4b4b330fe3 diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl index f12af42..3557a38 100755 --- a/inspector/virt-inspector.pl +++ b/inspector/virt-inspector.pl @@ -672,6 +672,7 @@ sub assign_mount_points } else { $fs->{used} = 1 } + $fs->{spec} = $spec; } } } @@ -705,6 +706,12 @@ sub find_filesystem } else { return ($_, $fses{$_}) if exists $fses{$_}; + # The following is to handle the case where an fstab entry specifies a + # specific device rather than its label or uuid, and the libguestfs + # appliance has named the device differently due to the use of a + # different driver. + # This will work as long as the underlying drivers recognise devices in + # the same order. if (m{^/dev/hd(.*)} && exists $fses{"/dev/sd$1"}) { return ("/dev/sd$1", $fses{"/dev/sd$1"}); } @@ -875,13 +882,22 @@ sub check_for_modprobe_aliases @results = $g->aug_match($pattern); for my $path ( @results ) { + $path =~ m{^/files(.*)/alias(?:\[\d*\])?$} + or die("$path doesn't match augeas pattern"); + my $file = $1; + my $alias; $alias = $g->aug_get($path); my $modulename; $modulename = $g->aug_get($path.'/modulename'); - $modprobe_aliases{$alias} = $modulename; + my %aliasinfo; + $aliasinfo{modulename} = $modulename; + $aliasinfo{augeas} = $path; + $aliasinfo{file} = $file; + + $modprobe_aliases{$alias} = \%aliasinfo; } } @@ -952,7 +968,7 @@ elsif ($output eq "perl") { elsif ($output eq "yaml") { die "virt-inspector: no YAML support\n" unless exists $INC{"YAML/Any.pm"}; - + print Dump(\%oses); } @@ -1011,7 +1027,7 @@ sub output_text_os if (@keys) { print " Modprobe aliases:\n"; foreach (@keys) { - printf " %-30s %s\n", $_, $aliases{$_} + printf " %-30s %s\n", $_, $aliases{$_}->{modulename} } } } @@ -1093,7 +1109,8 @@ sub output_xml_os foreach my $field ( [ "label" => "label" ], [ "uuid" => "uuid" ], [ "type" => "fstype" ], - [ "content" => "content" ] ) { + [ "content" => "content" ], + [ "spec" => "spec" ] ) { $xml->dataElement($field->[0], $filesystems->{$_}{$field->[1]}) if exists $filesystems->{$_}{$field->[1]}; } @@ -1108,7 +1125,15 @@ sub output_xml_os if (@keys) { $xml->startTag("modprobealiases"); foreach (@keys) { - $xml->dataElement("alias", $aliases{$_}, "device" => $_); + $xml->startTag("alias", "device" => $_); + + foreach my $field ( [ "modulename" => "modulename" ], + [ "augeas" => "augeas" ], + [ "file" => "file" ] ) { + $xml->dataElement($field->[0], $aliases{$_}->{$field->[1]}); + } + + $xml->endTag("alias"); } $xml->endTag("modprobealiases"); }