Sha256: 3ad74132ca5ce034d54f3e80be5836790d8dd1e1b284b44ee14d440c93545717

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

class Volume < CloudstackCli::Base

  desc "list", "list volumes"
  option :project, desc: 'list resources by project'
  option :account, desc: 'list resources by account'
  option :keyword, desc: 'list by keyword'
  option :name, desc: 'name of the disk volume'
  option :type, desc: 'type of disk volume (ROOT or DATADISK)'
  def list
    if options[:project]
      projectid = find_project['id']
      options[:project_id] = projectid if projectid
    end
    volumes = client.list_volumes(options)
    if volumes.size < 1
      say "No volumes found."
    else
      table = [%w(Name Type Size VM Storage Offeringname)]
      volumes.each do |volume|
        table << [
          volume['name'], volume['type'],
          (volume['size'] / 1024**3).to_s + 'GB',
          volume['vmname'],
          volume['storage'],
          volume['diskofferingname']
        ]
      end
      print_table(table)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudstack-cli-0.5.5 lib/cloudstack-cli/commands/volume.rb