Skip to content

Commit

Permalink
B #3189: Fixed container hard reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
dann1 committed Oct 2, 2019
1 parent fd4a5db commit 62fbafd
Showing 1 changed file with 42 additions and 43 deletions.
85 changes: 42 additions & 43 deletions src/vmm_mad/exec/one_vmm_exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -601,55 +601,14 @@ def poll(id, drv_message)

# REBOOT action, reboots a running VM
def reboot(id, drv_message)
action = VmmAction.new(self, id, :reboot, drv_message)

reboot_step = {
:driver => :vmm,
:action => :reboot,
:parameters => [:deploy_id, :host]
}

steps = [reboot_step]

if @hypervisor == 'lxd'
steps += [
{
:driver => :vnm,
:action => :clean
},
{
:driver => :vnm,
:action => :pre
},
reboot_step,
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_info],
:fail_actions => [
{
:driver => :vmm,
:action => :cancel,
:parameters => [:deploy_info, :host]
}
]
}
]
end

action.run(steps)
restart(id, drv_message, :reboot)
end

#
# RESET action, resets a running VM
#
def reset(id, 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],
:stdin => data)
restart(id, drv_message, :reset)
end

#
Expand Down Expand Up @@ -1236,6 +1195,46 @@ def ensure_xpath(xml_data, id, action, xpath)
nil
end

def restart(id, drv_message, signal)
action = VmmAction.new(self, id, signal, drv_message)

reboot_step = {
:driver => :vmm,
:action => signal,
:parameters => [:deploy_id, :host]
}

steps = [reboot_step]

if @hypervisor == 'lxd'
steps += [
{
:driver => :vnm,
:action => :clean
},
{
:driver => :vnm,
:action => :pre
},
reboot_step,
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_info],
:fail_actions => [
{
:driver => :vmm,
:action => :cancel,
:parameters => [:deploy_info, :host]
}
]
}
]
end

action.run(steps)
end

def destroy(id, drv_message, signal)
action = VmmAction.new(self, id, signal, drv_message)

Expand Down

0 comments on commit 62fbafd

Please sign in to comment.