Project

General

Profile

Bug #57335

cephadm gather-facts reports disk size incorecctly for native 4k sectors

Added by Paul Cuzner 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
cephadm (binary)
Target version:
% Done:

0%

Source:
Tags:
backport_processed
Backport:
quincy, pacific
Regression:
No
Severity:
3 - minor
Reviewed:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

When the HDD is in native 4K format, the logical and physical logical blocksize is set to 4096 - and since the logical block size is used in gather-facts to calculate the drive size, this results in a reported drive size 8x larger than reality.

e.g.

    {
      "alt_dev_name": "",
      "description": "SEAGATE ST16000NM002G (128.0TB)",
      "dev_name": "sdg",
      "disk_size_bytes": 128007205289984,
      "disk_type": "hdd",
      "enclosure_id": "0x500c0ff043f10a3c",
      "enclosure_slot": "72",
      "model": "ST16000NM002G",
      "mpath": "",
      "path_id": "/dev/disk/by-path/pci-0000:81:00.0-sas-exp0x500c0ff2443bd63f-phy0-lun-0",
      "rev": "E002",
      "scsi_addr": "18:0:7:0",
      "serial": "ZL20BA4G0000C94542SE",
      "vendor": "SEAGATE",
      "wwid": "naa.5000c500ae41fa9b" 
    },

So this disk is showing as 128TB.

According to the kernel tree, the multiplier when calculating the drive side should always be 512.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/types.h?h=v5.15.63#n120

However, gather-facts is using the logical block size

    def _get_capacity(self, dev):
        # type: (str) -> int
        """Determine the size of a given device""" 
        size_path = os.path.join('/sys/block', dev, 'size')
        size_blocks = int(read_file([size_path]))
        blk_path = os.path.join('/sys/block', dev, 'queue', 'logical_block_size')
        blk_count = int(read_file([blk_path]))
        return size_blocks * blk_count


Related issues

Copied to Orchestrator - Backport #57424: pacific: cephadm gather-facts reports disk size incorecctly for native 4k sectors Resolved
Copied to Orchestrator - Backport #57425: quincy: cephadm gather-facts reports disk size incorecctly for native 4k sectors Resolved

History

#1 Updated by Paul Cuzner 3 months ago

  • Status changed from New to Fix Under Review
  • Pull request ID set to 47859

#2 Updated by Adam King 3 months ago

  • Backport set to quincy, pacific

#3 Updated by Adam King 3 months ago

  • Status changed from Fix Under Review to Pending Backport

#4 Updated by Backport Bot 3 months ago

  • Copied to Backport #57424: pacific: cephadm gather-facts reports disk size incorecctly for native 4k sectors added

#5 Updated by Backport Bot 3 months ago

  • Copied to Backport #57425: quincy: cephadm gather-facts reports disk size incorecctly for native 4k sectors added

#6 Updated by Backport Bot 3 months ago

  • Tags set to backport_processed

#7 Updated by Adam King 3 months ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF