forked from rook/rook
Merge pull request #11301 from ausias-armesto/fix/11297-create-volumes-with-mapper-alias
OSD prepare job cannot create vols with /dev/mapper alias on PVCs
This commit is contained in:
@@ -276,13 +276,6 @@ func (a *OsdAgent) initializeBlockPVC(context *clusterd.Context, devices *Device
|
||||
var deviceArg string
|
||||
|
||||
deviceArg = device.Config.Name
|
||||
logger.Info("devlink names:")
|
||||
for _, devlink := range device.PersistentDevicePaths {
|
||||
logger.Info(devlink)
|
||||
if strings.HasPrefix(devlink, "/dev/mapper") {
|
||||
deviceArg = devlink
|
||||
}
|
||||
}
|
||||
|
||||
immediateExecuteArgs := append(baseArgs, []string{
|
||||
"--data",
|
||||
@@ -586,12 +579,6 @@ func (a *OsdAgent) initializeDevicesLVMMode(context *clusterd.Context, devices *
|
||||
|
||||
logger.Infof("configuring new LVM device %s", name)
|
||||
deviceArg := path.Join("/dev", name)
|
||||
// ceph-volume prefers to use /dev/mapper/<name> if the device has this kind of alias
|
||||
for _, devlink := range device.PersistentDevicePaths {
|
||||
if strings.HasPrefix(devlink, "/dev/mapper") {
|
||||
deviceArg = devlink
|
||||
}
|
||||
}
|
||||
|
||||
deviceOSDCount := osdsPerDeviceCount
|
||||
if device.Config.OSDsPerDevice > 1 {
|
||||
|
||||
@@ -343,7 +343,7 @@ func TestConfigureCVDevices(t *testing.T) {
|
||||
executor.MockExecuteCommandWithOutput = func(command string, args ...string) (string, error) {
|
||||
logger.Infof("[MockExecuteCommandWithOutput] %s %v", command, args)
|
||||
if command == "lsblk" && args[0] == mountedDev {
|
||||
return fmt.Sprintf(`SIZE="17179869184" ROTA="1" RO="0" TYPE="lvm" PKNAME="" NAME="%s" KNAME="/dev/dm-1, a ...interface{})`, mapperDev), nil
|
||||
return fmt.Sprintf(`SIZE="17179869184" ROTA="1" RO="0" TYPE="lvm" PKNAME="" NAME="/mnt/set1-data-0-rpf2k" KNAME="/dev/dm-1, a ...interface{})`), nil
|
||||
}
|
||||
if command == "sgdisk" {
|
||||
return "Disk identifier (GUID): 18484D7E-5287-4CE9-AC73-D02FB69055CE", nil
|
||||
@@ -370,8 +370,8 @@ func TestConfigureCVDevices(t *testing.T) {
|
||||
}
|
||||
executor.MockExecuteCommandWithCombinedOutput = func(command string, args ...string) (string, error) {
|
||||
logger.Infof("[MockExecuteCommandWithCombinedOutput] %s %v", command, args)
|
||||
if args[1] == "ceph-volume" && args[2] == "raw" && args[3] == "prepare" && args[4] == "--bluestore" && args[6] == mapperDev ||
|
||||
args[1] == "ceph-volume" && args[4] == "raw" && args[5] == "prepare" && args[6] == "--bluestore" && args[8] == mapperDev {
|
||||
if args[1] == "ceph-volume" && args[2] == "raw" && args[3] == "prepare" && args[4] == "--bluestore" && args[6] == "/mnt/set1-data-0-rpf2k" ||
|
||||
args[1] == "ceph-volume" && args[4] == "raw" && args[5] == "prepare" && args[6] == "--bluestore" && args[8] == "/mnt/set1-data-0-rpf2k" {
|
||||
return "", nil
|
||||
}
|
||||
if contains(args, "lvm") && contains(args, "list") {
|
||||
|
||||
Reference in New Issue
Block a user