@OrFail("Upgrading file storage paths")
  def UpgradeFileStoragePaths(self):
    # Write file storage paths
    if not os.path.exists(self.opts.FILE_STORAGE_PATHS_FILE):
      cluster = self.config_data["cluster"]
      file_storage_dir = cluster.get("file_storage_dir")
      shared_file_storage_dir = cluster.get("shared_file_storage_dir")
      del cluster

      logging.info("Ganeti 2.7 and later only allow whitelisted directories"
                   " for file storage; writing existing configuration values"
                   " into '%s'",
                   self.opts.FILE_STORAGE_PATHS_FILE)

      if file_storage_dir:
        logging.info("File storage directory: %s", file_storage_dir)
      if shared_file_storage_dir:
        logging.info("Shared file storage directory: %s",
                     shared_file_storage_dir)

      buf = StringIO()
      buf.write("# List automatically generated from configuration by\n")
      buf.write("# cfgupgrade at %s\n" % time.asctime())
      if file_storage_dir:
        buf.write("%s\n" % file_storage_dir)
      if shared_file_storage_dir:
        buf.write("%s\n" % shared_file_storage_dir)
      utils.WriteFile(file_name=self.opts.FILE_STORAGE_PATHS_FILE,
                      data=buf.getvalue(),
                      mode=0600,
                      dry_run=self.opts.dry_run,
                      backup=True)
dataset/ETHPy150Open ganeti/ganeti/lib/tools/cfgupgrade.py/CfgUpgrade.UpgradeFileStoragePaths/original