Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 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,31 @@ 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')

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
Expand Down