diff --git a/src/vmm_mad/remotes/lib/lxd/container.rb b/src/vmm_mad/remotes/lib/lxd/container.rb index b56894269f..58d814a841 100644 --- a/src/vmm_mad/remotes/lib/lxd/container.rb +++ b/src/vmm_mad/remotes/lib/lxd/container.rb @@ -253,18 +253,17 @@ class Container # Extended reboot required for OpenNebula execution flow def reboot(force) - case config['user.reboot_state'] - when 'STOPPED' + if transient? start - config['user.reboot_state'] = 'RUNNING' - transition_end # container reached a final state + + transition_end # container reached the final state of rebooting + update else transition_start # container will be started later - check_stop(force) - config['user.reboot_state'] = 'STOPPED' - end + update - update + check_stop(force) + end end def restart(options = {}) @@ -496,6 +495,11 @@ class Container @lxc['config'].delete('user.one_status') end + # Helper method for querying transition phase + def transient? + @lxc['config']['user.one_status'] == '0' + end + private def idmaps_file diff --git a/src/vmm_mad/remotes/lxd/poll b/src/vmm_mad/remotes/lxd/poll index 929b2b570e..d98aa83373 100755 --- a/src/vmm_mad/remotes/lxd/poll +++ b/src/vmm_mad/remotes/lxd/poll @@ -108,7 +108,7 @@ module LXD # * 'stopped' container not running or in the process of shutting down. # * 'failure' container have failed. def get_state(container) - return '-' if container.config['user.one_status'] == '0' + return '-' if container.transient? begin status = container.status.downcase