Skip to content

Commit

Permalink
Allow claim sparse device
Browse files Browse the repository at this point in the history
Signed-off-by: Nobi <[email protected]>
  • Loading branch information
nobiit committed Sep 27, 2022
1 parent 6863cc2 commit a02ddc6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/select/blockdevice/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a02ddc6

Please sign in to comment.