]> git.proxmox.com Git - pmg-api.git/commitdiff
fix clustersync after node-deletion
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 18 Nov 2020 14:52:53 +0000 (15:52 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 18 Nov 2020 16:01:43 +0000 (17:01 +0100)
This patch creates the spoolsdirs for a newly joining clusternode on the
master (/var/spool/pmg/cluster/<newnode-cid>/(spam|attachment|virus).

This is necessary in order to prevent a failing cluster-sync for nodes, joining
the cluster after that node has been deleted. (This happens if you remove
a node from the cluster and directly rejoin it to the same masternode):

On the first sync after a node was deleted (there is no section config for a
number < maxcid) each node tries to sync the quarantine for the deleted node
from the cluster (in order to be promotable to new master). This rsync
fails because the spooldir for that node never got created on the master.

The spooldir for a node gets created on the master on the first sync of a node
which can be 2 minutes after joining the cluster (and leaving it again).

Reported via our enterprise support portal.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/API2/Cluster.pm

index ceda100993e722a7741cdd1cffd1add8b886662b..7eab761e008fa1b850ff35cfa3deca9230183f36 100644 (file)
@@ -302,6 +302,10 @@ __PACKAGE__->register_method({
                $next_cid = ++$master->{maxcid};
            }
 
+           # create spooldir for new node to prevent problems if it gets
+           # delete from the cluster before being synced initially
+           PMG::MailQueue::create_spooldirs($master->{maxcid});
+
            my $node = {
                type => 'node',
                cid => $master->{maxcid},