ceph-manage-journal: add support for mpath device
* Add the missing 's' to fix the syntax error: File "/usr/sbin/ceph-manage-journal", line 200, in mount_data_partition print("Failed to mount %(node)s to %(path), aborting" % params) ValueError: unsupported format character ',' (0x2c) at index 35 * Add a function to find mpath node in /dev/mapper Test Plan: PASS: AIO-SX with Ceph, 1 osd PASS: AIO-SX with Ceph, 2 osd PASS: AIO-SX with Ceph, 4 osd Story: 2010046 Task: 45427 Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Thiago Miranda <ThiagoOliveira.Miranda@windriver.com> Change-Id: I08f1f226343bf0140abb1ec8825533abb3f57e43
This commit is contained in:
parent
f058d86a96
commit
f00e55b736
@ -13,6 +13,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
DEVICE_NAME_NVME = "nvme"
|
||||
DEVICE_NAME_MPATH = "mpath"
|
||||
|
||||
#########
|
||||
# Utils #
|
||||
@ -63,6 +64,17 @@ def device_path_to_device_node(device_path):
|
||||
return out
|
||||
|
||||
|
||||
def device_path_to_mpath_node(device_path):
|
||||
try:
|
||||
output, _, _ = command(["udevadm", "settle", "-E", device_path])
|
||||
out, err, retcode = command(["find", "-L", "/dev/mapper/", "-samefile", device_path])
|
||||
out = out.rstrip()
|
||||
except Exception as e:
|
||||
return None
|
||||
|
||||
return out
|
||||
|
||||
|
||||
###########################################
|
||||
# Manage Journal Disk Partitioning Scheme #
|
||||
###########################################
|
||||
@ -75,6 +87,9 @@ def is_partitioning_correct(disk_path, partition_sizes):
|
||||
"""Validate the existence and size of journal partitions"""
|
||||
|
||||
# Obtain the device node from the device path.
|
||||
if DEVICE_NAME_MPATH in disk_path:
|
||||
disk_node = device_path_to_mpath_node(disk_path)
|
||||
else:
|
||||
disk_node = device_path_to_device_node(disk_path)
|
||||
|
||||
# Check that partition table format is GPT
|
||||
@ -114,6 +129,9 @@ def create_partitions(disk_path, partition_sizes):
|
||||
"""Recreate partitions"""
|
||||
|
||||
# Obtain the device node from the device path.
|
||||
if DEVICE_NAME_MPATH in disk_path:
|
||||
disk_node = device_path_to_mpath_node(disk_path)
|
||||
else:
|
||||
disk_node = device_path_to_device_node(disk_path)
|
||||
|
||||
# Issue: After creating a new partition table on a device, Udev does not
|
||||
@ -187,6 +205,9 @@ def mount_data_partition(data_path, osdid):
|
||||
"""Mount an OSD data partition and return the mounted path"""
|
||||
|
||||
# Obtain the device node from the device path.
|
||||
if DEVICE_NAME_MPATH in data_path:
|
||||
data_node = device_path_to_mpath_node(data_path)
|
||||
else:
|
||||
data_node = device_path_to_device_node(data_path)
|
||||
|
||||
mount_path = OSD_PATH + "ceph-" + str(osdid)
|
||||
@ -197,7 +218,7 @@ def mount_data_partition(data_path, osdid):
|
||||
_, _, ret = command(cmd)
|
||||
params = {"node": data_node, "path": mount_path}
|
||||
if ret:
|
||||
print("Failed to mount %(node)s to %(path), aborting" % params)
|
||||
print("Failed to mount %(node)s to %(path)s, aborting" % params)
|
||||
exit(1)
|
||||
else:
|
||||
print("Mounted %(node)s to %(path)s" % params)
|
||||
|
Loading…
Reference in New Issue
Block a user