Skip to content

Commit

Permalink
F OpenNebula#3378: add new column to show fed index
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Huertas committed Jun 10, 2019
1 parent 079d5d7 commit 295f8c0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/cli/one_helper/onezone_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,28 @@ def format_pool(options)
d["TEMPLATE"]['ENDPOINT']
end

default :CURRENT, :ID, :NAME, :ENDPOINT
column :FED_INDEX, "Federation index", :left, :size=>10 do |d|
helper.get_fed_index(d["TEMPLATE"]['ENDPOINT'])
end

default :CURRENT, :ID, :NAME, :ENDPOINT, :FED_INDEX
end

table
end

def get_fed_index(endpoint)
client = OpenNebula::Client.new(nil, endpoint, :timeout => 5)
xml = client.call('zone.raftstatus')
xml = Nokogiri::XML(xml)

if xml.xpath('RAFT/FEDLOG_INDEX')
xml.xpath('RAFT/FEDLOG_INDEX').text
else
'-'
end
end

def set_zone(zone_id, temporary_zone)
zone = factory(zone_id)
rc = zone.info
Expand Down

0 comments on commit 295f8c0

Please sign in to comment.