github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/deploy/dev/k8s/utils/parse_fsparams.sh (about)

     1  #!/bin/bash
     2  
     3  ###################################
     4  #
     5  # fspaths config is used if and only if test_fspath_cnt == 0
     6  # existence of each fspath is checked at runtime
     7  #
     8  ###################################
     9  
    10  # Function to check if a value is a number
    11  is_number() {
    12      if ! [[ $1 =~ ^[0-9]+$ ]]; then
    13          echo "Error: Not a valid number." >&2
    14          exit 1
    15      fi
    16  }
    17  
    18  echo "Select AIStore deployment type"
    19  echo "  1: Development and test (emulated disks and mountpaths)"
    20  echo "  2: Production (one or more formatted data drives, one drive per mountpath)"
    21  echo "Enter your choice (1 or 2):"
    22  read -r cache_source
    23  
    24  if [[ $cache_source -eq 1 ]]; then
    25      echo "Enter the number of emulated disks/mountpaths:"
    26      read -r test_fspath_cnt
    27      is_number "$test_fspath_cnt"
    28  elif [[ $cache_source -eq 2 ]]; then
    29      echo "Enter filesystem info in comma-separated format (e.g., /tmp/ais1,/tmp/ais):"
    30      read -r fsinfo
    31      fspath=""
    32      IFS=',' read -r -a array <<< "$fsinfo"
    33      for element in "${array[@]}"; do
    34          fspath="$fspath,\"$element\" : {} "
    35      done
    36      fspath=${fspath#","}
    37  else
    38      echo "Invalid choice. Please select 1 or 2." >&2
    39      exit 1
    40  fi
    41  
    42  # Export variables
    43  export AIS_FS_PATHS=${fspath}
    44  export TEST_FSPATH_COUNT=${test_fspath_cnt}