Project

General

Profile

Actions

Bug #65584

open

ceph-volume: use os.makedirs to implement mkdir_p

Added by Yuanrun Chen 13 days ago. Updated 1 day ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
squid,reef
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

ceph-volume failed if /var/lib/ceph/osd/ does not exist

[2024-04-19 06:38:08,474][ceph_volume.devices.raw.prepare][INFO  ] compute the real osd_id:0
[2024-04-19 06:38:08,474][ceph_volume.process][INFO  ] Running command: /opt/vision-storage/bin/ceph-authtool --gen-print-key
[2024-04-19 06:38:08,506][ceph_volume.devices.raw.prepare][ERROR ] raw prepare was unable to complete
Traceback (most recent call last):
  File "/opt/vision-storage/lib/python3.10/site-packages/ceph_volume-1.0.0-py3.10.egg/ceph_volume/devices/raw/prepare.py", line 95, in safe_prepare
    self.prepare()
  File "/opt/vision-storage/lib/python3.10/site-packages/ceph_volume-1.0.0-py3.10.egg/ceph_volume/decorators.py", line 16, in is_root
    return func(*a, **kw)
  File "/opt/vision-storage/lib/python3.10/site-packages/ceph_volume-1.0.0-py3.10.egg/ceph_volume/devices/raw/prepare.py", line 132, in prepare
    prepare_bluestore(
  File "/opt/vision-storage/lib/python3.10/site-packages/ceph_volume-1.0.0-py3.10.egg/ceph_volume/devices/raw/prepare.py", line 60, in prepare_bluestore
    prepare_utils.create_osd_path(osd_id, tmpfs=tmpfs)
  File "/opt/vision-storage/lib/python3.10/site-packages/ceph_volume-1.0.0-py3.10.egg/ceph_volume/util/prepare.py", line 228, in create_osd_path
    system.mkdir_p('/var/lib/ceph/osd/%s-%s' % (conf.cluster, osd_id))
  File "/opt/vision-storage/lib/python3.10/site-packages/ceph_volume-1.0.0-py3.10.egg/ceph_volume/util/system.py", line 137, in mkdir_p
    os.mkdir(path)
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/ceph/osd/ceph-0'
[2024-04-19 06:38:08,507][ceph_volume.devices.raw.prepare][INFO  ] will rollback OSD ID creation

mkdir_p in src/ceph-volume/ceph_volume/util/system.py should use os.makedirs instead of os.mkdir

def mkdir_p(path, chown=True):
    """ 
    A `mkdir -p` that defaults to chown the path to the ceph user
    """ 
    try:
        os.mkdir(path)
    except OSError as e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise
    if chown:
        uid, gid = get_ceph_user_ids()
        os.chown(path, uid, gid)

See:
Actions #1

Updated by Yuanrun Chen 13 days ago

  • Pull request ID set to 57000
Actions #2

Updated by Guillaume Abrioux 1 day ago

  • Status changed from New to Fix Under Review
Actions #3

Updated by Guillaume Abrioux 1 day ago

  • Priority changed from High to Normal
Actions #4

Updated by Guillaume Abrioux 1 day ago

  • Assignee set to Yuanrun Chen
  • Backport set to squid,reef
Actions

Also available in: Atom PDF