1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-10 13:57:22 +03:00

Merge branch 'master' of opennebula.org:one

This commit is contained in:
Daniel Molina 2011-02-18 11:14:00 +01:00
commit 1fe627ff14
7 changed files with 34 additions and 13 deletions

View File

@ -16,6 +16,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
export LANG=C
HYPERVISOR_DIR=$1.d
ARGUMENTS=$*

View File

@ -49,7 +49,7 @@ class GangliaHost
self.new(xml, host)
end
def self.new_fom_file(host, file)
def self.new_from_file(host, file)
new_with_options(host, :file => file)
end

View File

@ -14,6 +14,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
export LANG=C
if [ -z "$ONE_LOCATION" ]; then
ONE_LOCAL_VAR=/var/lib/one
else

View File

@ -14,6 +14,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
export LANG=C
export LIBVIRT_URI=qemu:///system
export QEMU_PROTOCOL=qemu

View File

@ -64,11 +64,16 @@ rescue
exit -1
end
dom_info=ganglia.get_vms_information
doms_info=ganglia.get_vms_information
dom_id=domain.split('-').last
if dom_info[domain]
info=dom_info[domain].map do |key, value|
"#{key.to_s.upcase}=\"#{value}\""
# Get key one-<vmid> or <vmid> key from the hash
dom_info=doms_info[domain]
dom_info=doms_info[dom_id] if !dom_info
if dom_info
info=dom_info.map do |key, value|
"#{key.to_s.upcase}=#{value}"
end.join(' ')
puts info

24
src/vmm_mad/remotes/poll_xen_kvm.rb Normal file → Executable file
View File

@ -19,6 +19,8 @@
require 'pp'
require 'rexml/document'
ENV['LANG']='C'
module KVM
CONF={
:dominfo => 'virsh --connect LIBVIRT_URI --readonly dominfo',
@ -163,14 +165,14 @@ private
def self.get_state(state)
case state.gsub('-', '')
when *%w{running blocked shutdown dying}
when *%w{running blocked shutdown dying idle}
'a'
when 'paused'
'p'
when 'crashed'
'c'
'e'
else
'u'
'-'
end
end
end
@ -181,7 +183,13 @@ module XEN
}
def self.get_vm_info(vm_id)
get_all_vm_info[vm_id]
data = get_all_vm_info[vm_id]
if !data
return {:STATE => 'd'}
else
return data
end
end
def self.get_all_vm_info
@ -203,7 +211,7 @@ module XEN
dom_hash[:name]=dom_data[0]
dom_hash[:state]=get_state(dom_data[1])
dom_hash[:usedcpu]=dom_data[3]
dom_hash[:usedmem]=dom_data[4]
dom_hash[:usedmemory]=dom_data[4]
dom_hash[:nettx]=dom_data[10]
dom_hash[:netrx]=dom_data[11]
@ -218,15 +226,15 @@ module XEN
end
def self.get_state(state)
case state
case state.gsub('-', '')[-1..-1]
when *%w{r b s d}
'a'
when 'p'
'p'
when 'c'
'c'
'e'
else
'u'
'-'
end
end
end

View File

@ -14,6 +14,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
export LANG=C
export XM_PATH="/usr/sbin/xm"
export XM_CANCEL="sudo $XM_PATH destroy"
export XM_CREATE="sudo $XM_PATH create"