def migrate_config(self):
        # do migration one at a time, starting at the current one...
        current_version = self._stored_config_version()
        # Something is really fishy. We don't want to downgrade the configuration.
        if current_version >= self.CURRENT_CONFIG_VERSION:
            raise ConfigError("The existing config file is available in a later version already. Expected version <= [%s] but found [%s]"
                              % (self.CURRENT_CONFIG_VERSION, current_version))
        logger.info("Upgrading configuration from version [%s] to [%s]." % (current_version, self.CURRENT_CONFIG_VERSION))
        # but first a backup...
        self._config_file.backup()
        config = self._config_file.load(interpolation=None)

        if current_version == 0:
            logger.info("Migrating config from version [0] to [1]")
            current_version = 1
            config["meta"] = {}
            config["meta"]["config.version"] = str(current_version)
            # in version 1 we changed some directories from being absolute to being relative
            config["system"]["log.root.dir"] = "logs"
            config["provisioning"]["local.install.dir"] = "install"
            config["reporting"]["report.base.dir"] = "reports"
        if current_version == 1:
            logger.info("Migrating config from version [1] to [2]")
            current_version = 2
            config["meta"]["config.version"] = str(current_version)
            # Give the user a hint what's going on
            print("Metrics data are now stored in a dedicated Elasticsearch instance. Please provide details below")
            data_store_host, data_store_port, data_store_secure, data_store_user, data_store_password = self._ask_data_store()
            config["reporting"]["datastore.host"] = data_store_host
            config["reporting"]["datastore.port"] = data_store_port
            config["reporting"]["datastore.secure"] = data_store_secure
            config["reporting"]["datastore.user"] = data_store_user
            config["reporting"]["datastore.password"] = data_store_password
            env_name = self._ask_env_name()
            config["system"]["env.name"] = env_name
        if current_version == 2:
            logger.info("Migrating config from version [2] to [3]")
            current_version = 3
            config["meta"]["config.version"] = str(current_version)
            # Remove obsolete settings
            config["reporting"].pop("report.base.dir")
            config["reporting"].pop("output.html.report.filename")


            # all migrations done
        self._config_file.store(config)
        logger.info("Successfully self-upgraded configuration to version [%s]" % self.CURRENT_CONFIG_VERSION)
dataset/ETHPy150Open elastic/rally/esrally/config.py/Config.migrate_config/original