forked from rook/rook
ceph: check for equiv device config maps in operator
this is an attempt to reduce the number of false positive config map updates used to trigger orchestration for hotplugging. Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
@@ -193,7 +193,7 @@ func udevBlockMonitor(c chan string, period time.Duration) {
|
||||
}
|
||||
}
|
||||
|
||||
func deviceListsEqual(a, b string) (bool, error) {
|
||||
func DeviceListsEqual(a, b string) (bool, error) {
|
||||
var d0 []sys.LocalDisk
|
||||
var d1 []sys.LocalDisk
|
||||
|
||||
@@ -264,7 +264,7 @@ func updateDeviceCM(context *clusterd.Context) error {
|
||||
}
|
||||
lastDevice = deviceStr
|
||||
}
|
||||
devicesEqual, err := deviceListsEqual(deviceStr, lastDevice)
|
||||
devicesEqual, err := DeviceListsEqual(deviceStr, lastDevice)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to compare device lists: %v", err)
|
||||
}
|
||||
|
||||
@@ -543,6 +543,29 @@ func (c *ClusterController) onDeviceCMUpdate(oldObj, newObj interface{}) {
|
||||
}
|
||||
logger.Debugf("onDeviceCMUpdate new device cm: %+v", newCm)
|
||||
|
||||
oldDevStr, ok := oldCm.Data[discoverDaemon.LocalDiskCMData]
|
||||
if !ok {
|
||||
logger.Warningf("unexpected configmap data")
|
||||
return
|
||||
}
|
||||
|
||||
newDevStr, ok := newCm.Data[discoverDaemon.LocalDiskCMData]
|
||||
if !ok {
|
||||
logger.Warningf("unexpected configmap data")
|
||||
return
|
||||
}
|
||||
|
||||
devicesEqual, err := discoverDaemon.DeviceListsEqual(oldDevStr, newDevStr)
|
||||
if err != nil {
|
||||
logger.Warningf("failed to compare device lists: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if devicesEqual {
|
||||
logger.Infof("device lists are equal. skipping orchestration")
|
||||
return
|
||||
}
|
||||
|
||||
for _, cluster := range c.clusterMap {
|
||||
logger.Infof("Running orchestration for namespace %s after device change", cluster.Namespace)
|
||||
err := cluster.createInstance(c.rookImage, cluster.Info.CephVersion)
|
||||
|
||||
Reference in New Issue
Block a user