[pve-devel] [PATCH] check_vmid_unused message change

Alen Grizonic a.grizonic at proxmox.com
Tue Sep 22 16:10:50 CEST 2015


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

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 63780ac..880d91a 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -977,15 +977,22 @@ sub check_vmid_unused {
     my ($vmid, $noerr) = @_;
     
     my $vmlist = get_vmlist();
+    my $node = PVE::INotify::nodename();
+    my $msg = "$vmid already exists";
+    my $msg_cluster = "$msg on cluster node '$node'";
 
     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";
+    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