#ifndef CEPH_OSDMAP_H
#define CEPH_OSDMAP_H
-#include "include/cpp-btree/btree_map.h"
-
/*
* describe properties of the OSD cluster.
* disks, disk groups, total # osds,
#include <set>
#include <map>
#include "include/memory.h"
+#include "include/btree_map.h"
using namespace std;
// forward declaration
float get_nearfull_ratio() const {
return nearfull_ratio;
}
- void count_full_nearfull_osds(int *full, int *backfill, int *nearfull) const;
void get_full_osd_util(
const mempool::pgmap::unordered_map<int32_t,osd_stat_t> &osd_stat,
map<int, float> *full,
map<int, float> *backfill,
map<int, float> *nearfull) const;
-
+ void get_full_pools(CephContext *cct,
+ set<int64_t> *full,
+ set<int64_t> *backfillfull,
+ set<int64_t> *nearfull) const;
void get_full_osd_counts(set<int> *full, set<int> *backfill,
set<int> *nearfull) const;
*/
uint64_t get_up_osd_features() const;
+ void maybe_remove_pg_upmaps(CephContext *cct,
+ const OSDMap& osdmap,
+ Incremental *pending_inc);
+
int apply_incremental(const Incremental &inc);
/// try to re-use/reference addrs in oldmap from newmap
return p->get_size();
}
+ int get_pg_pool_crush_rule(pg_t pgid) const {
+ if (!pg_exists(pgid)) {
+ return -ENOENT;
+ }
+ const pg_pool_t *p = get_pg_pool(pgid.pool());
+ assert(p);
+ return p->get_crush_rule();
+ }
+
private:
/// pg -> (raw osd list)
void _pg_to_raw_osds(
mempool::osdmap::map<int64_t,pg_pool_t>& get_pools() {
return pools;
}
+ void get_pool_ids_by_rule(int rule_id, set<int64_t> *pool_ids) const {
+ assert(pool_ids);
+ for (auto &p: pools) {
+ if ((int)p.second.get_crush_rule() == rule_id) {
+ pool_ids->insert(p.first);
+ }
+ }
+ }
+ void get_pool_ids_by_osd(CephContext *cct,
+ int osd,
+ set<int64_t> *pool_ids) const;
const string& get_pool_name(int64_t p) const {
auto i = pool_name.find(p);
assert(i != pool_name.end());
const string& root,
ostream *ss);
- bool crush_ruleset_in_use(int ruleset) const;
+ bool crush_rule_in_use(int rule_id) const;
+
+ int validate_crush_rules(CrushWrapper *crush, ostream *ss) const;
void clear_temp() {
pg_temp->clear();