X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=perl%2Flib%2FSys%2FGuestfs%2FLib.pm;h=d5dfb4eaf500ef0805a2dd7ebdc08f6ff0f6e2e2;hb=4e444d5c09d78b0d292d95d1f97de12f26cc139d;hp=44c4d565fb2b42bd7d9d3cd8f3efbf178f52b557;hpb=2105fabddfdcecca68e20285808b4d8bbe133227;p=libguestfs.git diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index 44c4d56..d5dfb4e 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -174,6 +174,10 @@ sub open_guest my $p = XML::XPath->new (xml => $xml); my @disks = $p->findnodes ('//devices/disk/source/@dev'); + push (@disks, $p->findnodes ('//devices/disk/source/@file')); + + die "$images[0] seems to have no disk devices\n" unless @disks; + @images = map { $_->getData } @disks; } @@ -1204,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"; + } } } }