vstart.sh: only skip fs volume create when there's no mgr to run it

The mgr volumes module handles fs volume ls/create, not the monitor, so
without a mgr (CEPH_NUM_MGR=0) the "wait for volume module to load" loop
spun forever. Open-coding fs new unconditionally, my first attempt,
changed pool creation for every vstart user and dropped the wait, so
cephfs tests calling `fs volume ...` right after vstart.sh returns could
race a module still mid-load.

create_fs_volume() branches on CEPH_NUM_MGR instead. With a mgr it still
calls fs volume ls/create. Without one it runs the plain mon commands fs
volume create wraps: osd pool create cephfs.<name>.{meta,data}, then fs
new <name> <meta> <data>. The wait stays at its one call site above the
per-filesystem loop, so it runs once regardless of CEPH_NUM_FS, not once
per filesystem.

Verified against a local vstart: mgr present, fs volume ls polls once
then creates CEPH_NUM_FS=2 filesystems with no repeated poll;
CEPH_NUM_MGR=0, no poll, fs new creates 'a' directly, HEALTH_OK.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
This commit is contained in:
Kefu Chai 2026-07-02 13:48:38 +08:00
parent 3b9dfd04eb
commit bb9c1fde9f

View File

@ -1482,6 +1482,19 @@ EOF
fi
}
create_fs_volume() {
local name=$1
if [ "$CEPH_NUM_MGR" -gt 0 ]; then
ceph_adm fs volume create ${name}
else
local meta_pool="cephfs.${name}.meta"
local data_pool="cephfs.${name}.data"
ceph_adm osd pool create "$meta_pool"
ceph_adm osd pool create "$data_pool" --bulk
ceph_adm fs new ${name} "$meta_pool" "$data_pool"
fi
}
start_mds() {
local mds=0
for name in a b c d e f g h i j k l m n o p
@ -1532,12 +1545,15 @@ EOF
ceph_adm fs flag set enable_multiple true --yes-i-really-mean-it
fi
# wait for volume module to load
while ! ceph_adm fs volume ls ; do sleep 1 ; done
if [ "$CEPH_NUM_MGR" -gt 0 ]; then
# wait for volume module to load
while ! ceph_adm fs volume ls ; do sleep 1 ; done
fi
local fs=0
for name in a b c d e f g h i j k l m n o p
do
ceph_adm fs volume create ${name}
create_fs_volume ${name}
ceph_adm fs authorize ${name} "client.fs_${name}" / rwp >> "$keyring_fn"
fs=$(($fs + 1))
[ $fs -eq $CEPH_NUM_FS ] && break