Puppet Plan: powerstore::capacity_volumes

Defined in:
plans/capacity_volumes.pp

Overview

list volumes with more than given capacity

Parameters:

  • threshold (Variant[Numeric,String])

    Volume capacity needed (in bytes or MB/GB/TB)

  • targets (TargetSpec)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'plans/capacity_volumes.pp', line 3

plan powerstore::capacity_volumes(
    TargetSpec              $targets,
    Variant[Numeric,String] $threshold,
){
  $volumes = run_task('powerstore::volume_collection_query', $targets).first.value

  $rows = $volumes.filter |$k,$v| { $v['size'] > to_bytes($threshold) }.map |$k,$v| {
    [$k, String($v['size'],'%15s'), String(format_bytes($v['size']),'%10s')]
  }

  $volumes_table = format::table({
    title => "List of volumes with capacity > ${threshold}",
    head => ['volume name', 'capacity', 'MB'].map |$field| { format::colorize($field, yellow) },
    rows => $rows
  })

  out::message($volumes_table)
}