public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Kefu Chai <k.chai@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH v2 manager 1/1] ceph: mds: reimplement hotstandby via ceph fs set allow_standby_replay
Date: Mon, 29 Jun 2026 12:30:05 +0800	[thread overview]
Message-ID: <20260629043005.1663891-2-k.chai@proxmox.com> (raw)
In-Reply-To: <20260629043005.1663891-1-k.chai@proxmox.com>

PVE was writing two per-MDS config options into ceph.conf on every MDS
creation:

  [mds.<id>]
  mds_standby_for_name = pve
  mds_standby_replay = true   (when hotstandby=1)

Neither exists in Ceph Squid or Tentacle; both are absent from
src/common/options/mds.yaml.in and silently ignored.

mds_standby_for_name = 'pve' was always wrong: the PVE default
filesystem name is 'cephfs', not 'pve' (FS.pm: $fs_name =
$param->{name} // 'cephfs'), so the option always pointed at a
nonexistent filesystem. The option is a no-op in modern Ceph regardless.

mds_standby_replay was the old per-daemon standby replay knob. The
feature still exists in Squid/Tentacle but moved to a per-filesystem
setting: 'ceph fs set <fsname> allow_standby_replay true'. So the old
key has had no effect since Squid.

Fix:
- Drop the unconditional mds_standby_for_name write.
- When 'hotstandby' is set, call 'ceph fs set <filesystem>
  allow_standby_replay true' instead. A new optional 'filesystem'
  parameter (defaults to 'cephfs') names the target filesystem.
- If the mon command fails, warn and continue: the MDS can serve as a
  standby regardless, and standby replay can be enabled later.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
---
 PVE/API2/Ceph/MDS.pm | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/PVE/API2/Ceph/MDS.pm b/PVE/API2/Ceph/MDS.pm
index 31b6fb7e..9025802b 100644
--- a/PVE/API2/Ceph/MDS.pm
+++ b/PVE/API2/Ceph/MDS.pm
@@ -151,8 +151,18 @@ __PACKAGE__->register_method({
                 optional => 1,
                 default => 0,
                 description =>
-                    "Determines whether a ceph-mds daemon should poll and replay the log of an active MDS. "
-                    . "Faster switch on MDS failure, but needs more idle resources.",
+                    "Use together with 'filesystem' to enable standby-replay "
+                    . "for the given CephFS. Keeps a standby MDS replaying the "
+                    . "active MDS journal for faster failover.",
+            },
+            filesystem => {
+                type => 'string',
+                optional => 1,
+                default => 'cephfs',
+                pattern => qr|^[^:/\s]+$|,
+                description =>
+                    "The name of the CephFS filesystem to enable standby replay "
+                    . "for when 'hotstandby' is set. Defaults to 'cephfs'.",
             },
         },
     },
@@ -194,11 +204,6 @@ __PACKAGE__->register_method({
             }
 
             $cfg->{$section}->{host} = $nodename;
-            $cfg->{$section}->{'mds_standby_for_name'} = 'pve';
-
-            if ($param->{hotstandby}) {
-                $cfg->{$section}->{'mds_standby_replay'} = 'true';
-            }
 
             cfs_write_file('ceph.conf', $cfg);
 
@@ -214,6 +219,26 @@ __PACKAGE__->register_method({
 
                 die "$err\n";
             }
+
+            if ($param->{hotstandby}) {
+                my $fs_name = $param->{filesystem} // 'cephfs';
+                print "Enabling standby replay for filesystem '$fs_name'...\n";
+                eval {
+                    $rados->mon_command({
+                        prefix => 'fs set',
+                        fs_name => $fs_name,
+                        var => 'allow_standby_replay',
+                        val => 'true',
+                        format => 'plain',
+                    });
+                };
+                if (my $err = $@) {
+                    chomp $err;
+                    warn "Could not enable standby replay for '$fs_name': $err\n"
+                        . "Run 'ceph fs set $fs_name allow_standby_replay true'"
+                        . " manually once the filesystem exists.\n";
+                }
+            }
         };
 
         return $rpcenv->fork_worker('cephcreatemds', "mds.$mds_id", $authuser, $worker);
-- 
2.47.3





      reply	other threads:[~2026-06-29  4:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  4:30 [PATCH v2 manager 0/1] ceph: mds: reimplement hotstandby via ceph fs set allow_standby_replay Kefu Chai
2026-06-29  4:30 ` Kefu Chai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260629043005.1663891-2-k.chai@proxmox.com \
    --to=k.chai@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal