]> git.proxmox.com Git - pve-cluster.git/blobdiff - src/PVE/CLI/pvecm.pm
pvecm: updatecerts: improve variable naming
[pve-cluster.git] / src / PVE / CLI / pvecm.pm
index 2678165316c44b3857eb6a0232744a1b4ac9eaa9..e995e80f2ec304c612185bee912aa6d32c590f37 100755 (executable)
@@ -6,6 +6,8 @@ use warnings;
 use Cwd qw(getcwd);
 use File::Path;
 use File::Basename;
+use Time::HiRes qw(usleep);
+
 use PVE::Tools qw(run_command);
 use PVE::Cluster;
 use PVE::INotify;
@@ -570,12 +572,20 @@ __PACKAGE__->register_method ({
     returns => { type => 'null' },
     code => sub {
        my ($param) = @_;
+       my ($force_new_cert, $silent) = $param->@{qw(force silent)};
 
        # we get called by the pveproxy.service ExecStartPre and as we do
        # IO (on /etc/pve) which can hang (uninterruptedly D state). That'd be
        # no-good for ExecStartPre as it fails the whole service in this case
        PVE::Tools::run_fork_with_timeout(30, sub {
-           PVE::Cluster::Setup::updatecerts_and_ssh($param->@{qw(force silent)});
+           PVE::Cluster::Setup::generate_local_files();
+
+           for (my $i = 0; !PVE::Cluster::check_cfs_quorum(1); $i++) {
+               print "waiting for pmxcfs mount to appear and get quorate...\n" if $i % 50 == 0;
+               usleep(100 * 1000);
+           }
+
+           PVE::Cluster::Setup::updatecerts_and_ssh($force_new_cert, $silent);
            PVE::Cluster::prepare_observed_file_basedirs();
        });