Exporting and Importing CFS Data

Prerequisites

  • Ensure that the cray command line interface (CLI) is authenticated and configured to talk to system management services.
  • The latest CSM documentation RPM must be installed on the node where the procedure is being performed.
  • If importing both CFS and VCS data, the VCS import should be done before the CFS import.

Export

  1. (ncn-mw#) Run the following script to create a backup of the current CFS components, configurations, options, sessions, and sources.

    /usr/share/doc/csm/scripts/operations/configuration/export_cfs_data.sh
    

    Expected output ends in a line resembling the following:

    SUCCESS: CFS data stored in file: /tmp/cfs-export-20230410170613-Tg0nap.tgz
    
  2. Copy the archive file it outputs to a safe location.

  3. Back up Vault data, if any CFS sources are defined.

    CFS sources store their credentials in Vault. If any CFS sources are defined, then a CFS export is not complete without also backing up the Vault data.

    1. (ncn-mw#) Check if any CFS sources are defined.

      cray cfs v3 sources list --limit 1
      
    2. If any sources are defined, backup the Vault data.

      For information on Vault backup and restore, see Backup and recovery: Vault.

Import

An automated tool is provided to import data from the archive file created by the export_cfs_data.sh script.

Import tool overview

This tool does the following things:

  • The live system will have its CFS options modified to match those in the archive file, for any that differ.
  • For all CFS sources in the archive file, if a CFS source with the same name does not exist on the live system, then the CFS source will be restored on the live system.
    • Note: The restore does not recreate the associated Vault secret, which contains the source credentials. Backup and restore of the Vault data must be handled separately. For information on Vault backup and restore, see Backup and recovery: Vault.
  • For all CFS configurations in the archive file, if a CFS configuration with the same name does not exist on the live system, then the CFS configuration will be created on the live system.
    • Note: No validation is performed of the layers of these configurations to ensure that their repository links and commit hashes exist on the system.
  • For all CFS components in the archive file, their desired configurations will be updated onto the corresponding component on the live system if all of the following criteria are met:
    • The component exists in CFS on the live system.
    • The CFS component in the archive has a desired configuration set.
    • The CFS component on the live system does NOT have a desired configuration set.
    • The desired configuration for this component in the archive either already exists on the live system, or is going to be created as part of this import process.
  • If the --clear-cfs option is specified, then before deciding which changes need to be imported, the tool will delete all configurations in CFS and will clear the state, desired configuration, and error counts of all components in CFS.

The script takes a snapshot of the live system CFS data before it makes any changes, and after all changes have been made. The output of the script lists all of the updates it is making, as well as any updates that it is not performing because of the criteria listed above.

Import tool procedure

  1. Restore Vault data, if necessary.

    For information on Vault backup and restore, see Backup and recovery: Vault.

  2. Copy the file generated by the export script on the node where the import procedure is being performed.

  3. (ncn-mw#) Run the following script to import the data from the archive file.

    Modify the following example commands to specify the path to the output file from the automated export script.

    • If this import is not happening after a reinstall of CSM, OR if VCS data was not imported from a previous CSM install, then invoke the tool as follows:

      /usr/share/doc/csm/scripts/operations/configuration/import_cfs_data.sh /tmp/cfs-export-20230410170613-Tg0nap.tgz
      
    • If the CFS import is being done after a reinstall of CSM AND if VCS data from a prior CSM install has been imported, then invoke the tool with the --clear-cfs option. This is because the CFS data created during the reinstall of CSM will not match the re-imported VCS data.

      /usr/share/doc/csm/scripts/operations/configuration/import_cfs_data.sh --clear-cfs /tmp/cfs-export-20230410170613-Tg0nap.tgz