MCPcopy Create free account
hub / github.com/ceph/ceph / create_initial

Method create_initial

src/mon/OSDMonitor.cc:659–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659void OSDMonitor::create_initial()
660{
661 dout(10) << "create_initial for " << mon.monmap->fsid << dendl;
662
663 OSDMap newmap;
664
665 bufferlist bl;
666 mon.store->get("mkfs", "osdmap", bl);
667
668 if (bl.length()) {
669 newmap.decode(bl);
670 newmap.set_fsid(mon.monmap->fsid);
671 } else {
672 newmap.build_simple(cct, 0, mon.monmap->fsid, 0);
673 }
674 newmap.set_epoch(1);
675 newmap.created = newmap.modified = ceph_clock_now();
676
677 // new clusters should sort bitwise by default.
678 newmap.set_flag(CEPH_OSDMAP_SORTBITWISE);
679
680 newmap.flags |=
681 CEPH_OSDMAP_RECOVERY_DELETES |
682 CEPH_OSDMAP_PURGED_SNAPDIRS |
683 CEPH_OSDMAP_PGLOG_HARDLIMIT;
684 newmap.full_ratio = g_conf()->mon_osd_full_ratio;
685 if (newmap.full_ratio > 1.0) newmap.full_ratio /= 100;
686 newmap.backfillfull_ratio = g_conf()->mon_osd_backfillfull_ratio;
687 if (newmap.backfillfull_ratio > 1.0) newmap.backfillfull_ratio /= 100;
688 newmap.nearfull_ratio = g_conf()->mon_osd_nearfull_ratio;
689 if (newmap.nearfull_ratio > 1.0) newmap.nearfull_ratio /= 100;
690
691 // new cluster should require latest by default
692 if (g_conf().get_val<bool>("mon_debug_no_require_umbrella")) {
693 if (g_conf().get_val<bool>("mon_debug_no_require_tentacle")) {
694 derr << __func__ << " mon_debug_no_require_umbrella and tentacle=true" << dendl;
695 newmap.require_osd_release = ceph_release_t::squid;
696 } else {
697 derr << __func__ << " mon_debug_no_require_umbrella=true" << dendl;
698 newmap.require_osd_release = ceph_release_t::tentacle;
699 }
700 } else {
701 newmap.require_osd_release = ceph_release_t::umbrella;
702 }
703
704 ceph_release_t r = ceph_release_from_name(g_conf()->mon_osd_initial_require_min_compat_client);
705 if (!r) {
706 ceph_abort_msg("mon_osd_initial_require_min_compat_client is not valid");
707 }
708 newmap.require_min_compat_client = r;
709
710 // encode into pending incremental
711 uint64_t features = newmap.get_encoding_features();
712 newmap.encode(pending_inc.fullmap,
713 features | CEPH_FEATURE_RESERVED);
714 pending_inc.full_crc = newmap.get_crc();
715 dout(20) << " full crc " << pending_inc.full_crc << dendl;
716}

Callers

nothing calls this directly

Calls 12

ceph_clock_nowFunction · 0.85
ceph_release_from_nameFunction · 0.85
get_encoding_featuresMethod · 0.80
getMethod · 0.45
lengthMethod · 0.45
decodeMethod · 0.45
set_fsidMethod · 0.45
build_simpleMethod · 0.45
set_epochMethod · 0.45
set_flagMethod · 0.45
encodeMethod · 0.45
get_crcMethod · 0.45

Tested by

no test coverage detected