Manipulating object map key

Use the ceph-objectstore-tool utility to change the object map (OMAP) key.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • Root-level access to the Ceph OSD node.
  • Stopping the ceph-osd daemon.

About this task

To change the OMAP, provide the data path, the placement group identifier (PG ID), the object, and the key.

Procedure

  1. Log in to the OSD container.
    cephadm shell --name osd.OSD_ID
    For example,
    [root@host01 ~]# cephadm shell --name osd.0
  2. Get the object map key.
    ceph-objectstore-tool --data-path PATH_TO_OSD \
     --pgid PG_ID OBJECT \
     get-omap KEY > OBJECT_MAP_FILE_NAME
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 \
     --pgid 0.1c '{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}'  \
     get-omap "" > zone_info.default.omap.txt
  3. Set the object map key.
    ceph-objectstore-tool --data-path PATH_TO_OSD \
     --pgid PG_ID OBJECT \
     set-omap KEY > OBJECT_MAP_FILE_NAME
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 \
     --pgid 0.1c '{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}'  \
     set-omap "" > zone_info.default.omap.txt
  4. Remove the object map key.
    ceph-objectstore-tool --data-path PATH_TO_OSD \
     --pgid PG_ID OBJECT \
     rm-omap KEY
    For example,
    [ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 \
     --pgid 0.1c '{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}'  \
     rm-omap ""