1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

F #3378: add new column to show fed index (#3412)

This commit is contained in:
Alejandro Huertas Herrero 2019-06-10 12:27:26 +02:00 committed by Ruben S. Montero
parent c165825dbd
commit 8e15a56dff

View File

@ -77,12 +77,31 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
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')
return '-' if OpenNebula.is_error?(xml)
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