mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
bug #3212: Update monitor state reporting from KVM, Xen, ESX and vCenter drivers
This commit is contained in:
parent
e1e3945ad3
commit
af599e55cc
@ -259,12 +259,19 @@ module KVM
|
||||
# Translate libvirt state to Opennebula monitor state
|
||||
# @param state [String] libvirt state
|
||||
# @return [String] OpenNebula state
|
||||
#
|
||||
# Libvirt states for the guest are
|
||||
# * 'running' state refers to guests which are currently active on a CPU.
|
||||
# * 'blocked' not running or runnable (waiting on I/O or in a sleep mode).
|
||||
# * 'paused' after virsh suspend.
|
||||
# * 'shutdown' guest in the process of shutting down.
|
||||
# * 'dying' the domain has not completely shutdown or crashed.
|
||||
# * 'crashed' guests have failed while running and are no longer running.
|
||||
#
|
||||
def self.get_state(state)
|
||||
case state.gsub('-', '')
|
||||
when *%w{running blocked shutdown dying idle}
|
||||
when *%w{running blocked shutdown dying idle paused}
|
||||
'a'
|
||||
when 'paused'
|
||||
'd'
|
||||
when 'crashed'
|
||||
'e'
|
||||
else
|
||||
@ -349,12 +356,18 @@ module XEN
|
||||
# Returns an OpenNebula state from the Xen status
|
||||
# @param state [String] with the Xen status
|
||||
# @return [String] OpenNebula monitor state
|
||||
#
|
||||
# Xentop states are:
|
||||
# 'd' – domain is dying
|
||||
# 's' – domain shutting down
|
||||
# 'b' – blocked domain
|
||||
# 'c' – domain crashed
|
||||
# 'p' – domain paused
|
||||
# 'r' – domain is actively ruining on one of the CPU
|
||||
def self.get_state(state)
|
||||
case state.gsub('-', '')[-1..-1]
|
||||
when *%w{r b s d}
|
||||
when *%w{r b s d p}
|
||||
'a'
|
||||
when 'p'
|
||||
'd'
|
||||
when 'c'
|
||||
'e'
|
||||
else
|
||||
|
@ -646,7 +646,7 @@ class VCenterVm
|
||||
@guest_state = @vm.guest.guestState
|
||||
@vmware_tools = @vm.guest.toolsRunningStatus
|
||||
@vmtools_ver = @vm.guest.toolsVersion
|
||||
@vmtools_verst = @vm.guest.toolsVersionStatus
|
||||
@vmtools_verst = @vm.guest.toolsVersionStatus
|
||||
|
||||
|
||||
end
|
||||
@ -697,7 +697,11 @@ class VCenterVm
|
||||
private
|
||||
|
||||
########################################################################
|
||||
# Converts the VI string state to OpenNebula state convention
|
||||
# Converts the VI string state to OpenNebula state convention
|
||||
# Guest states are:
|
||||
# - poweredOff The virtual machine is currently powered off.
|
||||
# - poweredOn The virtual machine is currently powered on.
|
||||
# - suspended The virtual machine is currently suspended.
|
||||
########################################################################
|
||||
def state_to_c(state)
|
||||
case state
|
||||
@ -705,14 +709,16 @@ private
|
||||
'a'
|
||||
when 'suspended'
|
||||
'p'
|
||||
else
|
||||
when 'poweredOff'
|
||||
'd'
|
||||
else
|
||||
'-'
|
||||
end
|
||||
end
|
||||
|
||||
########################################################################
|
||||
# Clone a vCenter VM Template and leaves it powered on
|
||||
########################################################################
|
||||
########################################################################
|
||||
def self.clone_vm(xml_text)
|
||||
|
||||
xml = REXML::Document.new xml_text
|
||||
@ -770,8 +776,8 @@ private
|
||||
end
|
||||
|
||||
if vnc_port
|
||||
spec = RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig =>
|
||||
[{:key=>"remotedisplay.vnc.enabled", :value=>"TRUE"},
|
||||
spec = RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig =>
|
||||
[{:key=>"remotedisplay.vnc.enabled", :value=>"TRUE"},
|
||||
{:key=>"remotedisplay.vnc.port", :value=>vnc_port.text},
|
||||
{:key=>"remotedisplay.vnc.ip", :value=>vnc_listen}])
|
||||
rc.ReconfigVM_Task(:spec => spec).wait_for_completion
|
||||
@ -780,4 +786,4 @@ private
|
||||
return vm_uuid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -299,6 +299,10 @@ private
|
||||
|
||||
########################################################################
|
||||
# Converts the VI string state to OpenNebula state convention
|
||||
# Guest states are:
|
||||
# - poweredOff The virtual machine is currently powered off.
|
||||
# - poweredOn The virtual machine is currently powered on.
|
||||
# - suspended The virtual machine is currently suspended.
|
||||
########################################################################
|
||||
def state_to_c(state)
|
||||
case state
|
||||
@ -306,8 +310,10 @@ private
|
||||
'a'
|
||||
when 'suspended'
|
||||
'p'
|
||||
else
|
||||
when 'poweredOff'
|
||||
'd'
|
||||
else
|
||||
'-'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user