mirror of
https://github.com/ceph/ceph
synced 2025-02-20 17:37:29 +00:00
Merge PR #23529 into master
* refs/pull/23529/head: mon: fix idempotent FS creation Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: João Eduardo Luís <joao@suse.de>
This commit is contained in:
commit
dbaa32b412
@ -105,19 +105,6 @@ class FsNewHandler : public FileSystemCommandHandler
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
string force_str;
|
||||
cmd_getval_throws(g_ceph_context,cmdmap, "force", force_str);
|
||||
bool force = (force_str == "--force");
|
||||
const pool_stat_t *stat = mon->mgrstatmon()->get_pool_stat(metadata);
|
||||
if (stat) {
|
||||
int64_t metadata_num_objects = stat->stats.sum.num_objects;
|
||||
if (!force && metadata_num_objects > 0) {
|
||||
ss << "pool '" << metadata_name
|
||||
<< "' already contains some objects. Use an empty pool instead.";
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
string data_name;
|
||||
cmd_getval_throws(g_ceph_context, cmdmap, "data", data_name);
|
||||
int64_t data = mon->osdmon()->osdmap.lookup_pg_pool_name(data_name);
|
||||
@ -152,6 +139,19 @@ class FsNewHandler : public FileSystemCommandHandler
|
||||
}
|
||||
}
|
||||
|
||||
string force_str;
|
||||
cmd_getval_throws(g_ceph_context,cmdmap, "force", force_str);
|
||||
bool force = (force_str == "--force");
|
||||
const pool_stat_t *stat = mon->mgrstatmon()->get_pool_stat(metadata);
|
||||
if (stat) {
|
||||
int64_t metadata_num_objects = stat->stats.sum.num_objects;
|
||||
if (!force && metadata_num_objects > 0) {
|
||||
ss << "pool '" << metadata_name
|
||||
<< "' already contains some objects. Use an empty pool instead.";
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (fsmap.filesystem_count() > 0
|
||||
&& !fsmap.get_enable_multiple()) {
|
||||
ss << "Creation of multiple filesystems is disabled. To enable "
|
||||
|
Loading…
Reference in New Issue
Block a user