Check for partition tables on new devices

This commit is contained in:
Joshua Boniface 2023-11-04 03:09:22 -04:00
parent d1602f35de
commit 7490f13b7c
1 changed files with 18 additions and 0 deletions

View File

@ -310,6 +310,15 @@ class CephOSDInstance(object):
)
return False
# Check if device has a partition table; it's not valid if it does
retcode, _, _ = common.run_os_command(f"sfdisk --dump {device}")
if retcode < 1:
logger.out(
f"Device {device} has a partition table and is unsuitable for an OSD",
state="e",
)
return False
if ext_db_size is not None or ext_db_ratio is not None:
ext_db_flag = True
else:
@ -525,6 +534,15 @@ class CephOSDInstance(object):
)
new_device = ddevice
# Check if device has a partition table; it's not valid if it does
retcode, _, _ = common.run_os_command(f"sfdisk --dump {new_device}")
if retcode < 1:
logger.out(
f"Device {new_device} has a partition table and is unsuitable for an OSD",
state="e",
)
return False
# Phase 1: Try to determine what we can about the old device
real_old_device = None
osd_block = zkhandler.read(("osd.device", osd_id))