[pve-devel] r6433 - in pve-cluster/trunk: data data/PVE debian

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Aug 8 11:52:23 CEST 2011


Author: dietmar
Date: 2011-08-08 11:52:23 +0200 (Mon, 08 Aug 2011)
New Revision: 6433

Modified:
   pve-cluster/trunk/data/ChangeLog
   pve-cluster/trunk/data/PVE/pvecert
   pve-cluster/trunk/data/PVE/pvecm
   pve-cluster/trunk/debian/init.d
Log:
	(create): Wait for quorum and restart apache2 



Modified: pve-cluster/trunk/data/ChangeLog
===================================================================
--- pve-cluster/trunk/data/ChangeLog	2011-08-08 09:22:30 UTC (rev 6432)
+++ pve-cluster/trunk/data/ChangeLog	2011-08-08 09:52:23 UTC (rev 6433)
@@ -1,7 +1,9 @@
 2011-08-08  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/pvecm: try to create all files/dirs in 'addnode', because that
-	node has quorum. (create) Add id_rsa.pub to authorized_keys.
+	node has quorum. 
+	(create): Add id_rsa.pub to authorized_keys.
+	(create): Wait for quorum and restart apache2 
 
 	* src/cfs-plug-func.c (cfs_plug_func_new): add write callback (to
 	trigger actions).

Modified: pve-cluster/trunk/data/PVE/pvecert
===================================================================
--- pve-cluster/trunk/data/PVE/pvecert	2011-08-08 09:22:30 UTC (rev 6432)
+++ pve-cluster/trunk/data/PVE/pvecert	2011-08-08 09:52:23 UTC (rev 6433)
@@ -10,15 +10,17 @@
 die "please run as root\n" if $> != 0;
 
 my $opt_force;
+my $opt_silent; # supress error if we do not have quorum
 
-if (!GetOptions ('force' => \$opt_force)) {
-    print STDERR "Usage: pvecert [--force]\n";
+if (!GetOptions ('force' => \$opt_force, 'silent' => \$opt_silent)) {
+    print STDERR "Usage: pvecert [--force] [--silent]\n";
     exit (-1);
 }
 
+exit (0) if $opt_silent && !PVE::Cluster::check_cfs_quorum();
+
 my $nodename = PVE::INotify::nodename();
 my $ip = PVE::Cluster::remote_node_ip($nodename);
-
 PVE::Cluster::gen_pve_node_files($nodename, $ip, $opt_force);
 
 exit (0);

Modified: pve-cluster/trunk/data/PVE/pvecm
===================================================================
--- pve-cluster/trunk/data/PVE/pvecm	2011-08-08 09:22:30 UTC (rev 6432)
+++ pve-cluster/trunk/data/PVE/pvecm	2011-08-08 09:52:23 UTC (rev 6433)
@@ -499,6 +499,22 @@
 		die "starting pve-cluster failed\n";
 
 	    system("/etc/init.d/cman start");
+
+	    # wait for quorum
+	    my $printqmsg = 1;
+	    while (!PVE::Cluster::check_cfs_quorum()) {
+		if ($printqmsg) {
+		    print "waiting for quorum...";
+		    STDOUT->flush();
+		    $printqmsg = 0;
+		}
+		sleep(1);
+	    }
+	    print "OK\n";
+	    # restart apache (changed certs)
+	    system("/etc/init.d/apache2 restart");
+
+	    print "successfully added node '$nodename' to cluster.\n";
 	};
 	my $err = $@;
 

Modified: pve-cluster/trunk/debian/init.d
===================================================================
--- pve-cluster/trunk/debian/init.d	2011-08-08 09:22:30 UTC (rev 6432)
+++ pve-cluster/trunk/debian/init.d	2011-08-08 09:52:23 UTC (rev 6433)
@@ -81,9 +81,12 @@
         fi
 	errcode=0
         start_server || errcode=$?
-	# try to create required directories
+	# try to create required directories. This only works
+	# for a single node setup, because we have no quorum
+	# in a cluster setup. But this doesn't matter, because the 
+	# cluster manager creates all needed files (pvecm)
 	if [ $errcode -eq 0 ] ; then
-	    /usr/bin/pvecert || true
+	    /usr/bin/pvecert --silent || true
 	fi
         log_end_msg $errcode
 	;;




More information about the pve-devel mailing list