mirror of
https://github.com/ceph/ceph
synced 2025-03-04 23:40:07 +00:00
mon: require pgnum in 'ceph osd pool create <poolname> <pgnum> [<pgp_num>]' command
The default of 8 is virtually never the right answer. Require the initial pg count to be explicitly provided. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
cda9e516b8
commit
efa03cef5e
@ -236,7 +236,7 @@ Creates/deletes a snapshot of a pool. ::
|
||||
|
||||
Creates/deletes/renames a storage pool. ::
|
||||
|
||||
ceph osd pool create {pool-name} [pg_num [pgp_num]]
|
||||
ceph osd pool create {pool-name} pg_num [pgp_num]
|
||||
ceph osd pool delete {pool-name}
|
||||
ceph osd pool rename {old-name} {new-name}
|
||||
|
||||
|
@ -52,7 +52,7 @@ Create a Pool
|
||||
|
||||
To create a pool, execute::
|
||||
|
||||
ceph osd pool create {pool-name} [{pg-num}] [{pgp-num}]
|
||||
ceph osd pool create {pool-name} {pg-num} [{pgp-num}]
|
||||
|
||||
Where:
|
||||
|
||||
|
@ -61,8 +61,8 @@ By default, Ceph block devices use the ``rbd`` pool. You may use any available
|
||||
pool. We recommend creating a pool for Nova/Cinder and a pool for Glance. Ensure
|
||||
your Ceph cluster is running, then create the pools. ::
|
||||
|
||||
ceph osd pool create volumes
|
||||
ceph osd pool create images
|
||||
ceph osd pool create volumes 128
|
||||
ceph osd pool create images 128
|
||||
|
||||
See `Create a Pool`_ for detail on specifying the number of placement groups for
|
||||
your pools, and `Placement Groups`_ for details on the number of placement
|
||||
|
@ -51,7 +51,7 @@ sudo ls /sys/kernel/debug/ceph
|
||||
sudo ls /sys/kernel/debug/ceph/\* || true
|
||||
sudo bash -c 'ls /sys/kernel/debug/ceph/*' || true
|
||||
sudo bash -c 'cat /sys/kernel/debug/ceph/*/mdsmap' > temp
|
||||
ceph osd pool create newpool || true
|
||||
ceph osd pool create newpool 2 || true
|
||||
ceph mds add_data_pool 3 || true
|
||||
sudo bash -c 'cat /sys/kernel/debug/ceph/*/mdsmap' > temp2
|
||||
while diff -q temp2 temp
|
||||
|
@ -4,16 +4,14 @@ set -e
|
||||
|
||||
ceph osd pool create foo 123 123
|
||||
ceph osd pool create fooo 123
|
||||
ceph osd pool create foooo
|
||||
|
||||
ceph osd pool create foo # idempotent
|
||||
ceph osd pool create foo 123 # idempotent
|
||||
|
||||
ceph osd pool delete foo
|
||||
ceph osd pool delete foo
|
||||
ceph osd pool delete fuggg
|
||||
|
||||
ceph osd pool delete fooo
|
||||
ceph osd pool delete foooo
|
||||
|
||||
echo OK
|
||||
|
||||
|
@ -2561,27 +2561,30 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m->cmd[2] == "create" && m->cmd.size() >= 4) {
|
||||
else if (m->cmd[2] == "create" && m->cmd.size() >= 3) {
|
||||
if (m->cmd.size() < 5) {
|
||||
ss << "usage: osd pool create <poolname> <pg_num> [pgp_num]";
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
int pg_num = 0;
|
||||
int pgp_num = 0;
|
||||
if (m->cmd.size() > 4) { // try to parse out pg_num and pgp_num
|
||||
const char *start = m->cmd[4].c_str();
|
||||
char *end = (char*)start;
|
||||
pgp_num = pg_num = strtol(start, &end, 10);
|
||||
if (*end != '\0') { // failed to parse
|
||||
err = -EINVAL;
|
||||
ss << "usage: osd pool create <poolname> [pg_num [pgp_num]]";
|
||||
goto out;
|
||||
} else if (m->cmd.size() > 5) { // check for pgp_num too
|
||||
start = m->cmd[5].c_str();
|
||||
end = (char *)start;
|
||||
pgp_num = strtol(start, &end, 10);
|
||||
if (*end != '\0') { // failed to parse
|
||||
err = -EINVAL;
|
||||
ss << "usage: osd pool create <poolname> [pg_num [pgp_num]]";
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
const char *start = m->cmd[4].c_str();
|
||||
char *end = (char*)start;
|
||||
pgp_num = pg_num = strtol(start, &end, 10);
|
||||
if (*end != '\0') { // failed to parse
|
||||
err = -EINVAL;
|
||||
ss << "usage: osd pool create <poolname> <pg_num> [pgp_num]";
|
||||
goto out;
|
||||
} else if (m->cmd.size() > 5) { // check for pgp_num too
|
||||
start = m->cmd[5].c_str();
|
||||
end = (char *)start;
|
||||
pgp_num = strtol(start, &end, 10);
|
||||
if (*end != '\0') { // failed to parse
|
||||
err = -EINVAL;
|
||||
ss << "usage: osd pool create <poolname> <pg_num> [pgp_num]";
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (osdmap.name_pool.count(m->cmd[3])) {
|
||||
|
@ -53,7 +53,7 @@
|
||||
ceph osd blacklist rm <address>[:source_port]
|
||||
ceph osd pool mksnap <pool> <snapname>
|
||||
ceph osd pool rmsnap <pool> <snapname>
|
||||
ceph osd pool create <pool> [<pg_num> [<pgp_num>]]
|
||||
ceph osd pool create <pool> <pg_num> [<pgp_num>]
|
||||
ceph osd pool delete <pool>
|
||||
ceph osd pool rename <pool> <new pool name>
|
||||
ceph osd pool set <pool> <field> <value>
|
||||
|
@ -96,7 +96,7 @@ static void usage()
|
||||
cout << " ceph osd blacklist rm <address>[:source_port]\n";
|
||||
cout << " ceph osd pool mksnap <pool> <snapname>\n";
|
||||
cout << " ceph osd pool rmsnap <pool> <snapname>\n";
|
||||
cout << " ceph osd pool create <pool> [<pg_num> [<pgp_num>]]\n";
|
||||
cout << " ceph osd pool create <pool> <pg_num> [<pgp_num>]\n";
|
||||
cout << " ceph osd pool delete <pool>\n";
|
||||
cout << " ceph osd pool rename <pool> <new pool name>\n";
|
||||
cout << " ceph osd pool set <pool> <field> <value>\n";
|
||||
|
Loading…
Reference in New Issue
Block a user