mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
Feature #3718: Fixes the poll attribute definition
for locally executed monitor drivers
This commit is contained in:
1 parent
29fdafa31e
commit
9b8d8f56db
2 files changed
+11
-10
No files matched your search
@@ -51,13 +51,14 @@ class VirtualMachineDriver < OpenNebulaDriver
|
||||
}
|
||||
|
||||
POLL_ATTRIBUTE = {
|
||||
:usedmemory => "USEDMEMORY",
|
||||
:usedcpu => "USEDCPU",
|
||||
:nettx => "NETTX",
|
||||
:netrx => "NETRX",
|
||||
:state => "STATE",
|
||||
:disk_actual => "DISK_ACTUAL_SIZE",
|
||||
:disk_virtual=> "DISK_VIRTUAL_SIZE"
|
||||
:memory => "MEMORY",
|
||||
:cpu => "CPU",
|
||||
:net_tx => "NET_TX",
|
||||
:net_rx => "NET_RX",
|
||||
:state => "STATE",
|
||||
:total_disk_size => "TOTAL_DISK_SIZE",
|
||||
:disk_size => "DISK_SIZE",
|
||||
:snapshot_size => "SNAPSHOT_SIZE"
|
||||
}
|
||||
|
||||
VM_STATE = {
|
||||
@@ -354,7 +355,7 @@ if __FILE__ == $0
|
||||
# monitor_info: string in the form "VAR=VAL VAR=VAL ... VAR=VAL"
|
||||
# known VAR are in POLL_ATTRIBUTES. VM states VM_STATES
|
||||
monitor_info = "#{POLL_ATTRIBUTE[:state]}=#{VM_STATE[:active]} " \
|
||||
"#{POLL_ATTRIBUTE[:nettx]}=12345"
|
||||
"#{POLL_ATTRIBUTE[:net_tx]}=12345"
|
||||
|
||||
send_message(ACTION[:poll],RESULT[:success],id,monitor_info)
|
||||
end
|
||||
|
||||
@@ -196,8 +196,8 @@ class DummyDriver < VirtualMachineDriver
|
||||
"#{POLL_ATTRIBUTE[:net_rx]}=#{prev_netrx+(100*rand(4))} " \
|
||||
"#{POLL_ATTRIBUTE[:memory]}=#{max_memory * (rand(80)+20)/100} " \
|
||||
"#{POLL_ATTRIBUTE[:cpu]}=#{max_cpu * (rand(95)+5)/100} " \
|
||||
"#{POLL_ATTRIBUTE[:disk_actual]}=#{rand(1024)} " \
|
||||
"#{POLL_ATTRIBUTE[:disk_virtual]}=#{1024}"
|
||||
"#{POLL_ATTRIBUTE[:total_disk_size]}=#{rand(1024)} " \
|
||||
"#{POLL_ATTRIBUTE[:disk_size]}=#{rand(1024)}"
|
||||
|
||||
send_message(ACTION[:poll],result,id,monitor_info)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user