diff mbox series

[OSSTEST,09/82] host reuse: ms-planner: Do not show reuse as shared in the plan

Message ID 20201007180024.7932-10-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series Reuse test hosts | expand

Commit Message

Ian Jackson Oct. 7, 2020, 5:59 p.m. UTC
From: Ian Jackson <ian.jackson@eu.citrix.com>

If the number of shares is 1, do not show it as shared, and also
ignore the Unshare events.

This clarifies the display, especially when used with forthcoming test
host reuse work.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 ms-planner | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/ms-planner b/ms-planner
index d9f3db91..4e38e4e3 100755
--- a/ms-planner
+++ b/ms-planner
@@ -249,6 +249,7 @@  sub launder_check_plan () {
 			Avail => 1,
 			Info => $cshare->{Type},
 			PreviousShare => $cshare,
+                        Shares => $cshare->{Shares},
 		    };
 		    $cshare= undef;
 		}
@@ -678,6 +679,7 @@  sub cmd_show_html () {
 	foreach my $evt (@{ $plan->{Events}{$reso} }) {
 	    my $type= $evt->{Type};
 	    my $share= $evt->{Share};
+	    next if $type eq 'Unshare' && $evt->{Shares} == 1;
 	    my $show=
 		$type eq End ? ($evt->{Share} ? "End $evt->{Info}" : "") :
                 $type eq Unshare ? "$type [".showsharetype($evt->{Info})."]" :
@@ -686,7 +688,7 @@  sub cmd_show_html () {
 		(!$evt->{Allocated} ? Booking :
                  ($evt->{Allocated}{Live} ? Allocation : Completed).
                  " $evt->{Allocated}{Task}")." ".$evt->{Info};
-	    if ($share) {
+	    if ($share && $share->{Shares} != 1) {
 		$show .= sprintf(" [%s %d/%d %d]",
 				 showsharetype($share->{Type}),
 				 $share->{Shares} - $evt->{Avail},
@@ -789,7 +791,8 @@  sub cmd_show_html () {
                     $content->{Avail} ||
                     $content->{Type} eq After ||
                     ($content->{Allocated} && !$content->{Allocated}{Live});
-                my $shared = $content->{Share};
+                my $shared = $content->{Share}
+		          && $content->{Share}{Shares} != 1;
                 my $bgcolour=
                     $avail ?
                     ($shared ? "#ccccff" : "#ffffff") :