1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

Show VMs that use the image in oneimage show

This commit is contained in:
Javi Fontan 2013-01-31 17:57:42 +01:00
parent ddca48fd8c
commit 15f718d994
2 changed files with 23 additions and 1 deletions

View File

@ -315,7 +315,15 @@ EOT
pool_to_array(pool)
}
else
table.show(pool_to_array(pool), options)
array=pool_to_array(pool)
if options[:ids]
array=array.select do |element|
options[:ids].include? element['ID'].to_i
end
end
table.show(array, options)
end
return 0

View File

@ -15,6 +15,7 @@
#--------------------------------------------------------------------------- #
require 'one_helper'
require 'one_helper/onevm_helper'
class OneImageHelper < OpenNebulaHelper::OneHelper
TEMPLATE_OPTIONS=[
@ -298,6 +299,19 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
CLIHelper.print_header(str_h1 % "IMAGE TEMPLATE",false)
puts image.template_str
puts
CLIHelper.print_header("VIRTUAL MACHINES", false)
puts
vms=image.retrieve_elements("VMS/ID")
if vms
vms.map!{|e| e.to_i }
onevm_helper=OneVMHelper.new
onevm_helper.client=@client
onevm_helper.list_pool({:ids=>vms}, false)
end
end
def self.create_image_variables(options, name)