mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-15 05:57:23 +03:00
Feature 1896 - Use Information from drv_action (#3214)
* F #1896: Get host id from drv_action on shutdown Signed-off-by: Sergio Vega <svega@opennebula.systems> * F #1896: Get host id from drv_action on every supported action Signed-off-by: Sergio Vega <svega@opennebula.systems> * F #1896: Enhance vCenter driver actions pool calls
This commit is contained in:
parent
595c1c9df7
commit
9227577fe2
@ -468,6 +468,7 @@ class ExecDriver < VirtualMachineDriver
|
||||
# SAVE action, stops the VM and saves its state, network is cleaned up
|
||||
#
|
||||
def save(id, drv_message)
|
||||
xml_data = decode(drv_message)
|
||||
action = VmmAction.new(self, id, :save, drv_message)
|
||||
|
||||
steps=[
|
||||
@ -610,33 +611,39 @@ class ExecDriver < VirtualMachineDriver
|
||||
# POLL action, gets information of a VM
|
||||
#
|
||||
def poll(id, drv_message)
|
||||
xml_data = decode(drv_message)
|
||||
|
||||
data = decode(drv_message)
|
||||
host = data.elements['HOST'].text
|
||||
deploy_id = data.elements['DEPLOY_ID'].text
|
||||
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:poll])
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:poll], {:stdin => xml_data})
|
||||
end
|
||||
|
||||
#
|
||||
# REBOOT action, reboots a running VM
|
||||
#
|
||||
def reboot(id, drv_message)
|
||||
xml_data = decode(drv_message)
|
||||
|
||||
data = decode(drv_message)
|
||||
host = data.elements['HOST'].text
|
||||
deploy_id = data.elements['DEPLOY_ID'].text
|
||||
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:reboot])
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:reboot], {:stdin => xml_data})
|
||||
end
|
||||
|
||||
#
|
||||
# RESET action, resets a running VM
|
||||
#
|
||||
def reset(id, drv_message)
|
||||
xml_data = decode(drv_message)
|
||||
|
||||
data = decode(drv_message)
|
||||
host = data.elements['HOST'].text
|
||||
deploy_id = data.elements['DEPLOY_ID'].text
|
||||
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:reset])
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:reset], {:stdin => xml_data})
|
||||
end
|
||||
|
||||
#
|
||||
@ -762,7 +769,8 @@ class ExecDriver < VirtualMachineDriver
|
||||
id,
|
||||
host,
|
||||
ACTION[:snapshot_revert],
|
||||
:script_name => "snapshot_revert")
|
||||
:script_name => "snapshot_revert",
|
||||
:stdin => xml_data)
|
||||
end
|
||||
|
||||
#
|
||||
@ -781,7 +789,8 @@ class ExecDriver < VirtualMachineDriver
|
||||
id,
|
||||
host,
|
||||
ACTION[:snapshot_delete],
|
||||
:script_name => "snapshot_delete")
|
||||
:script_name => "snapshot_delete",
|
||||
:stdin => xml_data)
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -33,9 +33,10 @@ vm_ref = ARGV[0]
|
||||
vc_cluster_name = ARGV[1]
|
||||
vm_id = ARGV[2]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool,
|
||||
vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA')
|
||||
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
@ -32,9 +32,10 @@ require 'vcenter_driver'
|
||||
vm_ref = ARGV[0]
|
||||
vc_cluster_name = ARGV[1]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool,
|
||||
vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA')
|
||||
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
@ -32,9 +32,10 @@ require 'vcenter_driver'
|
||||
vm_ref = ARGV[0]
|
||||
vc_cluster_name = ARGV[1]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool,
|
||||
vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA')
|
||||
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
@ -32,9 +32,11 @@ require 'vcenter_driver'
|
||||
vm_ref = ARGV[2]
|
||||
vc_cluster_name = ARGV[-1]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool,
|
||||
vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
drv_action_enc = STDIN.read.delete("\n")
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(drv_action_enc),
|
||||
'VMM_DRIVER_ACTION_DATA')
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
@ -33,13 +33,11 @@ vm_ref = ARGV[0]
|
||||
vm_id = ARGV[3]
|
||||
vc_cluster_name = ARGV[-1]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
drv_action_enc = STDIN.read.delete("\n")
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(drv_action_enc),
|
||||
'VMM_DRIVER_ACTION_DATA')
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
lcm_state = drv_action['/VMM_DRIVER_ACTION_DATA/VM/LCM_STATE']
|
||||
check_valid(lcm_state, 'lcm_state')
|
||||
|
@ -33,8 +33,10 @@ vm_ref = ARGV[0]
|
||||
snap_id = ARGV[1]
|
||||
vc_cluster_name = ARGV[3]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA')
|
||||
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
@ -33,8 +33,10 @@ vm_ref = ARGV[0]
|
||||
snap_id = ARGV[1]
|
||||
vc_cluster_name = ARGV[3]
|
||||
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
drv_action = OpenNebula::XMLElement.new
|
||||
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA')
|
||||
|
||||
host_id = drv_action['VM/HISTORY_RECORDS/HISTORY/HID']
|
||||
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user