Duplicate host in osd/state and osd/stats, take PGs from /config/pgs.items
parent
5084ff7c6c
commit
c2c2eefea4
1
osd.h
1
osd.h
|
@ -235,6 +235,7 @@ class osd_t
|
||||||
int etcd_watches_initialised = 0;
|
int etcd_watches_initialised = 0;
|
||||||
uint64_t etcd_watch_revision = 0;
|
uint64_t etcd_watch_revision = 0;
|
||||||
websocket_t *etcd_watch_ws = NULL;
|
websocket_t *etcd_watch_ws = NULL;
|
||||||
|
json11::Json self_state;
|
||||||
std::map<osd_num_t, json11::Json> peer_states;
|
std::map<osd_num_t, json11::Json> peer_states;
|
||||||
std::map<osd_num_t, osd_wanted_peer_t> wanted_peers;
|
std::map<osd_num_t, osd_wanted_peer_t> wanted_peers;
|
||||||
bool loading_peer_config = false;
|
bool loading_peer_config = false;
|
||||||
|
|
|
@ -154,6 +154,7 @@ json11::Json osd_t::get_statistics()
|
||||||
st["size"] = bs->get_block_count() * bs->get_block_size();
|
st["size"] = bs->get_block_count() * bs->get_block_size();
|
||||||
st["free"] = bs->get_free_block_count() * bs->get_block_size();
|
st["free"] = bs->get_free_block_count() * bs->get_block_size();
|
||||||
}
|
}
|
||||||
|
st["host"] = self_state["host"];
|
||||||
// FIXME: handle integer overflow
|
// FIXME: handle integer overflow
|
||||||
json11::Json::object op_stats, subop_stats;
|
json11::Json::object op_stats, subop_stats;
|
||||||
for (int i = 0; i <= OSD_OP_MAX; i++)
|
for (int i = 0; i <= OSD_OP_MAX; i++)
|
||||||
|
@ -419,6 +420,7 @@ void osd_t::acquire_lease()
|
||||||
void osd_t::create_osd_state()
|
void osd_t::create_osd_state()
|
||||||
{
|
{
|
||||||
std::string state_key = base64_encode(etcd_prefix+"/osd/state/"+std::to_string(osd_num));
|
std::string state_key = base64_encode(etcd_prefix+"/osd/state/"+std::to_string(osd_num));
|
||||||
|
self_state = get_osd_state();
|
||||||
etcd_txn(json11::Json::object {
|
etcd_txn(json11::Json::object {
|
||||||
// Check that the state key does not exist
|
// Check that the state key does not exist
|
||||||
{ "compare", json11::Json::array {
|
{ "compare", json11::Json::array {
|
||||||
|
@ -432,7 +434,7 @@ void osd_t::create_osd_state()
|
||||||
json11::Json::object {
|
json11::Json::object {
|
||||||
{ "request_put", json11::Json::object {
|
{ "request_put", json11::Json::object {
|
||||||
{ "key", state_key },
|
{ "key", state_key },
|
||||||
{ "value", base64_encode(get_osd_state().dump()) },
|
{ "value", base64_encode(self_state.dump()) },
|
||||||
{ "lease", etcd_lease_id },
|
{ "lease", etcd_lease_id },
|
||||||
} }
|
} }
|
||||||
},
|
},
|
||||||
|
@ -601,7 +603,7 @@ void osd_t::parse_pg_state(const std::string & key, const json11::Json & value)
|
||||||
{
|
{
|
||||||
pg_item.second.exists = false;
|
pg_item.second.exists = false;
|
||||||
}
|
}
|
||||||
for (auto & pg_item: value.object_items())
|
for (auto & pg_item: value["items"].object_items())
|
||||||
{
|
{
|
||||||
pg_num_t pg_num = stoull_full(pg_item.first);
|
pg_num_t pg_num = stoull_full(pg_item.first);
|
||||||
if (!pg_num)
|
if (!pg_num)
|
||||||
|
|
Loading…
Reference in New Issue