[pve-devel] [PATCH 2/5] api2: node : startall : add force option

Alexandre Derumier aderumier at odiso.com
Thu Apr 10 17:12:56 CEST 2014


force start if onboot = 0

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Nodes.pm |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index e1db6ee..c3c8b35 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -976,6 +976,11 @@ __PACKAGE__->register_method ({
     	additionalProperties => 0,
 	properties => {
 	    node => get_standard_option('pve-node'),
+	    force => {
+		optional => 1,
+		type => 'boolean',
+		description => "force if onboot=0.",
+	    },
 	},
     },
     returns => {
@@ -990,6 +995,8 @@ __PACKAGE__->register_method ({
 	my $nodename = $param->{node};
 	$nodename = PVE::INotify::nodename() if $nodename eq 'localhost';
 
+	my $force = $param->{force};
+
 	my $code = sub {
 
 	    $rpcenv->{type} = 'priv'; # to start tasks in background
@@ -999,8 +1006,8 @@ __PACKAGE__->register_method ({
 		last if PVE::Cluster::check_cfs_quorum($i != 0 ? 1 : 0);
 		sleep(1);
 	    }
-	
-	    my $startList = &$get_start_stop_list($nodename, 1);
+	    my $autostart = $force ? undef : 1;
+	    my $startList = &$get_start_stop_list($nodename, $autostart);
 
 	    # Note: use numeric sorting with <=>
 	    foreach my $order (sort {$a <=> $b} keys %$startList) {
-- 
1.7.10.4




More information about the pve-devel mailing list