[pve-devel] [PATCH v2] check_vmid_unused message change

Alen Grizonic a.grizonic at proxmox.com
Tue Sep 22 16:21:36 CEST 2015


changed message if vmid used on a different cluster node
---
 data/PVE/Cluster.pm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 63780ac..5860ed9 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -977,15 +977,23 @@ sub check_vmid_unused {
     my ($vmid, $noerr) = @_;
     
     my $vmlist = get_vmlist();
+    my $node = PVE::INotify::nodename();
 
     my $d = $vmlist->{ids}->{$vmid};
     return 1 if !defined($d);
     
     return undef if $noerr;
 
-    die "VM $vmid already exists\n" if $d->{type} eq 'qemu';
-    
-    die "CT $vmid already exists\n";
+    my $msg = "$vmid already exists";
+    my $msg_cluster = "$msg on cluster node '$d->{node}'";
+
+    if ($d->{node} eq $node) {
+	die "VM $msg\n" if $d->{type} eq 'qemu';
+	die "CT $msg\n";
+    } else {
+        die "VM $msg_cluster\n" if $d->{type} eq 'qemu';
+        die "CT $msg_cluster\n";
+    }
 }
 
 sub check_node_exists {
-- 
2.1.4





More information about the pve-devel mailing list