Exporting and Importing BOS Data

Prerequisites

  • Ensure that the cray command line interface (CLI) is authenticated and configured to talk to system management services.
  • In order to use the automated procedures, the latest CSM documentation RPM must be installed on the node where the procedure is being performed.

Automated procedures

BOS data can be backed up using an automated script. BOS session templates and BOS v2 options can be restored from the archive files produced by the automated export script.

Automated BOS data export

  1. (ncn-mw#) Run the following script to perform the export of all BOS data (including session templates and BOS v2 options).

    /usr/share/doc/csm/scripts/operations/configuration/export_bos_data.sh
    
  2. Copy the archive file it outputs to a safe location.

Automated BOS data import

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

  2. (ncn-mw#) Import all BOS session templates and BOS v2 options.

    Modify the following example commands to specify the path to the output file from the automated BOS export script. The file may be a JSON file or a tgz file, depending on when the backup was made, because the BOS export tools have had multiple versions. Any file produced by any version of these tools will work as input for this restore procedure.

    /usr/share/doc/csm/scripts/operations/configuration/import_bos_data.sh /root/bos-export-20230417181409-oK4WMw.tgz
    

Manual procedures

BOS session templates or BOS v2 options can also be manually exported and imported onto a given system using the Cray CLI tool.

Manually export BOS data

  1. (ncn-mw#) Create a directory to store the exported BOS data.

    Modify the following command to specify the desired directory path.

    BOS_EXPORT_DIR="/root/bos-data-manual-export-$(date +%Y%m%d%H%M%S)"
    mkdir -pv "${BOS_EXPORT_DIR}"
    
  2. (ncn-mw#) Save the current BOS v2 options on the system.

    cray bos v2 options list --format json | tee "${BOS_EXPORT_DIR}/options.json"
    
  3. (ncn-mw#) List all BOS session templates on the system.

    cray bos v2 sessiontemplates list
    
  4. (ncn-mw#) Make a subdirectory for the session templates.

    mkdir -pv "${BOS_EXPORT_DIR}/templates"
    
  5. (ncn-mw#) For each session template that you wish to export, perform the following steps.

    1. Record the name of the template to be exported.

      Modify the following command to specify the name of the BOS session template to be exported.

      BOS_TEMPLATE_NAME="uan-sessiontemplate-2.0.27"
      
    2. Write the contents of the session template to a file in the export directory created earlier.

      cray bos v2 sessiontemplates describe "${BOS_TEMPLATE_NAME}" --format json |
          tee "${BOS_EXPORT_DIR}/templates/${BOS_TEMPLATE_NAME}.json"
      

      Example output:

      {
        "boot_sets": {
          "uan": {
            "kernel_parameters": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=nmn0:dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y quiet rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 ifmap=net2:nmn0,lan0:hsn0,lan1:hsn1 spire_join_token=${SPIRE_JOIN_TOKEN}",
            "node_list": [
              "x3000c0s15b0n0"
            ],
            "path": "s3://boot-images/c23f3d5e-223a-4fb9-b305-0c2be8e63615/manifest.json",
            "rootfs_provider": "cpss3",
            "rootfs_provider_passthrough": "dvs:api-gw-service-nmn.local:300:nmn0",
            "type": "s3"
          }
        },
        "cfs": {
          "configuration": "uan-config-2.0.0"
        },
        "enable_cfs": true,
        "name": "uan-sessiontemplate-2.0.27"
      }
      
  6. Copy the contents of the export directory to a safe location.

Manually import BOS data

  1. (ncn-mw#) Copy the contents of the export directory (created from the manual export procedure) to the node where the import procedure is being performed.

    Set the BOS_EXPORT_DIR variable to the path to this directory.

    Modify the following command to specify the actual path to the directory.

    BOS_EXPORT_DIR=/root/bos-bos-datas-manual-export-20230309121244
    
  2. (ncn-mw#) For each BOS session template to be imported, perform the following steps:

    1. Record the name of the template to be imported.

      Modify the following command to specify the name of the BOS session template to be exported.

      BOS_TEMPLATE_NAME="uan-sessiontemplate-2.0.27"
      BOS_TEMPLATE_FILE="${BOS_EXPORT_DIR}/${BOS_TEMPLATE_NAME}.json"
      
    2. Import the session template into BOS.

      cray bos v2 sessiontemplates create \
             --file <(jq 'del(.name)' "${BOS_TEMPLATE_FILE}") \
             "${BOS_TEMPLATE_NAME}" --format json
      

      If successful, the command will output the entire session template in JSON.

  3. (ncn-mw#) The CLI can also be used to change BOS v2 options to match the values that were exported.

    For usage details, run the following:

    cray bos v2 options update --help
    

BOS database PVCs

Since the release of BOS V2, it is recommended not to save or restore the BOS Redis database. Instead, let BOS automatically recreate the databases from scratch. Restoring the database can result in undesired activity, such as node boots or reboots.