perls system wants to open /dev/tty which is not available in forked
workers. Use our run_command instead.

Signed-off-by: Thomas Lamprecht <[email protected]>
---
 data/PVE/Cluster.pm | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index b8dfe5e..7ff7bbf 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -11,7 +11,7 @@ use MIME::Base64;
 use Digest::SHA;
 use Digest::HMAC_SHA1;
 use Net::SSLeay;
-use PVE::Tools;
+use PVE::Tools qw(run_command);
 use PVE::INotify;
 use PVE::IPCC;
 use PVE::SafeSyslog;
@@ -1705,7 +1705,7 @@ sub assert_joinable {
        }
     };
 
-    if (!$param->{force}) {
+    if (!$force) {
 
        if (-f $authfile) {
            $error->("authentication key '$authfile' already exists", $force);
@@ -1720,7 +1720,7 @@ sub assert_joinable {
            $error->("this host already contains virtual guests", $force);
        }
 
-       if (system("corosync-quorumtool -l >/dev/null 2>&1") == 0) {
+       if (run_command(['corosync-quorumtool', '-l'], noerr => 1, quiet => 1) 
== 0) {
            $error->("corosync is already running, is this node already in a 
cluster?!", $force);
        }
     }
@@ -1791,15 +1791,14 @@ sub finish_join {
     PVE::Tools::file_set_contents($localclusterconf, $corosync_conf);
 
     print "stopping pve-cluster service\n";
-
-    system("umount $basedir -f >/dev/null 2>&1");
-    die "can't stop pve-cluster service\n" if system("systemctl stop 
pve-cluster") != 0;
+    my $cmd = ['systemctl', 'stop', 'pve-cluster'];
+    run_command($cmd, errmsg => "can't stop pve-cluster service");
 
     $backup_cfs_database->($dbfile);
     unlink $dbfile;
 
-    system("systemctl start pve-cluster") == 0 || die "starting pve-cluster 
failed\n";
-    system("systemctl start corosync");
+    $cmd = ['systemctl', 'start', 'corosync', 'pve-cluster'];
+    run_command($cmd, errmsg => "starting pve-cluster failed");
 
     # wait for quorum
     my $printqmsg = 1;
@@ -1821,9 +1820,8 @@ sub finish_join {
     print "merge known_hosts file\n";
     PVE::Cluster::ssh_merge_known_hosts($nodename, $local_ip_address, 1);
 
-    print "restart services\n";
-    # restart pvedaemon and pveproxy (changed certs)
-    system("systemctl restart pvedaemon pveproxy");
+    print "node certificate changed, restart pveproxy and pvedaemon 
services\n";
+    run_command(['systemctl', 'reload-or-restart', 'pvedaemon', 'pveproxy']);
 
     print "successfully added node '$nodename' to cluster.\n";
 }
-- 
2.11.0


_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to