From f55c4573cf89884696aebc502f83e667ad8782cc Mon Sep 17 00:00:00 2001 From: ausias-armesto Date: Wed, 14 Dec 2022 09:07:46 +0100 Subject: [PATCH] osd: cannot create volumes on pvc based osd with alias dev mapper It removes the condition that select the devices name prefixed with /dev/mapper as it is causing the ceph-volume command to fail. Closes: #11301 Signed-off-by: ausias-armesto --- pkg/daemon/ceph/osd/volume.go | 13 ------------- pkg/daemon/ceph/osd/volume_test.go | 6 +++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/pkg/daemon/ceph/osd/volume.go b/pkg/daemon/ceph/osd/volume.go index dcf9e927b..3ce20706b 100644 --- a/pkg/daemon/ceph/osd/volume.go +++ b/pkg/daemon/ceph/osd/volume.go @@ -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/ 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 { diff --git a/pkg/daemon/ceph/osd/volume_test.go b/pkg/daemon/ceph/osd/volume_test.go index 73379b21f..5e2958eac 100644 --- a/pkg/daemon/ceph/osd/volume_test.go +++ b/pkg/daemon/ceph/osd/volume_test.go @@ -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") {