From: Richard W.M. Jones Date: Wed, 24 Jun 2009 14:36:58 +0000 (+0100) Subject: Fix libvirt integration in virt-inspector. X-Git-Tag: 1.0.53~1 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=1f6bc26fc0967c6e4ae4a4514d9734288839c0fd Fix libvirt integration in virt-inspector. --- diff --git a/README b/README index 3dea215..e376cc7 100644 --- a/README +++ b/README @@ -73,6 +73,9 @@ bindings - (Optional) GHC if you want to build the Haskell bindings +- (Optional) Perl XML::XPath, Sys::Virt modules (for libvirt support +in virt-inspector). + Running ./configure will check you have all the requirements installed on your machine. diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl index 717ccb6..c645cbd 100755 --- a/inspector/virt-inspector.pl +++ b/inspector/virt-inspector.pl @@ -27,6 +27,8 @@ use File::Temp qw/tempdir/; # Optional: eval "use Sys::Virt;"; +eval "use XML::XPath;"; +eval "use XML::XPath::XMLParser;"; =encoding utf8 @@ -231,14 +233,9 @@ if (-e $ARGV[0]) { # Get the names of the image(s). my $xml = $dom->get_xml_description (); - my $p = new XML::XPath::XMLParser (xml => $xml); - my $disks = $p->find ("//devices/disk"); - print "disks:\n"; - foreach ($disks->get_nodelist) { - print XML::XPath::XMLParser::as_string($_); - } - - die "XXX" + my $p = XML::XPath->new (xml => $xml); + my @disks = $p->findnodes ('//devices/disk/source/@dev'); + @images = map { $_->getData } @disks; } # We've now got the list of @images, so feed them to libguestfs.