]> git.proxmox.com Git - pve-manager.git/commitdiff
ceph install: improve ceph install checks during installation
authorAaron Lauterer <a.lauterer@proxmox.com>
Mon, 4 Oct 2021 08:02:25 +0000 (10:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 5 Oct 2021 05:42:57 +0000 (07:42 +0200)
Adding a flag file during the Ceph installation helps to cover the time
span in which the binary is already present but the installation not yet
done.

The most noticeable effect is that the 'Next' button in the GUI will
only become active once the installation is actually finished and not
earlier.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
PVE/CLI/pveceph.pm
PVE/Ceph/Tools.pm

index 356af282ea075718045b3e17ea734eecaa1a0a70..6d77f6ad6ed535cabf8d9e369c570f63000d20fc 100755 (executable)
@@ -177,7 +177,16 @@ __PACKAGE__->register_method ({
        );
 
        print "start installation\n";
+
+       # the install flag helps to determine when apt is done installing
+       my $install_flag_file = '/run/ceph-install-flag';
+       open(my $install_flag, '>', "${install_flag_file}") or
+            die "could not open Ceph installation flag - $!\n";
+       close $install_flag;
+
        if (system(@apt_install, @ceph_packages) != 0) {
+           unlink $install_flag_file or
+               warn "Could not remove Ceph installation flag - $!";
            die "apt failed during ceph installation ($?)\n";
        }
 
@@ -188,6 +197,9 @@ __PACKAGE__->register_method ({
            'systemctl', 'try-reload-or-restart', 'pvedaemon.service', 'pveproxy.service'
        ]);
 
+       unlink $install_flag_file or
+           warn "Could not remove Ceph installation flag - $!";
+
        return undef;
     }});
 
index f54d837aaf322722304bf90d5f49b52114b4620b..3f0818fdb094dfd67ca902e3ec6586579e43d00f 100644 (file)
@@ -155,7 +155,9 @@ sub check_ceph_installed {
 
     $service = 'ceph_bin' if !defined($service);
 
-    if (! -x $ceph_service->{$service}) {
+    # the flag file is checked as on a new installation, the binary gets
+    # extracted by dpkg before the installation is finished
+    if (! -x $ceph_service->{$service} || -f '/run/ceph-install-flag') {
        die "binary not installed: $ceph_service->{$service}\n" if !$noerr;
        return undef;
     }