是否有人跟我一样碰到这样的情况
执行ceph-volume inventory报错
还好有错误日志可以看
[2024-07-05 11:40:40,540][ceph_volume.process][INFO ] Running command: /usr/sbin/blkid -c /dev/null -p /dev/ceph-c5fd6684-3851-49ab-bd44-f6743a79e24f/osd-block-42d41cd1-821e-4d21-b19b-4e46a5621cfd
[2024-07-05 11:40:40,546][ceph_volume.process][INFO ] stdout /dev/ceph-c5fd6684-3851-49ab-bd44-f6743a79e24f/osd-block-42d41cd1-821e-4d21-b19b-4e46a5621cfd: PTTYPE="atari"
[2024-07-05 11:40:40,547][ceph_volume][ERROR ] exception caught by decorator
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/ceph_volume/decorators.py", line 59, in newfunc
return f(*a, **kw)
File "/usr/lib/python3.6/site-packages/ceph_volume/main.py", line 153, in main
terminal.dispatch(self.mapper, subcommand_args)
File "/usr/lib/python3.6/site-packages/ceph_volume/terminal.py", line 194, in dispatch
instance.main()
File "/usr/lib/python3.6/site-packages/ceph_volume/inventory/main.py", line 60, in main
list_all=self.args.list_all))
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 50, in __init__
sys_info.devices.keys()]
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 49, in <listcomp>
all_devices_vgs=all_devices_vgs) for k in
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 148, in __init__
self.available_lvm, self.rejected_reasons_lvm = self._check_lvm_reject_reasons()
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 647, in _check_lvm_reject_reasons
rejected.extend(self._check_generic_reject_reasons())
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 602, in _check_generic_reject_reasons
if self.is_acceptable_device:
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 503, in is_acceptable_device
return self.is_device or self.is_partition or self.is_lv
File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 483, in is_partition
return self.blkid_api['TYPE'] == 'part'
KeyError: 'TYPE'
主要是因为执行了/usr/sbin/blkid命令
正常情况下应该有TYPE字段,但出现没有的情况,有PTTYPE
主要功能是看硬盘有没有part分区
处理方法也很简单
判断有没有这个字段
修改/usr/lib/python3.6/site-packages/ceph_volume/util/device.py
修改前
@property
def is_partition(self):
self.load_blkid_api()
if self.disk_api:
return self.disk_api['TYPE'] == 'part'
elif self.blkid_api:
return self.blkid_api['TYPE'] == 'part'
return False
修改后
@property
def is_partition(self):
self.load_blkid_api()
if self.disk_api:
return self.disk_api['TYPE'] == 'part'
elif self.blkid_api:
if 'TYPE' in self.blkid_api:
return self.blkid_api['TYPE'] == 'part'
return False
这样就通过了