Merge "ceph-manage-journal: add support for mpath device"
This commit is contained in:
commit
7cff0c4d7f
@ -13,6 +13,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
DEVICE_NAME_NVME = "nvme"
|
DEVICE_NAME_NVME = "nvme"
|
||||||
|
DEVICE_NAME_MPATH = "mpath"
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# Utils #
|
# Utils #
|
||||||
@ -63,6 +64,17 @@ def device_path_to_device_node(device_path):
|
|||||||
return out
|
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 #
|
# 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"""
|
"""Validate the existence and size of journal partitions"""
|
||||||
|
|
||||||
# Obtain the device node from the device path.
|
# 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)
|
disk_node = device_path_to_device_node(disk_path)
|
||||||
|
|
||||||
# Check that partition table format is GPT
|
# Check that partition table format is GPT
|
||||||
@ -114,6 +129,9 @@ def create_partitions(disk_path, partition_sizes):
|
|||||||
"""Recreate partitions"""
|
"""Recreate partitions"""
|
||||||
|
|
||||||
# Obtain the device node from the device path.
|
# 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)
|
disk_node = device_path_to_device_node(disk_path)
|
||||||
|
|
||||||
# Issue: After creating a new partition table on a device, Udev does not
|
# 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"""
|
"""Mount an OSD data partition and return the mounted path"""
|
||||||
|
|
||||||
# Obtain the device node from the device 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)
|
data_node = device_path_to_device_node(data_path)
|
||||||
|
|
||||||
mount_path = OSD_PATH + "ceph-" + str(osdid)
|
mount_path = OSD_PATH + "ceph-" + str(osdid)
|
||||||
@ -197,7 +218,7 @@ def mount_data_partition(data_path, osdid):
|
|||||||
_, _, ret = command(cmd)
|
_, _, ret = command(cmd)
|
||||||
params = {"node": data_node, "path": mount_path}
|
params = {"node": data_node, "path": mount_path}
|
||||||
if ret:
|
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)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print("Mounted %(node)s to %(path)s" % params)
|
print("Mounted %(node)s to %(path)s" % params)
|
||||||
|
Loading…
Reference in New Issue
Block a user