Merge PR #21888 into mimic

* refs/pull/21888/head:
	MDSMonitor: promote standby after fs creation
	MDSMonitor: always prints standbys even if no fs
This commit is contained in:
Patrick Donnelly 2018-05-08 09:07:40 -07:00
commit a9b136dc77
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
4 changed files with 24 additions and 9 deletions

View File

@ -93,7 +93,6 @@ void FSMap::print(ostream& out) const
if (filesystems.empty()) {
out << "No filesystems configured" << std::endl;
return;
}
for (const auto &fs : filesystems) {
@ -227,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;
@ -259,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