Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling Ceph

This section describes how to compile Ceph after SPDK and UCX are enabled.

  1. Modify the ceph.spec file.
    1
    2
    3
    4
    5
    6
    sed -i 's/redhat-rpm-config/openEuler-rpm-config/g' ceph.spec
    sed -i 's#%if 0%{?fedora} || 0%{?rhel}#%if 0%{?fedora} || 0%{?rhel} || 0%{?openEuler}#' ceph.spec
    sed -i 's#%if 0%{?rhel} || 0%{?fedora}#%if 0%{?rhel} || 0%{?fedora} || 0%{?openEuler}#' ceph.spec
    sed -i 's#%if 0%{?fedora} || 0%{?suse_version} > 1500 || 0%{?rhel} == 9 || 0%{?openEuler}#%if 0%{?fedora} || 0%{?suse_version} > 1500 || 0%{?rhel} == 9#' ceph.spec
    sed -i '1a\%define _binaries_in_noarch_packages_terminate_build 0' ceph.spec
    sed -i '2a\%define _unpackaged_files_terminate_build 0' ceph.spec
    
    1. In Ceph 17.2.8, OSDs occasionally restart. For details, see Error Reported After Ceph 17.2.8 Runs for a Long Time.
    2. If the Ceph source code src/osd/SnapMapper.cc conflicts with the fmt package version, a compilation error is reported, as shown in Figure 1. In this case, comment out the code lines related to fmt::format in the src/osd/SnapMapper.cc file and recompile the code. Four modifications are involved:
      • Lines 233 to 234
      • Lines 272 to 275
      • Lines 321 to 324
      • Lines 327 to 329
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
          228 tl::expected<SnapMapper::object_snaps, Scrub::SnapMapReaderI::result_t>
          229 SnapMapper::get_snaps_common(const hobject_t &oid) const
          230 {
          231   ceph_assert(check(oid));
          232   set<string> keys{to_object_key(oid)};
          233 //  dout(20) << fmt::format("{}: key string: {} oid:{}", __func__, keys, oid)
          234 //         << dendl;
          235
          236   map<string, ceph::buffer::list> got;
      ...
          264 std::set<std::string> SnapMapper::to_raw_keys(
          265   const hobject_t &clone,
          266   const std::set<snapid_t> &snaps) const
          267 {
          268   std::set<std::string> keys;
          269   for (auto snap : snaps) {
          270     keys.insert(to_raw_key(snap, clone));
          271   }
          272 //  dout(20) << fmt::format(
          273 //              "{}: clone:{} snaps:{} -> keys: {}", __func__, clone, snaps,
          274 //              keys)
          275 //         << dendl;
          276   return keys;
          277 }
      ...
          305   std::set<snapid_t> snaps_from_mapping;
          306   for (auto &[k, v] : kvmap) {
          307     dout(20) << __func__ << " " << hoid << " " << k << dendl;
          308     // extract the object ID from the value fetched for an SNA mapping key
          309     auto [sn, obj] = SnapMapper::from_raw(v);
          310     if (obj != hoid) {
          311       dout(1) << fmt::format(
          312                    "{}: unexpected object ID {} for key{} (expected {})",
          313                    __func__, obj, k, hoid)
          314               << dendl;
          315       return tl::unexpected(result_t{code_t::inconsistent});
          316     }
          317     snaps_from_mapping.insert(sn);
          318   }
          319
          320   if (snaps_from_mapping != *obj_snaps) {
          321 //    dout(10) << fmt::format(
          322 //                "{}: hoid:{} -> mapper internal inconsistency ({} vs {})",
          323 //                __func__, hoid, *obj_snaps, snaps_from_mapping)
          324 //           << dendl;
          325     return tl::unexpected(result_t{code_t::inconsistent});
          326   }
          327  // dout(10) << fmt::format(
          328 //              "{}: snaps for {}: {}", __func__, hoid, snaps_from_mapping)
          329 //         << dendl;
          330   return obj_snaps;
          331 }
      
      Figure 1 Compilation error
  2. Compile Ceph.
    1
    2
    3
    4
    5
    cd ..
    tar cfv ceph-17.2.7.tar.bz2 ceph-17.2.7/
    cp ceph-17.2.7/ceph.spec /root/rpmbuild/SPECS/
    cp ceph-17.2.7.tar.bz2 /root/rpmbuild/SOURCES/
    rpmbuild -bb /root/rpmbuild/SPECS/ceph.spec
    

    During Ceph compilation, you need to configure a network proxy so that the compilation container can access the Internet. For details, see 5.

  3. Copy generated Ceph packages to the /home/local_rpm/ directory.
    1
    2
    mv /root/rpmbuild/RPMS/aarch64 /home/local_rpm/
    mv /root/rpmbuild/RPMS/noarch /home/local_rpm/
    
  4. On the physical machine, import the RPM packages to the deployment container.
    1
    podman cp openeuler2203sp4_build:/home/local_rpm openeuler2203sp4_release:/home/
    

    The packages imported to the deployment container are all the packages involved in Compiling Ceph, including python-asyncssh, python3-natsort, UCX packages, and Ceph packages.