diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-08-11 11:45:25 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-08-11 11:45:25 +0100 |
commit | b9838001015a06a69a08b69d9f013d82f0ea3139 (patch) | |
tree | c752cbf53abdca7f107b96735230c6372995d907 /perl/lib | |
parent | 2c57305f72cd6181d1849ae6e1b892aa01c7f844 (diff) | |
download | libguestfs-b9838001015a06a69a08b69d9f013d82f0ea3139.tar.gz libguestfs-b9838001015a06a69a08b69d9f013d82f0ea3139.tar.xz libguestfs-b9838001015a06a69a08b69d9f013d82f0ea3139.zip |
Fix 'unknown filesystem' warnings in old inspection code (RHBZ#678231 RHBZ#666578).
This is a comprehensive fix for the warnings from the old (and
obsolete) Perl inspection code. For a full description and
reproducer, see:
https://bugzilla.redhat.com/show_bug.cgi?id=678231#c5
Diffstat (limited to 'perl/lib')
-rw-r--r-- | perl/lib/Sys/Guestfs/Lib.pm | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index fc6a10f6..007db64c 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -892,23 +892,29 @@ sub _find_filesystem if (/^LABEL=(.*)/) { my $label = $1; - foreach (sort keys %$fses) { - if (exists $fses->{$_}->{label} && - $fses->{$_}->{label} eq $label) { - return ($_, $fses->{$_}); - } - } - warn __x("unknown filesystem label {label}\n", label => $label); + my $dev; + eval { + $dev = $g->findfs_label ($label); + }; + warn "unknown filesystem LABEL=$label in /etc/fstab: $@\n" if $@; + return () if !defined $dev; + $dev = _canonical_dev ($dev); + return ($dev, $fses->{$dev}) if exists $fses->{$dev}; + # Otherwise return nothing. It's just a filesystem that we are + # ignoring, eg. swap. return (); } elsif (/^UUID=(.*)/) { my $uuid = $1; - foreach (sort keys %$fses) { - if (exists $fses->{$_}->{uuid} && - $fses->{$_}->{uuid} eq $uuid) { - return ($_, $fses->{$_}); - } - } - warn __x("unknown filesystem UUID {uuid}\n", uuid => $uuid); + my $dev; + eval { + $dev = $g->findfs_uuid ($uuid); + }; + warn "unknown filesystem UUID=$uuid in /etc/fstab: $@\n" if $@; + return () if !defined $dev; + $dev = _canonical_dev ($dev); + return ($dev, $fses->{$dev}) if exists $fses->{$dev}; + # Otherwise return nothing. It's just a filesystem that we are + # ignoring, eg. swap. return (); } else { return ($_, $fses->{$_}) if exists $fses->{$_}; |