(#12) List active vms for a given token

This commit updates the list command to add a flag --active. It will
list all active vms based on the given token as well as what template
they are and how long they've been running for. As a result, this also
updates how the delete --all command formats running vms.
This commit is contained in:
Brian Cain 2015-11-15 15:12:06 -08:00 committed by Brian Cain
parent 2a5e5ba9bb
commit 6447a5f217
2 changed files with 36 additions and 6 deletions

View file

@ -41,10 +41,18 @@ class Utils
os_types
end
def self.prettyprint_hosts(hosts)
def self.prettyprint_hosts(hosts, verbose, url)
puts "Running VMs:"
hosts.each do |vm|
puts "- #{vm}"
vm_info = Pooler.query(verbose, url, vm)
if vm_info['ok']
domain = vm_info[vm]['domain']
template = vm_info[vm]['template']
lifetime = vm_info[vm]['lifetime']
running = vm_info[vm]['running']
puts "- #{vm}#{domain} (#{running}/#{lifetime} hours)"
end
end
end
end