[PATCH tck 4/5] Ensure uri_transport is defined before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Under some environments (such as Xen), there may not be a uri_transport
defined. As this is not required, ensure the value is defined before
attempting to use it


---
 lib/Sys/Virt/TCK/Capabilities.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/Sys/Virt/TCK/Capabilities.pm b/lib/Sys/Virt/TCK/Capabilities.pm
index 8b79db4..281f41e 100644
--- a/lib/Sys/Virt/TCK/Capabilities.pm
+++ b/lib/Sys/Virt/TCK/Capabilities.pm
@@ -115,8 +115,10 @@ sub _parse_host_migration {
 
     $mig->{transports} = [];
     my $trans = $node->first_child("uri_transports");
-    foreach my $child ($trans->children("uri_transport")) {
-	push @{$mig->{transports}}, $child->text;
+    if (defined $trans) {
+	foreach my $child ($trans->children("uri_transport")) {
+	    push @{$mig->{transports}}, $child->text;
+	}
     }
 
     $self->{host}->{migration} = $mig;
-- 
1.8.4.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]