#!/bin/bash DO_JSON=0 MY_PATH=$(dirname $0) DATA_DRIVES="unknown" dgx1_data_drives() { other_data_drives "${1}" "${2}" } dgx2_data_drives() { other_data_drives "${1}" "${2}" } dcs_data_drives() { other_data_drives "${1}" "${2}" } dcs_legacy_data_drives() { other_data_drives "${1}" "${2}" } c2_ovx_data_drives() { other_data_drives "${1}" "${2}" } c2_io_data_drives() { other_data_drives "${1}" "${2}" } dgx_a800_data_drives() { other_data_drives "${1}" "${2}" } dgx_a100_data_drives() { other_data_drives "${1}" "${2}" } dgx_h100_data_drives() { other_data_drives "${1}" "${2}" } dgx_h200_data_drives() { other_data_drives "${1}" "${2}" } dgx_h800_data_drives() { other_data_drives "${1}" "${2}" } dgx_b200_data_drives() { other_data_drives "${1}" "${2}" } dgx_b300_data_drives() { other_data_drives "${1}" "${2}" } dgx_gb200_data_drives() { other_data_drives "${1}" "${2}" } dgx_gb300_data_drives() { other_data_drives "${1}" "${2}" } dgx_gb300ws_data_drives() { other_data_drives "${1}" "${2}" } dgxstation_data_drives() { other_data_drives "${1}" "${2}" } dgxstation_a100_data_drives() { other_data_drives "${1}" "${2}" } dgxstation_a800_data_drives() { other_data_drives "${1}" "${2}" } l4t_ut2_1_data_drives() { other_data_drives "${1}" "${2}" } kvm_data_drives() { other_data_drives "${1}" "${2}" } xen_data_drives() { other_data_drives "${1}" "${2}" } vbox_data_drives() { other_data_drives "${1}" "${2}" } l4t_cg4_data_drives() { other_data_drives "${1}" "${2}" } l4t_c2_data_drives() { other_data_drives "${1}" "${2}" } l4t_cg1_data_drives() { other_data_drives "${1}" "${2}" } l4t_keystone_data_drives() { other_data_drives "${1}" "${2}" } l4t_oberon_data_drives() { other_data_drives "${1}" "${2}" } l4t_smcmgx_data_drives() { other_data_drives "${1}" "${2}" } other_data_drives() { bootdevs="${1}" alldevs="${2}" ISBOOTDEV="false" RETDRIVES="unknown" # we'll consider all disks that aren't boot drives to be data drives for dev in ${alldevs}; do ISBOOTDEV="false" # check if it's a boot device for bdev in ${bootdevs}; do if [ "${dev}" = "${bdev}" ]; then ISBOOTDEV="true" break fi done if [ "${ISBOOTDEV}" = "false" ]; then # check if purpose has been changed source $(get_drive_config_file) > /dev/null 2>&1 DEV_USCORES="DP_$(dev_name_to_underscores ${dev})" if [[ -z ${!DEV_USCORES} || ${!DEV_USCORES} = "data" ]]; then if [ "${RETDRIVES}" = "unknown" ]; then RETDRIVES="${dev}" else RETDRIVES="${RETDRIVES} ${dev}" fi fi fi done echo "${RETDRIVES}" } output_results_json() { DATA_DRIVES_LIST=$(list_to_json "${DATA_DRIVES}") echo "{" echo " \"data_drives\": ${DATA_DRIVES_LIST}" echo "}" } output_results() { do_json=${1} if [ ${do_json} -eq 1 ]; then output_results_json else DATA_DRIVES_LIST=$(list_to_human_readable "${DATA_DRIVES}") echo "data_drives:${DATA_DRIVES_LIST}" fi } ### MAIN ### source ${MY_PATH}/general_funcs.bash source ${MY_PATH}/device_funcs.bash source ${MY_PATH}/plat_funcs.bash must_run_as_root PRODUCT_NAME=$(get_system_product_name) PLAT_SHORT="other" ALL_DISKS="unknown" arg_has_json "$@" if [ $? -eq 0 ]; then DO_JSON=1 fi ALL_DISKS=$(list_devices disk | sort | tr '\n' ' ') PLAT_SHORT=$(get_platform_short "${PRODUCT_NAME}") BOOT_DRIVES=$(${MY_PATH}/get_boot_drives.bash | cut -d':' -f2 | sed 's/,/ /g') DATA_DRIVES=$(${PLAT_SHORT}_data_drives "${BOOT_DRIVES}" "${ALL_DISKS}") output_results ${DO_JSON} exit 0