The documentation states that startall only starts guests with
onboot=1 by default, and that this behavior can be overridden using the
force parameter. However, when startall is invoked via the pvenode CLI
without the force parameter, the Bulk Start task silently completes with
just "TASK OK", giving no indication of why certain VMs were not started.
The added informational message addresses this by clearly communicating
to users why those VMs were skipped.

Signed-off-by: Michael Köppl <[email protected]>
---
I encountered this while using startall and stopall myself and while
RTFM would indeed have helped, I still felt that an informational
message would improve the user's experience, especially since stopall
will stop all VMs without force=1, whereas startall requires the force
param. I only added the informational messages and did not change any
behavior because the behavior makes sense to me after thinking about
it some more.

 PVE/API2/Nodes.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 5bd6fe492..3faa1e800 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1969,7 +1969,12 @@ sub get_start_stop_list {
     my $resList = {};
     foreach my $vmid (keys %$vmlist) {
         my $conf = $vmlist->{$vmid}->{conf};
-        next if $autostart && !$conf->{onboot};
+
+        if ($autostart && !$conf->{onboot}) {
+            print
+                "skipping $vmid because 'onboot' is not set in guest config, 
use 'force' parameter to override\n";
+            next;
+        }
 
         my $startup =
             $conf->{startup} ? 
PVE::JSONSchema::pve_parse_startup_order($conf->{startup}) : {};
-- 
2.47.3




Reply via email to