[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 4/8] ms-planner: Support ClientNotes
No users yet. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> --- README.planner | 22 ++++++++++++++++++++++ ms-planner | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/README.planner b/README.planner index daccef5..80c2506 100644 --- a/README.planner +++ b/README.planner @@ -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) diff --git a/ms-planner b/ms-planner index abf5fac..bce6e13 100755 --- a/ms-planner +++ b/ms-planner @@ -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(); } -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |