mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-05 21:57:24 +03:00
feature #595: comments and code formatting
This commit is contained in:
parent
6b4243acc4
commit
2b321e2687
@ -31,14 +31,11 @@ $: << RUBY_LIB_LOCATION
|
||||
require 'OpenNebulaDriver'
|
||||
require 'CommandManager'
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# The SSH Information Manager Driver
|
||||
#-------------------------------------------------------------------------------
|
||||
class DummyInformationManager < OpenNebulaDriver
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Init the driver
|
||||
#---------------------------------------------------------------------------
|
||||
def initialize(num)
|
||||
super('',
|
||||
:concurrency => num,
|
||||
@ -49,9 +46,7 @@ class DummyInformationManager < OpenNebulaDriver
|
||||
register_action(:MONITOR, method("action_monitor"))
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Execute the sensor array in the remote host
|
||||
#---------------------------------------------------------------------------
|
||||
def action_monitor(number, host, not_used)
|
||||
results = "HYPERVISOR=dummy,"
|
||||
results << "HOSTNAME=#{host},"
|
||||
@ -70,11 +65,9 @@ class DummyInformationManager < OpenNebulaDriver
|
||||
end
|
||||
end
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Information Manager main program
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
im = DummyInformationManager.new(15)
|
||||
im.start_driver
|
||||
|
@ -29,18 +29,15 @@ $: << RUBY_LIB_LOCATION
|
||||
require 'pp'
|
||||
require 'OpenNebulaDriver'
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# The EC2 Information Manager Driver
|
||||
#-------------------------------------------------------------------------------
|
||||
class EC2InformationManagerDriver < OpenNebulaDriver
|
||||
#---------------------------------------------------------------------------
|
||||
# Init the driver, and compute the predefined maximum capacity for this
|
||||
# EC2 cloud
|
||||
#---------------------------------------------------------------------------
|
||||
def initialize()
|
||||
super('im'
|
||||
:concurrency => 1,
|
||||
:threaded => false)
|
||||
:threaded => false
|
||||
)
|
||||
|
||||
register_action(:MONITOR, method("action_monitor"))
|
||||
|
||||
@ -60,22 +57,18 @@ 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,TOTALMEMORY=#{totalmemory},"<<
|
||||
"TOTALCPU=#{totalcpu},CPUSPEED=1000,FREEMEMORY=#{totalmemory},"<<
|
||||
"FREECPU=#{totalcpu}"
|
||||
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}")
|
||||
def action_monitor(num, host, not_used)
|
||||
send_message("MONITOR", RESULT[:success], num,
|
||||
"HOSTNAME=#{host},#{@info}")
|
||||
end
|
||||
end
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# The EC2 Information Driver main program
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
im = EC2InformationManagerDriver.new
|
||||
im.start_driver
|
||||
|
Loading…
x
Reference in New Issue
Block a user