mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Unfreeze frozen container before stopping
Gracefully stopping a frozen container results in a significant delay, at least in my testing. This commit unfreezes the container before stopping it, if the container was frozen when the stop() function is called.
This commit is contained in:
parent
e019e5a474
commit
f777edfbec
@ -1771,10 +1771,18 @@ def stop(name, kill=False):
|
||||
salt myminion lxc.stop name
|
||||
'''
|
||||
_ensure_exists(name)
|
||||
orig_state = state(name)
|
||||
if orig_state == 'frozen' and not kill:
|
||||
# Gracefully stopping a frozen container is slower than unfreezing and
|
||||
# then stopping it (at least in my testing), so if we're not
|
||||
# force-stopping the container, unfreeze it first.
|
||||
unfreeze(name)
|
||||
cmd = 'lxc-stop'
|
||||
if kill:
|
||||
cmd += ' -k'
|
||||
return _change_state(cmd, name, 'stopped')
|
||||
ret = _change_state(cmd, name, 'stopped')
|
||||
ret['state']['old'] = orig_state
|
||||
return ret
|
||||
|
||||
|
||||
def freeze(name, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user