Skip to content

Commit f42d7db

Browse files
authored
Merge pull request ceph#65586 from dang/wip-dang-posix-cleanup
RGW - POSIXDriver - Cleanup vstart Reviewed-by: Casey Bodley <[email protected]>
2 parents de83b6b + 64e7e3a commit f42d7db

File tree

3 files changed

+40
-27
lines changed

3 files changed

+40
-27
lines changed

src/common/options/rgw.yaml.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4124,6 +4124,13 @@ options:
41244124
default: /tmp/rgw_posix_driver
41254125
services:
41264126
- rgw
4127+
- name: rgw_posix_userdb_dir
4128+
type: str
4129+
level: advanced
4130+
desc: path for the directory for storing the User db
4131+
default: /var/lib/ceph/radosgw
4132+
services:
4133+
- rgw
41274134
- name: rgw_posix_database_root
41284135
type: str
41294136
level: advanced

src/rgw/driver/posix/rgw_sal_posix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ class POSIXDriver : public StoreDriver {
481481
POSIXDriver(CephContext *_cct) : StoreDriver(), cct(_cct), zone(this)
482482
{
483483
const static std::string tenant = "default_ns";
484-
const auto& db_path = g_conf().get_val<std::string>("dbstore_db_dir");
484+
const auto& db_path = g_conf().get_val<std::string>("rgw_posix_userdb_dir");
485485
const auto& db_name = g_conf().get_val<std::string>("dbstore_db_name_prefix") + "-" + tenant;
486486
auto db_full_path = std::filesystem::path(db_path) / db_name;
487487

src/vstart.sh

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -796,26 +796,6 @@ done
796796

797797
}
798798

799-
do_rgw_dbstore_conf() {
800-
if [ $CEPH_NUM_RGW -gt 1 ]; then
801-
echo "dbstore is not distributed so only works with CEPH_NUM_RGW=1"
802-
exit 1
803-
fi
804-
805-
if [ "$new" -eq 1 ]; then
806-
prun rm -rf "$CEPH_DEV_DIR/rgw/dbstore"
807-
fi
808-
809-
prun mkdir -p "$CEPH_DEV_DIR/rgw/dbstore"
810-
wconf <<EOF
811-
rgw backend store = dbstore
812-
rgw config store = dbstore
813-
dbstore db dir = $CEPH_DEV_DIR/rgw/dbstore
814-
dbstore_config_uri = file://$CEPH_DEV_DIR/rgw/dbstore/config.db
815-
816-
EOF
817-
}
818-
819799
format_conf() {
820800
local opts=$1
821801
local indent=" "
@@ -982,22 +962,48 @@ $CCLIENTDEBUG
982962
; rgw lc debug interval = 10
983963
$(format_conf "${extra_conf}")
984964
EOF
985-
#if [ "$rgw_store" == "dbstore" ] ; then
986-
#do_rgw_dbstore_conf
965+
if [ "$rgw_store" == "dbstore" ] ; then
966+
if [ $CEPH_NUM_RGW -gt 1 ]; then
967+
echo "dbstore is not distributed so only works with CEPH_NUM_RGW=1"
968+
exit 1
969+
fi
970+
971+
if [ "$new" -eq 1 ]; then
972+
prun rm -rf "$CEPH_DEV_DIR/rgw/dbstore"
973+
fi
974+
975+
prun mkdir -p "$CEPH_DEV_DIR/rgw/dbstore"
976+
wconf <<EOF
977+
rgw backend store = dbstore
978+
rgw config store = dbstore
979+
dbstore db dir = $CEPH_DEV_DIR/rgw/dbstore
980+
dbstore_config_uri = file://$CEPH_DEV_DIR/rgw/dbstore/config.db
981+
982+
EOF
983+
fi
987984
if [ "$rgw_store" == "posix" ] ; then
988985
# use dbstore as the backend and posix as the filter
989-
do_rgw_dbstore_conf
990986
posix_dir="$CEPH_DEV_DIR/rgw/posix"
991-
prun mkdir -p $posix_dir/root $posix_dir/lmdb
987+
if [ "$new" -eq 1 ]; then
988+
prun rm -rf "$posix_dir/root"
989+
prun rm -rf "$posix_dir/lmdb"
990+
prun rm -rf "$posix_dir/userdb"
991+
prun rm -rf "$CEPH_DEV_DIR/rgw/dbstore/config.db"
992+
fi
993+
994+
prun mkdir -p $posix_dir/root $posix_dir/lmdb $posix_dir/userdb "$CEPH_DEV_DIR/rgw/dbstore"
992995
wconf <<EOF
993996
rgw backend store = posix
997+
rgw config store = dbstore
998+
dbstore_config_uri = file://$CEPH_DEV_DIR/rgw/dbstore/config.db
994999
rgw posix base path = $posix_dir/root
1000+
rgw posix userdb dir = $posix_dir/userdb
9951001
rgw posix database root = $posix_dir/lmdb
9961002
9971003
EOF
9981004
fi
999-
do_rgw_conf
1000-
wconf << EOF
1005+
do_rgw_conf
1006+
wconf << EOF
10011007
[mds]
10021008
$CMDSDEBUG
10031009
$DAEMONOPTS

0 commit comments

Comments
 (0)