Skip to content

Commit a02ddc6

Browse files
committed
Allow claim sparse device
Signed-off-by: Nobi <[email protected]>
1 parent 6863cc2 commit a02ddc6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/select/blockdevice/select.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package blockdevice
1818

1919
import (
2020
"fmt"
21+
2122
apis "github.com/openebs/node-disk-manager/api/v1alpha1"
23+
"github.com/openebs/node-disk-manager/blockdevice"
2224
)
2325

2426
// 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
5860
FilterBlockDeviceName,
5961
)
6062
} else {
63+
if c.ClaimSpec.DeviceType != blockdevice.SparseBlockDeviceType {
64+
// Unless explicitly specify DeviceType as sparse, device sparse will not be included
65+
filterKeys = append(filterKeys, FilterOutSparseBlockDevices)
66+
}
67+
6168
filterKeys = append(filterKeys,
62-
// Sparse BDs can be claimed only by manual selection. Therefore, all
63-
// sparse BDs will be filtered out in auto mode
64-
FilterOutSparseBlockDevices,
6569
FilterDeviceType,
6670
FilterVolumeMode,
6771
FilterNodeName,

0 commit comments

Comments
 (0)