#! /bin/bash

_install() {
    if [[ $RaidType = "HP_RAID" ]];then
        if [[ $UCLOUD_MACHINE_TYPE = "H2.U2.V4.12.22" ]] ;then
            ssacli ctrl slot=0 array a modify ssdsmartpath=disable
            ssacli ctrl slot=0 ld 1 modify caching=enable
            cache_status=$(ssacli ctrl slot=0 show detail |grep -i 'cache status')
            if [[ ! $cache_status =~ "OK" ]] ;then
                PRINT_ERR "[ERROR] RAID CARD CACHE Enable failed.请检查RAID电池并重试"
                return 1
            fi
        fi
    fi
}

_check() {
    _check="PASS"
    if [[ $RaidType = "HP_RAID" ]];then
        if [[ $UCLOUD_MACHINE_TYPE = "H2.U2.V4.12.22" ]] ;then
            cache_status=$(ssacli ctrl slot=0 show detail |grep -i 'cache status')
            if [[ ! $cache_status =~ "OK" ]] ;then
                _check="FAIL"
                PRINT_ERR "[ERROR] RAID CARD CACHE Enable failed."
                return 1
            fi
        fi
    fi
}
