git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix detection of optional libvirt support in virt-inspector.
[libguestfs.git]
/
inspector
/
virt-inspector.pl
diff --git
a/inspector/virt-inspector.pl
b/inspector/virt-inspector.pl
index
717ccb6
..
6aa63ad
100755
(executable)
--- a/
inspector/virt-inspector.pl
+++ b/
inspector/virt-inspector.pl
@@
-27,6
+27,8
@@
use File::Temp qw/tempdir/;
# Optional:
eval "use Sys::Virt;";
# Optional:
eval "use Sys::Virt;";
+eval "use XML::XPath;";
+eval "use XML::XPath::XMLParser;";
=encoding utf8
=encoding utf8
@@
-204,8
+206,10
@@
if (-e $ARGV[0]) {
}
}
} else {
}
}
} else {
- die "no libvirt support (install Sys::Virt)"
- unless exists $INC{"Sys/Virt.pm"};
+ die "virt-inspector: no libvirt support (install Sys::Virt, XML::XPath and XML::XPath::XMLParser)\n"
+ unless exists $INC{"Sys/Virt.pm"} &&
+ exists $INC{"XML/XPath.pm"} &&
+ exists $INC{"XML/XPath/XMLParser.pm"};
pod2usage ("$0: too many domains listed on command line") if @ARGV > 1;
pod2usage ("$0: too many domains listed on command line") if @ARGV > 1;
@@
-231,14
+235,9
@@
if (-e $ARGV[0]) {
# Get the names of the image(s).
my $xml = $dom->get_xml_description ();
# 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.
}
# We've now got the list of @images, so feed them to libguestfs.