| 642 | } |
| 643 | |
| 644 | void Monitor::read_features_off_disk(MonitorDBStore *store, CompatSet *features) |
| 645 | { |
| 646 | bufferlist featuresbl; |
| 647 | store->get(MONITOR_NAME, COMPAT_SET_LOC, featuresbl); |
| 648 | if (featuresbl.length() == 0) { |
| 649 | generic_dout(0) << "WARNING: mon fs missing feature list.\n" |
| 650 | << "Assuming it is old-style and introducing one." << dendl; |
| 651 | //we only want the baseline ~v.18 features assumed to be on disk. |
| 652 | //If new features are introduced this code needs to disappear or |
| 653 | //be made smarter. |
| 654 | *features = get_legacy_features(); |
| 655 | |
| 656 | features->encode(featuresbl); |
| 657 | auto t(std::make_shared<MonitorDBStore::Transaction>()); |
| 658 | t->put(MONITOR_NAME, COMPAT_SET_LOC, featuresbl); |
| 659 | store->apply_transaction(t); |
| 660 | } else { |
| 661 | auto it = featuresbl.cbegin(); |
| 662 | features->decode(it); |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | void Monitor::read_features() |
| 667 | { |