]> git.proxmox.com Git - pve-manager.git/commitdiff
startall: refactor and fix error message
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 27 Jun 2018 08:44:54 +0000 (10:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Jun 2018 08:52:10 +0000 (10:52 +0200)
for vms, it showed:
Starting VM 100 failed: status

instead of showing the actual status

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/API2/Nodes.pm

index 2db5e1ec7b9b6cbeb5b38869ec9c2e8eec8018f0..9dd90e175994d70a3b036eeba0f05990e9558348 100644 (file)
@@ -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 $@;