]> xenbits.xensource.com Git - osstest.git/commitdiff
host allocation: *_shared_mark_ready: allow alternative $oldtypes
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 27 Oct 2017 17:23:41 +0000 (18:23 +0100)
committerIan Jackson <iwj@xenproject.org>
Fri, 2 Oct 2020 15:49:13 +0000 (16:49 +0100)
$oldtype may now be a hashref, where keys mapping to truthy values are
permitted for the sharetype precondition.

No functional change for existing callers.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Osstest/Executive.pm

index fd975590e9b7e25b5c3389c65ba211f98282cfc8..f2d434646106a90430973570aa97cbe26ae3c376 100644 (file)
@@ -1056,6 +1056,7 @@ sub executive_resource_shared_mark_ready ($$$;$$) {
 
     my $oldshr;
     $oldstate //= 'prep';
+    $oldstate = { $oldstate => 1 } unless ref $oldstate;
     $newstate //= 'ready';
 
     my $what= "resource $restype $resname";
@@ -1070,8 +1071,9 @@ sub executive_resource_shared_mark_ready ($$$;$$) {
         if (defined $oldshr) {
             die "$what shared $oldshr->{Type} not $sharetype"
                 unless !defined $sharetype or $oldshr->{Type} eq $sharetype;
-            die "$what shared state $oldshr->{State} not $oldstate"
-                unless $oldshr->{State} eq $oldstate;
+            die "$what shared state $oldshr->{State} not".
+               " one of ".(join ' ', sort keys %$oldstate)
+                unless $oldstate->{ $oldshr->{State} };
             my $nrows= $dbh_tests->do(<<END,{}, $newstate, $restype,$resname);
                 UPDATE resource_sharing
                    SET state=?