Upgrades and Downgrades now take into account the config fields used by the diagnose data collector
Signed-off-by: BSRK Aditya <[email protected]> --- lib/tools/cfgupgrade.py | 11 +++++++++++ test/py/cfgupgrade_unittest.py | 2 ++ 2 files changed, 13 insertions(+) diff --git a/lib/tools/cfgupgrade.py b/lib/tools/cfgupgrade.py index 90fe2c9..cca8bbf 100644 --- a/lib/tools/cfgupgrade.py +++ b/lib/tools/cfgupgrade.py @@ -331,6 +331,8 @@ class CfgUpgrade(object): cluster["data_collectors"].get( name, dict(active=True, interval=constants.MOND_TIME_INTERVAL * 1e6)) + if "diagnose_data_collector_filename" not in cluster: + cluster["diagnose_data_collector_filename"] = "" @OrFail("Upgrading groups") def UpgradeGroups(self): @@ -711,6 +713,15 @@ class CfgUpgrade(object): def DowngradeAll(self): if "maintenance" in self.config_data: del self.config_data["maintenance"] + if "cluster" in self.config_data: + cluster = self.config_data["cluster"] + if "diagnose_data_collector_filename" in cluster: + del cluster["diagnose_data_collector_filename"] + if ("data_collectors" in cluster and + constants.DATA_COLLECTOR_DIAGNOSE in + cluster["data_collectors"]): + del (cluster["data_collectors"] + [constants.DATA_COLLECTOR_DIAGNOSE]) self.config_data["version"] = version.BuildVersion(DOWNGRADE_MAJOR, DOWNGRADE_MINOR, 0) return True diff --git a/test/py/cfgupgrade_unittest.py b/test/py/cfgupgrade_unittest.py index a436351..4c8a8ff 100755 --- a/test/py/cfgupgrade_unittest.py +++ b/test/py/cfgupgrade_unittest.py @@ -67,6 +67,7 @@ def GetMinimalConfig(): "compression_tools": constants.IEC_DEFAULT_TOOLS, "enabled_user_shutdown": False, "data_collectors": { + "diagnose": { "active": True, "interval": 5000000 }, "diskstats": { "active": True, "interval": 5000000 }, "drbd": { "active": True, "interval": 5000000 }, "lv": { "active": True, "interval": 5000000 }, @@ -74,6 +75,7 @@ def GetMinimalConfig(): "cpu-avg-load": { "active": True, "interval": 5000000 }, "xen-cpu-avg-load": { "active": True, "interval": 5000000 }, }, + "diagnose_data_collector_filename": "", }, "instances": {}, "disks": {}, -- 1.7.10.4
