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

[Xen-devel] [OSSTEST PATCH 02/21] selecthost: Honour new $none_ok optional parameter



No functional change with existing callers.

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

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index ec867e4f..38c17d60 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1125,9 +1125,9 @@ sub power_state ($$;$) {
 
 #---------- host selection and properties ----------
 
-sub selecthost ($);
-sub selecthost ($) {
-    my ($ident) = @_;
+sub selecthost ($;$);
+sub selecthost ($;$) {
+    my ($ident, $none_ok) = @_;
     # must be run outside transaction
 
     # $ident is <identspec>
@@ -1154,7 +1154,10 @@ sub selecthost ($) {
         $r{$ident}= $name;
     } else {
         $name= $r{$ident};
-        die "no specified $ident" unless defined $name;
+       if (!defined $name) {
+           return undef if $none_ok;
+           die "no specified $ident";
+       }
     }
 
     my $ho= {
-- 
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®.