[pve-devel] [PATCH manager v2 1/2] startall: refactor and fix error message

Dominik Csapak d.csapak at proxmox.com
Wed Jun 27 10:44:54 CEST 2018


for vms, it showed:
Starting VM 100 failed: status

instead of showing the actual status

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* moved the typeText assignment above, where we already check the type
 PVE/API2/Nodes.pm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 2db5e1ec..9dd90e17 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1533,12 +1533,15 @@ __PACKAGE__->register_method ({
 		    eval {
 			my $default_delay = 0;
 			my $upid;
+			my $typeText = '';
 
 			if ($d->{type} eq 'lxc') {
+			    $typeText = 'CT';
 			    return if PVE::LXC::check_running($vmid);
 			    print STDERR "Starting CT $vmid\n";
 			    $upid = PVE::API2::LXC::Status->vm_start({node => $nodename, vmid => $vmid });
 			} elsif ($d->{type} eq 'qemu') {
+			    $typeText = 'VM';
 			    $default_delay = 3; # to reduce load
 			    return if PVE::QemuServer::check_running($vmid, 1);
 			    print STDERR "Starting VM $vmid\n";
@@ -1563,11 +1566,7 @@ __PACKAGE__->register_method ({
 				}
 			    }
 			} else {
-			    if ($d->{type} eq 'lxc') {
-				print STDERR "Starting CT $vmid failed: $status\n";
-			    } elsif ($d->{type} eq 'qemu') {
-				print STDERR "Starting VM $vmid failed: status\n";
-			    }
+			    print STDERR "Starting $typeText $vmid failed: $status\n";
 			}
 		    };
 		    warn $@ if $@;
-- 
2.11.0





More information about the pve-devel mailing list