Skip to content

Commit

Permalink
fix(eventhandler): add all devices to hierarchy before filtering (#538)
Browse files Browse the repository at this point in the history

Signed-off-by: Akhil Mohan <[email protected]>
  • Loading branch information
akhilerm authored Feb 3, 2021
1 parent 0708507 commit 8afeabd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/538-akhilerm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add all devices to hierarchy cache irrespective of whether the blockdevice will be filtered or not.
2 changes: 0 additions & 2 deletions cmd/ndm_daemonset/probe/addhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ func (pe *ProbeEvent) addBlockDeviceToHierarchyCache(bd blockdevice.BlockDevice)
// addBlockDevice processed when an add event is received for a device
func (pe *ProbeEvent) addBlockDevice(bd blockdevice.BlockDevice, bdAPIList *apis.BlockDeviceList) error {

pe.addBlockDeviceToHierarchyCache(bd)

// handle devices that are not managed by NDM
// eg:devices in use by mayastor, zfs PV and jiva
// TODO jiva handling is still to be added.
Expand Down
7 changes: 7 additions & 0 deletions cmd/ndm_daemonset/probe/eventhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ func (pe *ProbeEvent) addBlockDeviceEvent(msg controller.EventMessage) {
for _, device := range msg.Devices {
klog.Infof("Processing details for %s", device.DevPath)
pe.Controller.FillBlockDeviceDetails(device)

// add all devices to the hierarchy cache, irrespective of whether they will be
// filtered at a later stage. This is done so that a complete disk hierarchy is available
// at all times by NDM. It also helps in device processing when complex filter configurations
// are provided. Ref: https://github.com/openebs/openebs/issues/3321
pe.addBlockDeviceToHierarchyCache(*device)

// if ApplyFilter returns true then we process the event further
if !pe.Controller.ApplyFilter(device) {
continue
Expand Down

0 comments on commit 8afeabd

Please sign in to comment.