Skip to content

ceph-bluestore-tool: Fixes for multilple bdev label#59762

Merged
aclamk merged 5 commits intoceph:mainfrom
aclamk:wip-aclamk-cbt-combined
Sep 25, 2024
Merged

ceph-bluestore-tool: Fixes for multilple bdev label#59762
aclamk merged 5 commits intoceph:mainfrom
aclamk:wip-aclamk-cbt-combined

Conversation

@aclamk
Copy link
Contributor

@aclamk aclamk commented Sep 12, 2024

This PR consists of:

ZAP:
#59632
show-label:
#59714
really-really-mean-it:
#59627
+
-zap-size param is removed
+
documentation added

Fixes:
https://tracker.ceph.com/issues/68048

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

ifed01 and others added 3 commits September 6, 2024 12:08
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
ceph-volume needs to query the devices for `ceph-volume raw list`.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
Show device label(s). Label is a special 4K area that plays the role of superblock,
provides metadata that exposes version, creation time, size, etc.
There are multiple copies of the block at offsets: 0, 1G, 10G, 100G and 1000G.
As an exception, label can be printed even if an OSD is running.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label is a 4KB structure at the beginning of the device that serves as a superblock, holding metadata including version, creation time, size, etc. There are copies at offsets 1GB, 10GB, 100GB, and 1000GB. The label may be printed while an OSD is running.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant wrt existing text around lines 203 / 211?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels to me this change should actually be moved to section Device labels

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.
I will move detailed explanation around "Device labels" section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anthonyeleven Please recheck. My PRs always benefit from your language input.

@aclamk aclamk force-pushed the wip-aclamk-cbt-combined branch from 87eec9f to d58f730 Compare September 12, 2024 15:57
Comment on lines 9000 to 9001
auto * _bdev =
BlockDevice::create(cct, dev, nullptr, nullptr, nullptr, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest using smart pointers here:
unique_ptr<BlockDevice> _bdev(BlockDevice::create(cct, dev, nullptr, nullptr, nullptr, nullptr));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one. Done.

Copy link
Contributor

@guits guits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed from a ceph-volume/orchestration point of view.

tested with a cephadm deployed cluster:

show-label on running OSD:

[root@bluestore-tests-1 /]# ceph osd tree
ID  CLASS  WEIGHT   TYPE NAME                   STATUS  REWEIGHT  PRI-AFF
-1         0.19530  root default
-3         0.19530      host bluestore-tests-1
 0    hdd  0.19530          osd.0                   up   1.00000  1.00000
[root@bluestore-tests-1 /]# ceph-bluestore-tool show-label --dev /dev/ceph-f895bb03-9590-46e7-be60-f2aa39965576/osd-block-e06e7091-ad93-436b-8cff-9bc45bebe672
{
    "/dev/ceph-f895bb03-9590-46e7-be60-f2aa39965576/osd-block-e06e7091-ad93-436b-8cff-9bc45bebe672": {
        "osd_uuid": "e06e7091-ad93-436b-8cff-9bc45bebe672",
        "size": 214744170496,
        "btime": "2024-09-13T08:29:22.110570+0000",
        "description": "main",
        "bfm_blocks": "52427776",
        "bfm_blocks_per_key": "128",
        "bfm_bytes_per_block": "4096",
        "bfm_size": "214744170496",
        "bluefs": "1",
        "ceph_fsid": "efc6b532-71a9-11ef-bf2c-525400c3b0c0",
        "ceph_version_when_created": "ceph version 19.3.0-4916-g3e18128d (3e18128dc8e02730bc1b3e7530b4fbb543f81eef) squid (dev)",
        "created_at": "2024-09-13T08:29:25.624292Z",
        "elastic_shared_blobs": "1",
        "epoch": "18",
        "kv_backend": "rocksdb",
        "magic": "ceph osd volume v026",
        "multi": "yes",
        "osd_key": "AQDg9+NmJWGcMhAA99mv/fZte7DwR/L+9X00jA==",
        "osdspec_affinity": "None",
        "ready": "ready",
        "require_osd_release": "19",
        "type": "bluestore",
        "whoami": "0"
    }
}
[root@bluestore-tests-1 /]#

ceph-bluestore-tool zap-device:

[root@bluestore-tests-1 /]# ceph orch daemon stop osd.0
Scheduled to stop osd.0 on host 'bluestore-tests-1'

[root@bluestore-tests-1 /]# ceph osd tree
ID  CLASS  WEIGHT   TYPE NAME                   STATUS  REWEIGHT  PRI-AFF
-1         0.19530  root default
-3         0.19530      host bluestore-tests-1
 0    hdd  0.19530          osd.0                 down   1.00000  1.00000

[root@bluestore-tests-1 /]# hexdump -C -n22 -s1073741824 /dev/ceph-f895bb03-9590-46e7-be60-f2aa39965576/osd-block-e06e7091-ad93-436b-8cff-9bc45bebe672
40000000  62 6c 75 65 73 74 6f 72  65 20 62 6c 6f 63 6b 20  |bluestore block |
40000010  64 65 76 69 63 65                                 |device|
40000016

[root@bluestore-tests-1 /]# ceph-bluestore-tool zap-device --dev /dev/ceph-f895bb03-9590-46e7-be60-f2aa39965576/osd-block-e06e7091-ad93-436b-8cff-9bc45bebe672 --yes-i-really-really-mean-it

[root@bluestore-tests-1 /]# hexdump -C -n22 -s1073741824 /dev/ceph-f895bb03-9590-46e7-be60-f2aa39965576/osd-block-e06e7091-ad93-436b-8cff-9bc45bebe672
40000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
40000010  00 00 00 00 00 00                                 |......|
40000016
[root@bluestore-tests-1 /]#

Make zapping precisely target block device labels.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
@aclamk aclamk force-pushed the wip-aclamk-cbt-combined branch from d58f730 to cec3792 Compare September 13, 2024 10:37
| **ceph-bluestore-tool** reshard --path *osd path* --sharding *new sharding* [ --sharding-ctrl *control string* ]
| **ceph-bluestore-tool** show-sharding --path *osd path*
| **ceph-bluestore-tool** trim --path *osd path*
| **ceph-bluestore-tool** zap --path *osd path*
Copy link
Contributor

@ifed01 ifed01 Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not <osd path> but <dev path>.

And it's to be provided with --dev option. One can even specify multiple devices this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

and allows the drive to perform more efficient internal housekeeping.
If BlueStore runs with discard enabled, this option may not be useful.

:command: `zap` --path *osd path*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the way, shouldn't it be zap-device ?

Suggested change
:command: `zap` --path *osd path*
:command: `zap-device` --path *osd path*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

- added zap documentation
- explained show-label lock exclusion

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
@aclamk aclamk force-pushed the wip-aclamk-cbt-combined branch from cec3792 to afeaeb7 Compare September 13, 2024 13:09
@YiteGu
Copy link
Member

YiteGu commented Sep 14, 2024

jenkins test make check

@guits
Copy link
Contributor

guits commented Sep 16, 2024

jenkins test api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants