Skip to content

Commit

Permalink
Merge pull request #254 from iamniting/partition
Browse files Browse the repository at this point in the history
feat: filter child block devices also
  • Loading branch information
openshift-merge-robot authored Sep 29, 2022
2 parents 8bb1ff9 + 30399cc commit 7eac419
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/internal/block_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const (
// DeviceTypeROM is the device type for ROM devices in lsblk output
DeviceTypeROM = "rom"

// DeviceTypeLVM is the device type for lvm devices in lsblk output
DeviceTypeLVM = "lvm"

// mount string to find if a path is part of kubernetes
pluginString = "plugins/kubernetes.io"

Expand Down
2 changes: 2 additions & 0 deletions pkg/vgmanager/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ var FilterMap = map[string]func(internal.BlockDevice, internal.Executor) (bool,
return dev.IsUsableLoopDev(executor)
case internal.DeviceTypeROM:
return false, nil
case internal.DeviceTypeLVM:
return false, nil
default:
return true, nil
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/vgmanager/vgmanager_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,16 @@ DeviceLoop:
// store device in deviceAgeMap
r.deviceAgeMap.storeDeviceAge(blockDevice.KName)

// check for partitions recursively
if blockDevice.HasChildren() {
childAvailableDevices, childDelayedDevices, err := r.filterAvailableDevices(blockDevice.Children)
if err != nil {
return []internal.BlockDevice{}, []internal.BlockDevice{}, err
}
availableDevices = append(availableDevices, childAvailableDevices...)
delayedDevices = append(delayedDevices, childDelayedDevices...)
}

devLogger := r.Log.WithValues("Device.Name", blockDevice.Name)
for name, filter := range FilterMap {
var valid bool
Expand Down

0 comments on commit 7eac419

Please sign in to comment.