X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=perl%2Flib%2FSys%2FGuestfs%2FLib.pm;h=d5dfb4eaf500ef0805a2dd7ebdc08f6ff0f6e2e2;hb=4e444d5c09d78b0d292d95d1f97de12f26cc139d;hp=4ab75258ff4afd70c65afe704696b2e573cfd14c;hpb=b2f01ebcbeed5bc0c954f80283baf7b5ba52256e;p=libguestfs.git diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index 4ab7525..d5dfb4e 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -175,6 +175,9 @@ 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; } @@ -1205,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"; + } } } }