From 1f6bc26fc0967c6e4ae4a4514d9734288839c0fd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 24 Jun 2009 15:36:58 +0100 Subject: [PATCH] Fix libvirt integration in virt-inspector. --- README | 3 +++ inspector/virt-inspector.pl | 13 +++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) 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. -- 1.8.3.1