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

[Xen-devel] [OSSTEST PATCH 01/15] TestSupport: target_var: Refactor to allow for another host case



Make an explicit list of the prefixes and a loop to walk over them.
No functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index ec867e4f..fcbde0a2 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -2471,10 +2471,18 @@ sub target_var_prefix ($) {
 
 sub target_var ($$) {
     my ($ho,$vn) = @_;
-    my $pfx = target_var_prefix($ho);
-    my $allthing = exists $ho->{Guest} ? "guest" : "host";
-    return $r{ $pfx. $vn } //
-           $r{ "all_${allthing}_${vn}" };
+    my @prefixes;
+    push @prefixes, target_var_prefix($ho);
+    if (exists $ho->{Guest}) {
+       push @prefixes, 'all_guest_';
+    } else {
+       push @prefixes, 'all_host_';
+    }
+    foreach my $prefix (@prefixes) {
+       my $v = $r{ $prefix.$vn };
+       return $v if defined $v;
+    }
+    return undef;
 }
 
 sub target_kernkind_check ($) {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.