Class: Pec::Director::VmStatusDirector
- Defined in:
- lib/pec/director/vm_status_director.rb
Instance Method Summary collapse
- #do_it?(host) ⇒ Boolean
- #err_message(e, host) ⇒ Object
- #execute!(host) ⇒ Object
- #show_summary(host) ⇒ Object
Instance Method Details
#do_it?(host) ⇒ Boolean
9 10 11 |
# File 'lib/pec/director/vm_status_director.rb', line 9 def do_it?(host) true end |
#err_message(e, host) ⇒ Object
32 33 34 35 |
# File 'lib/pec/director/vm_status_director.rb', line 32 def (e, host) puts e.magenta puts "can't create server:#{host.name}".magenta if host end |
#execute!(host) ⇒ Object
4 5 6 7 |
# File 'lib/pec/director/vm_status_director.rb', line 4 def execute!(host) Pec::Resource.set_tenant(host.tenant) show_summary(host) end |
#show_summary(host) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pec/director/vm_status_director.rb', line 13 def show_summary(host) server = Pec::Compute::Server.fetch(host.name) status = "uncreated" compute_node = "" tenant_name = "" flavor = "" ip_address = "" if server detail = Pec::Resource.get.get_server_details(server["id"]) status = detail["status"] compute_node = detail["OS-EXT-SRV-ATTR:host"] flavor = detail["flavor"]["id"] tenant_name = Pec::Compute::Tenant.get_name(detail["tenant_id"]) ip_address = Pec::Director::Helper.parse_from_addresses(detail["addresses"]).join(",") end puts sprintf(" %-35s %-10s %-10s %-10s %-35s %-48s", host.name, status, tenant_name, flavor, compute_node, ip_address) end |