diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index 6f260efad0f..be8d3855bbb 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -467,6 +467,7 @@ def cancel(id, drv_message) # 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=[ @@ -609,33 +610,39 @@ def migrate(id, drv_message) # 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 # @@ -761,7 +768,8 @@ def snapshot_revert(id, drv_message) id, host, ACTION[:snapshot_revert], - :script_name => "snapshot_revert") + :script_name => "snapshot_revert", + :stdin => xml_data) end # @@ -780,7 +788,8 @@ def snapshot_delete(id, drv_message) id, host, ACTION[:snapshot_delete], - :script_name => "snapshot_delete") + :script_name => "snapshot_delete", + :stdin => xml_data) end # diff --git a/src/vmm_mad/remotes/vcenter/poll b/src/vmm_mad/remotes/vcenter/poll index 7e70fbbb130..495225979de 100755 --- a/src/vmm_mad/remotes/vcenter/poll +++ b/src/vmm_mad/remotes/vcenter/poll @@ -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) diff --git a/src/vmm_mad/remotes/vcenter/reboot b/src/vmm_mad/remotes/vcenter/reboot index 7335f5a7db8..c61d425089b 100755 --- a/src/vmm_mad/remotes/vcenter/reboot +++ b/src/vmm_mad/remotes/vcenter/reboot @@ -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) diff --git a/src/vmm_mad/remotes/vcenter/reset b/src/vmm_mad/remotes/vcenter/reset index 225a79a5d04..701a05600db 100755 --- a/src/vmm_mad/remotes/vcenter/reset +++ b/src/vmm_mad/remotes/vcenter/reset @@ -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) diff --git a/src/vmm_mad/remotes/vcenter/restore b/src/vmm_mad/remotes/vcenter/restore index 50158799523..70e12cafde4 100755 --- a/src/vmm_mad/remotes/vcenter/restore +++ b/src/vmm_mad/remotes/vcenter/restore @@ -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) diff --git a/src/vmm_mad/remotes/vcenter/save b/src/vmm_mad/remotes/vcenter/save index b6e0b8b4973..f54aae1489e 100755 --- a/src/vmm_mad/remotes/vcenter/save +++ b/src/vmm_mad/remotes/vcenter/save @@ -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') diff --git a/src/vmm_mad/remotes/vcenter/snapshot_delete b/src/vmm_mad/remotes/vcenter/snapshot_delete index 4ac741db88a..527b44ff600 100755 --- a/src/vmm_mad/remotes/vcenter/snapshot_delete +++ b/src/vmm_mad/remotes/vcenter/snapshot_delete @@ -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) diff --git a/src/vmm_mad/remotes/vcenter/snapshot_revert b/src/vmm_mad/remotes/vcenter/snapshot_revert index f82e35065ec..2d6b8e5d0b1 100755 --- a/src/vmm_mad/remotes/vcenter/snapshot_revert +++ b/src/vmm_mad/remotes/vcenter/snapshot_revert @@ -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)