{%
    local function printData(data)
        local function get_capacity(size)
            local capacity_basic_unit = 1024
            local STORAGE_INFO_INVALID_DWORD = 0xFFFFFFFF
            if size == STORAGE_INFO_INVALID_DWORD then
                return 'N/A'
            elseif size < capacity_basic_unit then -- 小于1TB
                return string.format('%d MB', size)
            elseif size < capacity_basic_unit * capacity_basic_unit then -- 小于1TB
                return string.format('%.3f GB', size / capacity_basic_unit)
            elseif size < capacity_basic_unit * capacity_basic_unit * capacity_basic_unit then -- 小于1PB
                return string.format('%.3f TB', size / (capacity_basic_unit * capacity_basic_unit))
            else
                return string.format('%.3f PB', size / (capacity_basic_unit * capacity_basic_unit * capacity_basic_unit))
            end
        end
        local function print_array_space_info(FreeBlocksArr)
            if not FreeBlocksArr or #FreeBlocksArr == 0 then
                echo('N/A\n')
                return
            end
            for key, value in pairs(FreeBlocksArr) do
                if key > 1 then
                    echo('                                         : ')
                end
                echo('(' .. key .. ')' .. get_capacity(value) .. '\n')
            end
        end
        -- -- 打印Array中的逻辑盘ID
        local function print_array_volume(RefVolumes)
            if #RefVolumes == 0 then
                echo('None')
            elseif #RefVolumes == 1 and RefVolumes[1] == 0xFF then
                echo('N/A')
            else
                for key, value in pairs(RefVolumes) do
                    if key ~= 1 then
                        echo(',' .. value)
                    else
                        echo(value)
                    end
                end
            end
            echo('\n')
        end
        -- 打印Array中的物理盘ID
        local function print_array_drive(pd_list)
            local string_buff = {}
            for k,v in pairs(pd_list) do
                local val = v:sub(5)
                table.insert(string_buff, val)
                table.insert(string_buff, ',')
            end
            if #string_buff == 0 then
                echo('N/A' .. '\n')
            else
                local str_res = table.concat(string_buff)
                echo(str_res:sub(1, #str_res - 1) .. '\n')
            end
        end
        echo('Disk Array Information', '\n')
        echo('----------------------------------------------------------------------', '\n')
        echo('Array ID                                 : ' .. data.Id, '\n')
        echo('Used Space                               : ' .. get_capacity(data.UsedSpaceMiB), '\n')
        echo('Free Space                               : ' .. get_capacity(data.TotalFreeSpaceMiB), '\n')
        echo('Free Blocks Space                        : ')
        print_array_space_info(data.FreeBlocksSpaceMiB)
        echo('Logcial Drive(s) ID                      : ')
        print_array_volume(data.RefVolumes)
        echo('Physical Drive(s) ID                     : ')
        print_array_drive(data.RefDrives)
        echo('----------------------------------------------------------------------\n')
    end

    local match_flag = false
    if type(ControllerList) ~= 'table' or #ControllerList == 0 then
        io.write('Not found RAID controller.')
        return
    end

    -- 获取整型的ControllerId
    if ContollerID < 0 or ContollerID > #ControllerList - 1 then
        io.write(string.format('RAID controller index out of range[0 to %d].', #ControllerList - 1))
        return
    end
    if type(GetDiskList) ~= 'table' or #GetDiskList == 0 then
        io.write('Not Found Disk Array.')
        return
    end
    if Option == 'all' then
        for _, item in pairs(GetDiskList) do
            if item.Id < 0x8000 then -- 0x8000 1880卡span的起始Id
                printData(item)
            end
        end
    else
        local DiskArrayID = math.tointeger(Option)
        -- 输入必须为不带小数点的整数
        if not DiskArrayID or Option ~= tostring(DiskArrayID) then
            io.write('Invalid Disk Array ID.')
            return
        end
        for _, item in pairs(GetDiskList) do
            if item.Id == math.tointeger(Option) then
                match_flag = true
                printData(item)
            end
        end
        if match_flag == false then
            io.write(string.format('Invalid Disk Array ID : %d', math.tointeger(Option)))
        end
    end
%}