mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
parent
5dd2353507
commit
4a97c51329
@ -185,11 +185,6 @@ class Container
|
||||
|
||||
def stop(options = { :timeout => 120 })
|
||||
change_state(__method__, options)
|
||||
rescue StandardError => exception
|
||||
raise exception unless exception.class == Net::ReadTimeout
|
||||
|
||||
OpenNebula.log_error "Timeout detected\n#{exception}\nForcing shutdown"
|
||||
stop(:force => true)
|
||||
end
|
||||
|
||||
def restart(options = {})
|
||||
|
@ -36,15 +36,28 @@ container = Container.get(vm_name, xml, client)
|
||||
# ------------------------------------------------------------------------------
|
||||
# Stop the container & unmap devices if not a wild container
|
||||
# ------------------------------------------------------------------------------
|
||||
if ARGV[-1] == '-f'
|
||||
container.stop(:force => true)
|
||||
else
|
||||
container.stop
|
||||
begin
|
||||
if ARGV[-1] == '-f'
|
||||
container.stop(:force => true)
|
||||
else
|
||||
container.stop
|
||||
end
|
||||
rescue => exception
|
||||
OpenNebula.log_error exception
|
||||
end
|
||||
|
||||
if !container.wild?
|
||||
unmapped = container.setup_storage('unmap')
|
||||
raise 'Failed to dismantle container storage' unless unmapped
|
||||
# This call may return an operation output instead of a container data
|
||||
# in case of timeout. The call breaks the container attributes
|
||||
# it needs to be read again
|
||||
|
||||
container = Container.get(vm_name, xml, client) # :status => "Sucess"
|
||||
container = Container.get(vm_name, xml, client) unless %w[Running Stopped].include? container.status
|
||||
|
||||
container.stop(:force => true) if container.status == 'Running'
|
||||
|
||||
e = 'Failed to dismantle container storage'
|
||||
raise "#{e}\n#{container}" unless container.setup_storage('unmap')
|
||||
|
||||
container.delete
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user