def _TestLoadingConfigFile(self):
    # test loading the config file
    all_ok = True
    if not (self.opts.dry_run or self.opts.no_verify):
      logging.info("Testing the new config file...")
      cfg = config.ConfigWriter(cfg_file=self.opts.CONFIG_DATA_PATH,
                                accept_foreign=self.opts.ignore_hostname,
                                offline=True)
      # if we reached this, it's all fine
      vrfy = cfg.VerifyConfig()
      if vrfy:
        logging.error("Errors after conversion:")
        for item in vrfy:
          logging.error(" - %s", item)
        all_ok = False
      else:
        logging.info("File loaded successfully after upgrading")
      del cfg

    if self.opts.downgrade:
      action = "downgraded"
      out_ver = "%s.%s" % (DOWNGRADE_MAJOR, DOWNGRADE_MINOR)
    else:
      action = "upgraded"
      out_ver = constants.RELEASE_VERSION
    if all_ok:
      cli.ToStderr("Configuration successfully %s to version %s.",
                   action, out_ver)
    else:
      cli.ToStderr("Configuration %s to version %s, but there are errors."
                   "\nPlease review the file.", action, out_ver)
dataset/ETHPy150Open ganeti/ganeti/lib/tools/cfgupgrade.py/CfgUpgrade._TestLoadingConfigFile/original