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:
Noah Watkins
2019-04-26 09:37:25 -07:00
parent ed157dbd0c
commit fbc64ff8f4
2 changed files with 25 additions and 2 deletions
+2 -2
View File
@@ -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)
}
+23
View File
@@ -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)