1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #4913: Remove instantiate to persistent logic from vmm shutdown action

This commit is contained in:
mcabrerizo 2017-04-17 16:56:46 +02:00
parent 601d4bea26
commit 27bbd26d30

View File

@ -49,17 +49,8 @@ if !["SHUTDOWN", "SHUTDOWN_POWEROFF", "SHUTDOWN_UNDEPLOY"].include?(lcm_state_st
exit -1
end
# Get disk elements from drv_action
disks = drv_action.retrieve_xmlelements("VM/TEMPLATE/DISK")
## TODO copy_template
# Manage instantiate to persistent
instantiate_to_persistent =
!drv_action['/VMM_DRIVER_ACTION_DATA/VM/TEMPLATE/CLONING_TEMPLATE_ID'].nil?
template_id = drv_action['/VMM_DRIVER_ACTION_DATA/VM/TEMPLATE/TEMPLATE_ID']
begin
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
@ -67,21 +58,6 @@ begin
vm.shutdown #Undeploy, Poweroff or Terminate
# If Terminate action has been called
if lcm_state_str == "SHUTDOWN"
# If the VM was instantiated to persistent keep the VM
if instantiate_to_persistent
vm.mark_as_template #Convert VM to template in vCenter
# Create new Opennebula template and set VCENTER_TEMPLATE_REF
new_template = OpenNebula::Template.new_with_id(template_id,
OpenNebula::Client.new)
new_template.info
new_template.update("VCENTER_TEMPLATE_REF= #{vm.item._ref}", true)
end
end
rescue Exception => e
STDERR.puts "Shutdown of VM #{vm_ref} on vCenter cluster "\
"#{vc_cluster_name} failed due to "\