mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
feature #1739: EC2 information manager returns information encoded in base64
This commit is contained in:
parent
e8a3f17ef0
commit
19f18aa3bb
@ -28,6 +28,7 @@ $: << RUBY_LIB_LOCATION
|
||||
|
||||
require 'pp'
|
||||
require 'OpenNebulaDriver'
|
||||
require 'base64'
|
||||
|
||||
# The EC2 Information Manager Driver
|
||||
class EC2InformationManagerDriver < OpenNebulaDriver
|
||||
@ -57,15 +58,16 @@ class EC2InformationManagerDriver < OpenNebulaDriver
|
||||
totalmemory = smem + lmem + xlmem
|
||||
totalcpu = scpu + lcpu + xlcpu
|
||||
|
||||
@info="HYPERVISOR=ec2,TOTALMEMORY=#{totalmemory},"<<
|
||||
"TOTALCPU=#{totalcpu},CPUSPEED=1000,FREEMEMORY=#{totalmemory},"<<
|
||||
"FREECPU=#{totalcpu}"
|
||||
@info="HYPERVISOR=ec2\nTOTALMEMORY=#{totalmemory}\n"<<
|
||||
"TOTALCPU=#{totalcpu}\nCPUSPEED=1000\nFREEMEMORY=#{totalmemory}"<<
|
||||
"\nFREECPU=#{totalcpu}\n"
|
||||
end
|
||||
|
||||
# The monitor action, just print the capacity info and hostname
|
||||
def action_monitor(num, host, not_used)
|
||||
send_message("MONITOR", RESULT[:success], num,
|
||||
"HOSTNAME=#{host},#{@info}")
|
||||
info = "HOSTNAME=\"#{host}\"\n#{@info}"
|
||||
info64 = Base64::encode64(info).strip.delete("\n")
|
||||
send_message("MONITOR", RESULT[:success], num, info64)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user