OnlyPreparing => 1,
Shares => $shares->{shares},
Type => $sharing->{sharetype},
+ Wear => $sharing->{wear},
};
}
};
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;
};
}
+ 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.