Sha256: 915600bab4faa115dadfaf59764c2c03c84d728c2bfaf2f928bb8d3907f5e26a

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

class SystemVm < CloudstackCli::Base

  desc 'list', 'list system VMs'
  option :zone, desc: "the name of the availability zone"
  option :state, desc: "state of the system VM"
  def list
    vms = client.list_system_vms(options)
    if vms.size < 1
      say "No system vms found."
    else
      table = [["Zone", "State", "Type", "Name"]]
      vms.each do |vm|
        table << [
          vm['zonename'], vm['state'], vm['systemvmtype'], vm['name']
        ]
      end
      print_table table
      say "Total number of system vms: #{vms.size}"
    end
  end

  desc 'show [name]', 'show system vm'
  option :zone
  def show(name)
    vms = client.list_system_vms(options)
    vms = filter_by(vms, 'name', name)
    vm = vms.first
    unless vm
      say "No system vm with name #{name} found."
    else
      table = vm.map do |key, value|
        [ set_color("#{key}:", :yellow), "#{value}" ]
      end
      print_table table
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudstack-cli-0.14.0 lib/cloudstack-cli/commands/system_vm.rb