summaryrefslogtreecommitdiffstats
path: root/perl
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-07-13 18:06:10 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-07-13 18:06:10 +0100
commit4e444d5c09d78b0d292d95d1f97de12f26cc139d (patch)
tree3d9a263ea6b6f688f3c9ab53d90fbb5b41d0b6f6 /perl
parent7d41d75c1d4e6dbe61f6cd353bc104663340483f (diff)
downloadlibguestfs-4e444d5c09d78b0d292d95d1f97de12f26cc139d.tar.gz
libguestfs-4e444d5c09d78b0d292d95d1f97de12f26cc139d.tar.xz
libguestfs-4e444d5c09d78b0d292d95d1f97de12f26cc139d.zip
Ignore old-style initrd which is a compressed ext2 filesystem.
'cpio' chokes on these, taking ages to decide that they are not cpio files, and producing masses of messages. This was causing virt-inspector to be very slow (many minutes) on RHEL 3 guests. With this fix, speed is back to normal.
Diffstat (limited to 'perl')
-rw-r--r--perl/lib/Sys/Guestfs/Lib.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 27a7b9ee..d5dfb4ea 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -1208,14 +1208,20 @@ sub _check_for_initrd
my $version = $1;
my @modules;
- eval {
- @modules = $g->initrd_list ("/boot/$initrd");
- };
- unless ($@) {
- @modules = grep { m,([^/]+)\.ko$, || m,([^/]+)\.o$, } @modules;
- $initrd_modules{$version} = \@modules
- } else {
- warn "/boot/$initrd: could not read initrd format"
+ # Disregard old-style compressed ext2 files, since cpio
+ # takes ages to (fail to) process these.
+ if ($g->file ("/boot/$initrd") !~ /gzip compressed/ ||
+ $g->zfile ("gzip", "/boot/$initrd") !~ /ext2 filesystem/) {
+ eval {
+ @modules = $g->initrd_list ("/boot/$initrd");
+ };
+ unless ($@) {
+ @modules = grep { m,([^/]+)\.ko$, || m,([^/]+)\.o$, }
+ @modules;
+ $initrd_modules{$version} = \@modules
+ } else {
+ warn "/boot/$initrd: could not read initrd format";
+ }
}
}
}