From cf53b7d0ebfa8de499c820dc3c763494f1c69f26 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 16 Aug 2011 11:51:31 +0200 Subject: [PATCH] feature #720: Use cpu_usage instead of cpu for VM probes --- src/acct/watch_helper.rb | 26 ++++--------------- .../public/js/plugins/dashboard-users-tab.js | 4 +-- src/sunstone/public/js/plugins/vms-tab.js | 4 +-- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/acct/watch_helper.rb b/src/acct/watch_helper.rb index ce610feee5..9d3f9a26c0 100644 --- a/src/acct/watch_helper.rb +++ b/src/acct/watch_helper.rb @@ -35,11 +35,11 @@ module WatchHelper } VM_SAMPLE = { - :cpu => { + :cpu_usage => { :type => Integer, :path => 'CPU' }, - :memory => { + :mem_usage => { :type => Integer, :path => 'MEMORY' }, @@ -200,28 +200,12 @@ module WatchHelper unrestrict_primary_key many_to_one :vm - - def self.active - self.filter(:state=>3) - end - - def self.error - self.filter(:state=>7) - end end class HostSample < Sequel::Model unrestrict_primary_key many_to_one :host - - def self.active - self.filter('state < 3') - end - - def self.error - self.filter(:state=>3) - end end class Register < Sequel::Model @@ -274,9 +258,9 @@ module WatchHelper v.name = vm['NAME'] v.uid = vm['UID'].to_i v.gid = vm['GID'].to_i - v.mem = vm['MEMORY'].to_i - v.cpu = vm['CPU'].to_i - v.vcpu = vm['VCPU'].to_i + v.mem = vm['TEMPLATE/MEMORY'].to_i + v.cpu = vm['TEMPLATE/CPU'].to_i + v.vcpu = vm['TEMPLATE/VCPU'].to_i v.stime = vm['STIME'].to_i v.etime = vm['ETIME'].to_i } diff --git a/src/sunstone/public/js/plugins/dashboard-users-tab.js b/src/sunstone/public/js/plugins/dashboard-users-tab.js index 5126eef4eb..e1e6f00bf1 100644 --- a/src/sunstone/public/js/plugins/dashboard-users-tab.js +++ b/src/sunstone/public/js/plugins/dashboard-users-tab.js @@ -25,13 +25,13 @@ var graph1 = { var graph2 = { title : "graph2", - monitor_resources : "cpu", + monitor_resources : "cpu_usage", history_length : HISTORY_LENGTH }; var graph3 = { title : "graph3", - monitor_resources : "memory", + monitor_resources : "mem_usage", history_length : HISTORY_LENGTH }; diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 76592e1fff..22a3bdfd08 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -26,12 +26,12 @@ loadVNC(); var vm_graphs = [ { title : "CPU", - monitor_resources : "cpu", + monitor_resources : "cpu_usage", humanize_figures : false, history_length : VM_HISTORY_LENGTH }, { title : "Memory", - monitor_resources : "memory", + monitor_resources : "mem_usage", humanize_figures : true, history_length : VM_HISTORY_LENGTH },