mirror of
https://github.com/ceph/ceph
synced 2025-04-04 23:42:13 +00:00
mon: make 'mon {add,remove}_data_pool ...' take pool name or id
Take either a pool name or an id. Fix up the tests accordingly. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
fea1e0e56c
commit
e2602c549f
@ -147,7 +147,9 @@ ceph mds newfs 0 1 --yes-i-really-mean-it
|
|||||||
ceph osd pool create data2 10
|
ceph osd pool create data2 10
|
||||||
poolnum=$(ceph osd dump | grep 'pool.*data2' | awk '{print $2;}')
|
poolnum=$(ceph osd dump | grep 'pool.*data2' | awk '{print $2;}')
|
||||||
ceph mds add_data_pool $poolnum
|
ceph mds add_data_pool $poolnum
|
||||||
|
ceph mds add_data_pool rbd
|
||||||
ceph mds remove_data_pool $poolnum
|
ceph mds remove_data_pool $poolnum
|
||||||
|
ceph mds remove_data_pool rbd
|
||||||
ceph osd pool delete data2 data2 --yes-i-really-really-mean-it
|
ceph osd pool delete data2 data2 --yes-i-really-really-mean-it
|
||||||
ceph mds set_max_mds 4
|
ceph mds set_max_mds 4
|
||||||
ceph mds set_max_mds 3
|
ceph mds set_max_mds 3
|
||||||
|
@ -4,10 +4,12 @@ set -e
|
|||||||
|
|
||||||
touch foo.$$
|
touch foo.$$
|
||||||
rados mkpool foo.$$
|
rados mkpool foo.$$
|
||||||
poolid=$(ceph osd dump | grep "^pool" | awk '{print $2}' | tail -n 1)
|
ceph mds add_data_pool foo.$$
|
||||||
ceph mds add_data_pool ${poolid}
|
|
||||||
setfattr -n ceph.file.layout.pool -v foo.$$ foo.$$
|
setfattr -n ceph.file.layout.pool -v foo.$$ foo.$$
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
rados rmpool foo.$$ foo.$$ --yes-i-really-really-mean-it
|
|
||||||
rm foo.$$
|
rm foo.$$
|
||||||
|
ceph mds remove_data_pool foo.$$
|
||||||
|
rados rmpool foo.$$ foo.$$ --yes-i-really-really-mean-it
|
||||||
|
|
||||||
|
echo OK
|
||||||
|
@ -951,21 +951,44 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (prefix == "mds add_data_pool") {
|
} else if (prefix == "mds add_data_pool") {
|
||||||
int64_t poolid;
|
string poolname;
|
||||||
cmd_getval(g_ceph_context, cmdmap, "poolid", poolid);
|
cmd_getval(g_ceph_context, cmdmap, "pool", poolname);
|
||||||
|
int64_t poolid = mon->osdmon()->osdmap.lookup_pg_pool_name(poolname);
|
||||||
|
if (poolid < 0) {
|
||||||
|
string err;
|
||||||
|
poolid = strict_strtol(poolname.c_str(), 10, &err);
|
||||||
|
if (err.length()) {
|
||||||
|
r = -ENOENT;
|
||||||
|
poolid = -1;
|
||||||
|
ss << "pool '" << poolname << "' does not exist";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (poolid >= 0) {
|
||||||
pending_mdsmap.add_data_pool(poolid);
|
pending_mdsmap.add_data_pool(poolid);
|
||||||
ss << "added data pool " << poolid << " to mdsmap";
|
ss << "added data pool " << poolid << " to mdsmap";
|
||||||
r = 0;
|
r = 0;
|
||||||
|
}
|
||||||
} else if (prefix == "mds remove_data_pool") {
|
} else if (prefix == "mds remove_data_pool") {
|
||||||
int64_t poolid;
|
string poolname;
|
||||||
|
cmd_getval(g_ceph_context, cmdmap, "pool", poolname);
|
||||||
|
int64_t poolid = mon->osdmon()->osdmap.lookup_pg_pool_name(poolname);
|
||||||
|
if (poolid < 0) {
|
||||||
|
string err;
|
||||||
|
poolid = strict_strtol(poolname.c_str(), 10, &err);
|
||||||
|
if (err.length()) {
|
||||||
|
r = -ENOENT;
|
||||||
|
poolid = -1;
|
||||||
|
ss << "pool '" << poolname << "' does not exist";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (poolid >= 0) {
|
||||||
cmd_getval(g_ceph_context, cmdmap, "poolid", poolid);
|
cmd_getval(g_ceph_context, cmdmap, "poolid", poolid);
|
||||||
r = pending_mdsmap.remove_data_pool(poolid);
|
r = pending_mdsmap.remove_data_pool(poolid);
|
||||||
if (r == -ENOENT)
|
if (r == -ENOENT)
|
||||||
r = 0;
|
r = 0;
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
ss << "removed data pool " << poolid << " from mdsmap";
|
ss << "removed data pool " << poolid << " from mdsmap";
|
||||||
|
}
|
||||||
} else if (prefix == "mds newfs") {
|
} else if (prefix == "mds newfs") {
|
||||||
MDSMap newmap;
|
MDSMap newmap;
|
||||||
int64_t metadata, data;
|
int64_t metadata, data;
|
||||||
|
@ -284,11 +284,11 @@ COMMAND("mds unset " \
|
|||||||
"name=sure,type=CephString,req=false", \
|
"name=sure,type=CephString,req=false", \
|
||||||
"unset <key>", "mds", "w", "cli,rest")
|
"unset <key>", "mds", "w", "cli,rest")
|
||||||
COMMAND("mds add_data_pool " \
|
COMMAND("mds add_data_pool " \
|
||||||
"name=poolid,type=CephInt,range=0", \
|
"name=pool,type=CephString", \
|
||||||
"add data pool <poolid>", "mds", "rw", "cli,rest")
|
"add data pool <pool>", "mds", "rw", "cli,rest")
|
||||||
COMMAND("mds remove_data_pool " \
|
COMMAND("mds remove_data_pool " \
|
||||||
"name=poolid,type=CephInt,range=0", \
|
"name=pool,type=CephString", \
|
||||||
"remove data pool <poolid>", "mds", "rw", "cli,rest")
|
"remove data pool <pool>", "mds", "rw", "cli,rest")
|
||||||
COMMAND("mds newfs " \
|
COMMAND("mds newfs " \
|
||||||
"name=metadata,type=CephInt,range=0 " \
|
"name=metadata,type=CephInt,range=0 " \
|
||||||
"name=data,type=CephInt,range=0 " \
|
"name=data,type=CephInt,range=0 " \
|
||||||
|
Loading…
Reference in New Issue
Block a user