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 7bcde30
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 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,32 @@ 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 OpenNebula.is_error?(xml)
'-'
end

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 7bcde30

Please sign in to comment.