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

This commit is contained in:
Alejandro Huertas Herrero authored and Ruben S. Montero committed 2019-06-10 12:27:26 +02:00
1 parent c165825dbd
commit 8e15a56dff
1 file changed
+20 -1
+20 -1
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