[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 3/3] ms-planner: Including Unshare event for previous sharing state
Arrange for the initial plan to contain an Unshare event for resources which are unallocated, but currently recorded as shared (ie, they might be ready for reuse). Specifically, we need to: * Include the Wear in the information for a host with no unallocatable shares (since the consumers might want to reuse the current state). * When processing the allocations in cmd_reset, look for sharing entries (ie, things we found allocated by magic/shared, and made a note in %currentshare) that didn't have any corresponding allocations of shares. Generate an Unshare event for them. * When we find an Unshare event in the plan, we used to remove it. Now we keep it if it's the first thing in the plan. (For subsequent entries callers don't generally need it because they can find the sharing info from previous events.) When it is the first thing in the plan, we do some checks on it. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- ms-planner | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/ms-planner b/ms-planner index 5d20cc2..2b8b6c2 100755 --- a/ms-planner +++ b/ms-planner @@ -151,6 +151,7 @@ END OnlyPreparing => 1, Shares => $shares->{shares}, Type => $sharing->{sharetype}, + Wear => $sharing->{wear}, }; } @@ -185,8 +186,21 @@ sub launder_check_plan () { }; my $type= $evt->{Type}; - next if $type eq Unshare; - + if ($type eq Unshare) { + if (!@evts) { + # record inherited sharing info + $bad->('unshare not in past') + unless $evt->{Time} <= $plan->{Start}; + $bad->('unshare avail') + unless $evt->{Avail} == 1; + my $eshare = $evt->{PreviousShare}; + $eshare->{$_} // $bad->("unshare $_") + foreach qw(Type Wear Shares); + push @evts, $evt; + } + next; + } + push @evts, $evt; $bad->('type') unless $type eq Start || $type eq End; @@ -394,6 +408,22 @@ END }; } + foreach my $reskey (keys %currentshare) { + my $cshare = $currentshare{$reskey}; + next if $plan->{Events}{$reskey}; + print DEBUG "document existing quiescent sharing $reskey". + " share.Type $cshare->{Type}\n"; + my $evt = { + Time => $plan->{Start}, + Type => Unshare, + Avail => 1, + Info => 'recently shared $cshare->{Type}', + PreviousShare => { %$cshare }, + }; + delete $evt->{PreviousShare}{OnlyPreparing}; + push @{ $plan->{Events}{$reskey} }, $evt; + } + # Now everything in the plan is good except that we # need to sort the lists and compute Avails, which is done by # check_write_new_plan. -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |