def freeze(container): """ Freezes a container """ if not exists(container): raise ContainerDoesntExists('Container {} does not exists!'.format(container)) if not container in running(): raise ContainerNotRunning('Container {} is not running!'.format(container)) return _run('lxc-freeze -n {}'.format(container))
def unfreeze(container): """ Unfreezes a container """ if not exists(container): raise ContainerDoesntExists('Container {} does not exists!'.format(container)) if not container in frozen(): raise ContainerNotRunning('Container {} is not frozen!'.format(container)) return _run('lxc-unfreeze -n {}'.format(container))
def stop(container): """ Stops a container """ if not exists(container): raise ContainerDoesntExists('Container {} does not exists!'.format(container)) if container in stopped(): raise ContainerNotRunning('Container {} is not running!'.format(container)) return _run('lxc-stop -n {}'.format(container))