diff --git a/src/cli/one_helper/onehost_helper.rb b/src/cli/one_helper/onehost_helper.rb index 8038cc93a9..52ac87b160 100644 --- a/src/cli/one_helper/onehost_helper.rb +++ b/src/cli/one_helper/onehost_helper.rb @@ -406,8 +406,39 @@ class OneHostHelper < OpenNebulaHelper::OneHelper CLIHelper.print_header(str_h1 % "MONITORING INFORMATION", false) + wilds = host.to_hash['HOST']['TEMPLATE']['VM'] + + host.delete_element("TEMPLATE/VM") + host.delete_element("TEMPLATE_WILDS") + puts host.template_str + puts + CLIHelper.print_header("WILD VIRTUAL MACHINES", false) + puts + + format = "%30s %36s %4s %10s" + CLIHelper.print_header(format % ["NAME", "UUID", "CPU", "MEMORY"], + false) + + wilds.each do |wild| + wild_tmplt = Base64::decode64(wild['IMPORT_TEMPLATE']).split("\n") + name = wild_tmplt.select { |line| + line[/^NAME/] + }[0].split("=")[1].gsub("\"", " ").strip + uuid = wild_tmplt.select { |line| + line[/^IMPORT_VM_ID/] + }[0].split("=")[1].gsub("\"", " ").strip + memory = wild_tmplt.select { |line| + line[/^MEMORY/] + }[0].split("=")[1].gsub("\"", " ").strip + cpu = wild_tmplt.select { |line| + line[/^MEMORY/] + }[0].split("=")[1].gsub("\"", " ").strip + + puts format % [name, uuid, memory, cpu] + end + puts CLIHelper.print_header("VIRTUAL MACHINES", false) puts diff --git a/src/oca/ruby/opennebula/host.rb b/src/oca/ruby/opennebula/host.rb index 1a0980c3c0..5ab9e0f993 100644 --- a/src/oca/ruby/opennebula/host.rb +++ b/src/oca/ruby/opennebula/host.rb @@ -16,6 +16,7 @@ require 'opennebula/pool_element' +require 'base64' module OpenNebula class Host < PoolElement @@ -206,6 +207,12 @@ module OpenNebula SHORT_HOST_STATES[state_str] end + # Returns the