MDSMonitor: promote standby after fs creation

This avoids unnecessary health warnings. However, the original issue in i23885
still exists because the standbys are not available at fs creation time. If you
create a new file system after these standbys are available, then you will
observe that the promotion works to silence the warnings.

Fixes: http://tracker.ceph.com/issues/23885

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2018-05-04 10:11:10 -07:00
parent ad75128c8e
commit 93bc8c53ef
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
4 changed files with 24 additions and 8 deletions

View File

@ -226,9 +226,8 @@ void FSMap::print_summary(Formatter *f, ostream *out) const
}
void FSMap::create_filesystem(std::string_view name,
int64_t metadata_pool, int64_t data_pool,
uint64_t features)
std::shared_ptr<Filesystem> FSMap::create_filesystem(std::string_view name,
int64_t metadata_pool, int64_t data_pool, uint64_t features)
{
auto fs = std::make_shared<Filesystem>();
fs->mds_map.epoch = epoch;
@ -258,6 +257,8 @@ void FSMap::create_filesystem(std::string_view name,
if (filesystems.size() == 1) {
legacy_client_fscid = fs->fscid;
}
return fs;
}
void FSMap::reset_filesystem(fs_cluster_id_t fscid)

View File

@ -306,9 +306,9 @@ public:
* Caller must already have validated all arguments vs. the existing
* FSMap and OSDMap contents.
*/
void create_filesystem(std::string_view name,
int64_t metadata_pool, int64_t data_pool,
uint64_t features);
std::shared_ptr<Filesystem> create_filesystem(
std::string_view name, int64_t metadata_pool,
int64_t data_pool, uint64_t features);
/**
* Remove the filesystem (it must exist). Caller should already

View File

@ -202,9 +202,23 @@ class FsNewHandler : public FileSystemCommandHandler
mon->osdmon()->propose_pending();
// All checks passed, go ahead and create.
fsmap.create_filesystem(fs_name, metadata, data,
mon->get_quorum_con_features());
auto fs = fsmap.create_filesystem(fs_name, metadata, data,
mon->get_quorum_con_features());
ss << "new fs with metadata pool " << metadata << " and data pool " << data;
// assign a standby to rank 0 to avoid health warnings
std::string _name;
mds_gid_t gid = fsmap.find_replacement_for({fs->fscid, 0}, _name,
g_conf->mon_force_standby_active);
if (gid != MDS_GID_NONE) {
const auto &info = fsmap.get_info_gid(gid);
mon->clog->info() << info.human_name() << " assigned to filesystem "
<< fs_name << " as rank 0";
fsmap.promote(gid, fs, 0);
}
return 0;
}

View File

@ -771,6 +771,7 @@ EOF
if [ $new -eq 1 ]; then
if [ "$CEPH_NUM_FS" -gt "0" ] ; then
sleep 5 # time for MDS to come up as standby to avoid health warnings on fs creation
if [ "$CEPH_NUM_FS" -gt "1" ] ; then
ceph_adm fs flag set enable_multiple true --yes-i-really-mean-it
fi