This is controlled by a new query method on power method objects. If
every power method says it is instananeous then we do not sleep.
This is going to be most useful when we introduce the new SSH
approach, which should not sleep for the power off time.
But we do it for guests (ie, L1 nested hosts) too.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
}
}
+sub instantaneous {
+ my ($mo) = @_;
+ return 1;
+}
+
1;
}
}
+sub instantaneous {
+ my ($mo) = @_;
+ return $mo->{Then}->instantaneous();
+}
+
1;
die "power switch request for $mo->{Host}{Name} ($on) not supported\n";
}
+sub instantaneous {
+ my ($mo) = @_;
+ return 0;
+}
+
1;
if (eval {
power_approach_invoke($ho, $approach, 0);
$setup->();
- power_cycle_sleep($ho);
+ my $need_sleep = 0;
+ foreach my $mo (@{ $approach->{MethObjs} }) {
+ next if $mo eq 'nest';
+ next if $mo->instantaneous();
+ $need_sleep = 1;
+ last;
+ }
+ power_cycle_sleep($ho) if $need_sleep;
power_approach_invoke($ho, $approach, 1);
$await->();
1;