[pve-devel] r5537 - in pve-cluster/trunk/data: . perl

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Feb 16 06:33:32 CET 2011


Author: dietmar
Date: 2011-02-16 06:33:31 +0100 (Wed, 16 Feb 2011)
New Revision: 5537

Modified:
   pve-cluster/trunk/data/ChangeLog
   pve-cluster/trunk/data/perl/pvecert
   pve-cluster/trunk/data/perl/pvecm
Log:
	* perl/pvecm: do not use PVE::RPCEnvironment
	(add): refuse to join cluster if there are existing vms.



Modified: pve-cluster/trunk/data/ChangeLog
===================================================================
--- pve-cluster/trunk/data/ChangeLog	2011-02-15 13:17:35 UTC (rev 5536)
+++ pve-cluster/trunk/data/ChangeLog	2011-02-16 05:33:31 UTC (rev 5537)
@@ -1,3 +1,10 @@
+2011-02-16  Proxmox Support Team  <support at proxmox.com>
+
+	* perl/pvecm: do not use PVE::RPCEnvironment
+	(add): refuse to join cluster if there are existing vms.
+
+	* perl/pvecert: do not use PVE::RPCEnvironment
+
 2011-02-15  Proxmox Support Team  <support at proxmox.com>
 
 	* perl/Cluster.pm (cfs_file_version): A way to get the actual

Modified: pve-cluster/trunk/data/perl/pvecert
===================================================================
--- pve-cluster/trunk/data/perl/pvecert	2011-02-15 13:17:35 UTC (rev 5536)
+++ pve-cluster/trunk/data/perl/pvecert	2011-02-16 05:33:31 UTC (rev 5537)
@@ -3,21 +3,12 @@
 use strict;
 use PVE::Cluster;
 use Getopt::Long;
-use PVE::RPCEnvironment;
-use PVE::INotify qw(read_file);
+use PVE::INotify;
 
 $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
 
 die "please run as root\n" if $> != 0;
 
-PVE::INotify::inotify_init();
-
-my $rpcenv = PVE::RPCEnvironment->init('cli');
-
-$rpcenv->set_language($ENV{LANG});
-
-$rpcenv->set_user('root'); 
-
 my $nodename = PVE::INotify::nodename();
 
 my $opt_force;

Modified: pve-cluster/trunk/data/perl/pvecm
===================================================================
--- pve-cluster/trunk/data/perl/pvecm	2011-02-15 13:17:35 UTC (rev 5536)
+++ pve-cluster/trunk/data/perl/pvecm	2011-02-16 05:33:31 UTC (rev 5537)
@@ -9,10 +9,8 @@
 use Data::Dumper; # fixme: remove 
 use PVE::Tools;
 use PVE::Cluster;
+use PVE::INotify;
 
-use PVE::INotify qw(read_file);
-use PVE::RPCEnvironment;
-
 use PVE::CLIHandler;
 
 use base qw(PVE::CLIHandler);
@@ -21,14 +19,6 @@
 
 die "please run as root\n" if $> != 0;
 
-PVE::INotify::inotify_init();
-
-my $rpcenv = PVE::RPCEnvironment->init('cli');
-
-$rpcenv->set_language($ENV{LANG});
-
-$rpcenv->set_user('root'); 
-
 my $nodename = PVE::INotify::nodename();
 
 my $basedir = "/etc/pve";
@@ -443,7 +433,7 @@
 	my $host = $param->{hostname};
 
 	if (!$param->{force}) {
-
+	    
 	    if (-f $authfile) {
 		die "authentication key already exists\n";
 	    }
@@ -452,11 +442,10 @@
 		die "cluster config '$clusterconf' already exists\n";
 	    }
 
-	    # fixme: abort if there are already VMs
-	    #my $vmlist = read_file('vmlist');
-	    #if (scalar(keys %$vmlist)) {
-	    #die "this host already contains virtual machines - please remove the first\n";
-	    #}
+	    my $vmlist = PVE::Cluster::get_vmlist();
+	    if ($vmlist && $vmlist->{ids} && scalar(keys %{$vmlist->{ids}})) {
+		die "this host already contains virtual machines - please remove the first\n";
+	    }
 
 	    if (system("cman_tool status >/dev/null 2>&1") == 0) {
 		die "cman is already running\n";
@@ -647,6 +636,8 @@
 
 setup_ssh_keys();
 
+PVE::Cluster::cfs_update();
+
 PVE::CLIHandler::handle_cmd($cmddef, "pvecm", $cmd, \@ARGV);
 
 exit 0;



More information about the pve-devel mailing list