@@ -286,6 +286,13 @@ Plan is:
Live
Job flight.job which made the allocation
+ ClientNotes
+ map from note key
+ to one of
+ scalar
+ array of values supplied by clients
+ hash of keys/values supplied by clients
+
* = internal to plan
** = computed by launder_check_plan
+ = as shown to clients
@@ -302,6 +309,12 @@ Booking list is:
Share optional struct containing
Type
Shares
+ [ClientNotes]
+ as for Plan; merged by
+ for scalar, updating from Booking if specified
+ for array, appending Booking to Plan
+ for hash, updating individual values from Booking
+ type must not have changed!
Sharing resources:
@@ -313,3 +326,12 @@ Bookings which do not create the share do not mention the master.
Note that whether a resource is free, or simply nonexistent, is not
represented.
+
+
+Note keys
+---------
+
+Note key name (key in ClientNotes):
+ Note value format:
+
+(none yet defined)
@@ -245,6 +245,7 @@ sub cmd_reset () {
$plan->{Start}= time;
$plan->{Events}= { };
$plan->{Unprocessed}= [ ];
+ $plan->{ClientNotes}= { };
my %magictask;
foreach my $taskrefkey (qw(preparing shared)) {
@@ -415,6 +416,9 @@ sub cmd_get_plan () {
}
$jplan->{Events}{$reso}= \@jevts;
}
+
+ $jplan->{ClientNotes} = $plan->{ClientNotes};
+
print to_json($jplan),"\n" or die $!;
}
@@ -529,6 +533,25 @@ sub cmd_book_resources () {
);
}
+ my $jnotes = $jbookings->{ClientNotes} // { };
+ foreach my $k (sort keys %$jnotes) {
+ my $v = $jnotes->{$k};
+ my $newt = ref $v // '(none)';
+ if (exists $plan->{ClientNotes}{$k}) {
+ my $oldt = ref $plan->{ClientNotes}{$k} // '(none)';
+ die "$k $oldt -> $newt" unless $oldt eq $newt;
+ }
+ if (!ref $v) {
+ $plan->{ClientNotes}{$k} = $v;
+ } elsif (ref $v eq 'HASH') {
+ $plan->{ClientNotes}{$k}{$_} = $v->{$_} foreach keys %$v;
+ } elsif (ref $v eq 'ARRAY') {
+ push @{ $plan->{ClientNotes}{$_} }, @{ $jnotes->{$_} };
+ } else {
+ die "$k $newt";
+ }
+ }
+
check_write_new_plan();
}
No users yet. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> --- README.planner | 22 ++++++++++++++++++++++ ms-planner | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+)