From a02ddc6716acc09e836e521969345eba975189e4 Mon Sep 17 00:00:00 2001 From: Nobi Date: Sun, 25 Sep 2022 20:29:07 +0000 Subject: [PATCH] Allow claim sparse device Signed-off-by: Nobi --- pkg/select/blockdevice/select.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/select/blockdevice/select.go b/pkg/select/blockdevice/select.go index 6bc464721..18a43b7d2 100644 --- a/pkg/select/blockdevice/select.go +++ b/pkg/select/blockdevice/select.go @@ -18,7 +18,9 @@ package blockdevice import ( "fmt" + apis "github.com/openebs/node-disk-manager/api/v1alpha1" + "github.com/openebs/node-disk-manager/blockdevice" ) // Filter selects a single block device from a list of block devices @@ -58,10 +60,12 @@ func (c *Config) getCandidateDevices(bdList *apis.BlockDeviceList) (*apis.BlockD FilterBlockDeviceName, ) } else { + if c.ClaimSpec.DeviceType != blockdevice.SparseBlockDeviceType { + // Unless explicitly specify DeviceType as sparse, device sparse will not be included + filterKeys = append(filterKeys, FilterOutSparseBlockDevices) + } + filterKeys = append(filterKeys, - // Sparse BDs can be claimed only by manual selection. Therefore, all - // sparse BDs will be filtered out in auto mode - FilterOutSparseBlockDevices, FilterDeviceType, FilterVolumeMode, FilterNodeName,