diff --git a/changelogs/unreleased/538-akhilerm b/changelogs/unreleased/538-akhilerm new file mode 100644 index 000000000..3c16ec5a9 --- /dev/null +++ b/changelogs/unreleased/538-akhilerm @@ -0,0 +1 @@ +add all devices to hierarchy cache irrespective of whether the blockdevice will be filtered or not. \ No newline at end of file diff --git a/cmd/ndm_daemonset/probe/addhandler.go b/cmd/ndm_daemonset/probe/addhandler.go index 603bf822a..40a04f5e1 100644 --- a/cmd/ndm_daemonset/probe/addhandler.go +++ b/cmd/ndm_daemonset/probe/addhandler.go @@ -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. diff --git a/cmd/ndm_daemonset/probe/eventhandler.go b/cmd/ndm_daemonset/probe/eventhandler.go index d15f05132..7b982791c 100644 --- a/cmd/ndm_daemonset/probe/eventhandler.go +++ b/cmd/ndm_daemonset/probe/eventhandler.go @@ -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