Skip to contentSkip to conversation

Support diverse-CLASS hostflag

PATCH New Ian Jackson 1 participant 9 messages Jul 6, 2016

lore
Share & tools
lore
#0 lore raw

cover Support diverse-CLASS hostflag

Here is a quick series for osstest which provides support for a new kind of hostflag diverse-CLASS. The host allocator will not consider any host for such an allocation, which has been allocated for any other such allocation (with the same CLASS) in the same flight.

This is going to be useful because we want to run several identical XTF test jobs but run each one on a different host (since there is probably little value on running two jobs on the same host in the same flight).

Some of the state has to be threaded through the planner daemon. Without the planner daemon patches, the projection will be wrong, slightly messing up planning estimates etc., but the actual allocations will, I think, be right.

It is fine to run the new host allocator against an old planner daemon (even a production one), at least for testing.

These patches can be found in my personal xenbits repo
xenbits.xen.org:/home/iwj/ext/osstest.git base.diverse-class.v1 .. wip.diverse-class.v1

These three

[OSSTEST PATCH 1/8] Tcl: Use tclsh8.5
[OSSTEST PATCH 2/8] ms-flights-summary: Remove spurious \ in keys \%{ [OSSTEST PATCH 3/8] mg-schema-test-database: Direct logs to local

are preparatory patches which are probably going to be helpful if someone wants to test the new planner (as I did, using the test database facility).

Then there is the meat:

[OSSTEST PATCH 4/8] ms-planner: Support ClientNotes [OSSTEST PATCH 5/8] ts-hosts-allocate-Executive: Replace some odd [OSSTEST PATCH 6/8] ts-hosts-allocate-Executive: pass $plan to [OSSTEST PATCH 7/8] ts-hosts-allocate-Executive: Support

And one helpful test script:

[OSSTEST PATCH 8/8] DO NOT APPLY make-flight-diverse-test: test case

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw

PATCH 1/8 Tcl: Use tclsh8.5

I have checked that tclsh8.5 and TclX work on osstest.test-lab (and also osstest.xs.citrite.net). TclX seems to be provided by tcl8.4 but work with tcl8.5 (at least on wheezy and jessie).

---
 README            | 2 +-
 ms-ownerdaemon    | 2 +-
 ms-queuedaemon    | 2 +-
 ms-reportuptime   | 2 +-
 sg-execute-flight | 2 +-
 sg-run-job        | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
README +1 -1
index 0a346dc..3aa35d2 100644
@@ -246,7 +246,7 @@ To run osstest in standalone mode:
 
  - You need to install
      sqlite3
-     tcl8.4 tclx8.4 libsqlite3-tcl
+     tcl8.5 tclx8.4 libsqlite3-tcl
      libdbi-perl libdbd-sqlite3-perl
      pax rsync
      curl
ms-ownerdaemon +1 -1
index 33ee238..5b52339 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/tclsh8.4
+#!/usr/bin/tclsh8.5
 # -*- Tcl -*- 
 # usage: ./ms-ownerdaemon  ... | logger
 
ms-queuedaemon +1 -1
index 2b8d621..8affacc 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/tclsh8.4
+#!/usr/bin/tclsh8.5
 # -*- Tcl -*- 
 # usage: ./ms-queuedaemon  ... | logger
 
ms-reportuptime +1 -1
index aeac483..fe72b78 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/tclsh8.4
+#!/usr/bin/tclsh8.5
 # -*- Tcl -*- 
 # usage: ./ms-reportuptime
 
sg-execute-flight +1 -1
index 4e3fcf2..27fc04c 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/tclsh8.4
+#!/usr/bin/tclsh8.5
 # -*- Tcl -*- 
 # usage: ./sg-execute-flight FLIGHT BLESSING
 
sg-run-job +1 -1
index 8b2d5e1..920834a 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/tclsh8.4
+#!/usr/bin/tclsh8.5
 
 # This is part of "osstest", an automated testing framework for Xen.
 # Copyright (C) 2009-2013 Citrix Inc.
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH 2/8 ms-flights-summary: Remove spurious \ in keys \%{ something }

In reply to Ian Jackson

With some versions of Perl this generates a warning which causes ms-flights-summary to fail.

---
 ms-flights-summary | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ms-flights-summary +1 -1
index ea72088..c703d81 100755
@@ -359,7 +359,7 @@ printf("<p>%d flight(s) consisting of %s job(s)<br />%s<br />%s anonymous/rogue
 
 my %summarycounts;
 foreach my $fi (values %flights) {
-    $summarycounts{$_} += $fi->{Stats}{$_} foreach (keys \%{ $fi->{Stats} });
+    $summarycounts{$_} += $fi->{Stats}{$_} foreach (keys %{ $fi->{Stats} });
 }
 my @summarycounts = sort_stats \%summarycounts;
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw

PATCH 3/8 mg-schema-test-database: Direct logs to local directory

In reply to Ian Jackson

Do not pollute a shared log area with logs of flights whose numbers are valid only in the context of our test database.

---
 mg-schema-test-database | 8 ++++++++
 1 file changed, 8 insertions(+)
mg-schema-test-database +8 -0
index 4e0ee68..88a75cf 100755
@@ -338,6 +338,14 @@ QueueDaemonPort ${ctrlports#*,}
 ExecutiveDbOwningRoleRegexp .*
 QueueDaemonHoldoff 3
 QueueDaemonRetry 5
+Logs $PWD/logs
+Stash $PWD/logs
+Results $PWD/results
+Publish=undef
+LogsPublish=undef
+ResultsPublish=undef
+HarnessPublishGitUserHost=undef
+HarnessPublishGitRepoDir=undef
 END
 	mv -f $tcfg.tmp $tcfg
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

PATCH 4/8 ms-planner: Support ClientNotes

In reply to Ian Jackson

No users yet.

---
 README.planner | 22 ++++++++++++++++++++++
 ms-planner     | 23 +++++++++++++++++++++++
 2 files changed, 45 insertions(+)
README.planner +22 -0
index daccef5..80c2506 100644
@@ -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)
ms-planner +23 -0
index abf5fac..bce6e13 100755
@@ -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();
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#5 lore raw

PATCH 5/8 ts-hosts-allocate-Executive: Replace some odd commas with semicolons

In reply to Ian Jackson

There does not seem to be any reason for this. I think it must be a leftover from a previous use of { A => X, B => Y, ... } syntax.

---
 ts-hosts-allocate-Executive | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ts-hosts-allocate-Executive +2 -2
index 13a0652..69f1cf6 100755
@@ -709,8 +709,8 @@ sub compute_booking_list () {
 	$book->{Job}= "$flight.$job";
 	$book->{Reso}= "$sel->{restype} $sel->{resname}";
 	$book->{Xinfo}= $hid->{Ident};
-	$book->{Start}= $best->{Start},
-	$book->{End}= $best->{Start} + $best->{Duration},
+	$book->{Start}= $best->{Start};
+	$book->{End}= $best->{Start} + $best->{Duration};
 	push @bookings, $book;
     }
     return { Bookings => \@bookings };
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#6 lore raw

PATCH 6/8 ts-hosts-allocate-Executive: pass $plan to hid_find_possibilities

In reply to Ian Jackson

We are going to want this to implement the new diverse-CLASS hostflag.

---
 ts-hosts-allocate-Executive | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
ts-hosts-allocate-Executive +3 -3
index 69f1cf6..d4a96d5 100755
@@ -272,8 +272,8 @@ sub compute_hids () {
     }
 }
 
-sub hid_find_possibilities ($) {
-    my ($hid) = @_;
+sub hid_find_possibilities ($$) {
+    my ($hid, $plan) = @_;
 
     delete $hid->{Candidates};
 
@@ -647,7 +647,7 @@ sub attempt_allocation {
 
     foreach my $hid (@hids) {
 	delete $hid->{Allocated};
-	hid_find_possibilities($hid);
+	hid_find_possibilities($hid, $plan);
     }
     optimally_order_hids();
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#7 lore raw

PATCH 7/8 ts-hosts-allocate-Executive: Support diverse-CLASS hostflag

In reply to Ian Jackson

Specifically:
* Parse it out of the hostflags when constructing the hid
* Look for the `hostalloc-diverse-FLIGHT-CLASS' ClientNote in the resource plan, to avoid inappropriately planning to reuse hosts.
* Look for the `diversehosts_CLASS' runvar in other jobs in this flight, to find out who might have allocated with the same CLASS. (This sort of duplicates information in *hostflags and *host, but digging the information out of the latter two would be very tiresome.)
* Check each of the above for each candidate host.
* Set the ClientNote when we are preparing a booking.
* Set the runvar when we do the allocation.
* Document the ClientNote.

---
 README.planner              |  3 +++
 ts-hosts-allocate-Executive | 59 +++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 60 insertions(+), 2 deletions(-)
README.planner +3 -0
index 80c2506..bb18432 100644
@@ -335,3 +335,6 @@ Note key name (key in ClientNotes):
 	Note value format:
 
 (none yet defined)
+
+hostalloc-diverse-<flight>-<class>
+	{ <hostname> => 'info for debug', ... }
ts-hosts-allocate-Executive +57 -2

105 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#8 lore raw

PATCH 8/8 DO NOT APPLY make-flight-diverse-test: test case for diverse-CLASS hostflag

In reply to Ian Jackson

This generates a flight with two jobs, test-1 and test-2. They can be run, and are supposed to allocate different hosts, and will bomb out after host allocation.

---
 make-flight-diverse-test | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100755 make-flight-diverse-test
make-flight-diverse-test new file +11 -0
new file mode 100755
index 0000000..dffd23b
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+flight=`./cs-flight-create play xen-unstable`
+
+for j in test-1 test-2; do
+    ./cs-job-create $flight $j test-debian \
+        all_hostflags="blessed-adhoc,diverse-d"
+done
+
+echo $flight
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel