mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #602: Change onevnet show format to separate used, free and 'on hold' leases
This commit is contained in:
parent
f0efbf09b6
commit
536d69b5ab
@ -73,13 +73,19 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
puts str % ["IP_END", vn['RANGE/IP_END']]
|
||||
end
|
||||
|
||||
leases_str = vn.template_like_str('/VNET/LEASES', false)
|
||||
lease_types = [ ["LEASES ON HOLD", 'LEASE[USED=1 and VID=-1]'],
|
||||
["USED LEASES", 'LEASE[USED=1 and VID>-1]'],
|
||||
["FREE LEASES", 'LEASE[USED=0]'] ]
|
||||
|
||||
if !leases_str.empty?
|
||||
puts
|
||||
CLIHelper.print_header(str_h1 % ["LEASES INFORMATION"], false)
|
||||
puts leases_str
|
||||
end
|
||||
lease_types.each { |pair|
|
||||
leases_str = vn.template_like_str('/VNET/LEASES', false, pair[1])
|
||||
|
||||
if !leases_str.empty?
|
||||
puts
|
||||
CLIHelper.print_header(str_h1 % [pair[0]], false)
|
||||
puts leases_str
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def format_pool(options)
|
||||
|
@ -201,7 +201,7 @@ module OpenNebula
|
||||
template_like_str('TEMPLATE', indent)
|
||||
end
|
||||
|
||||
def template_like_str(root_element, indent=true)
|
||||
def template_like_str(root_element, indent=true, xpath_exp=nil)
|
||||
if NOKOGIRI
|
||||
xml_template=@xml.xpath(root_element).to_s
|
||||
rexml=REXML::Document.new(xml_template).root
|
||||
@ -217,7 +217,7 @@ module OpenNebula
|
||||
ind_tab=' '
|
||||
end
|
||||
|
||||
str=rexml.collect {|n|
|
||||
str=rexml.elements.collect(xpath_exp) {|n|
|
||||
if n.class==REXML::Element
|
||||
str_line=""
|
||||
if n.has_elements?
|
||||
|
Loading…
x
Reference in New Issue
Block a user