diff --git a/src/vmm_mad/remotes/lib/lxd/container.rb b/src/vmm_mad/remotes/lib/lxd/container.rb index 58b5ca2904..90602dce81 100644 --- a/src/vmm_mad/remotes/lib/lxd/container.rb +++ b/src/vmm_mad/remotes/lib/lxd/container.rb @@ -129,8 +129,7 @@ class Container # Create a container without a base image def create(wait: true, timeout: '') @lxc['source'] = { 'type' => 'none' } - - transition_start # not ready to report status yet + @lxc['config']['user.one_status'] = '0' # not ready to report status yet wait?(@client.post(CONTAINERS, @lxc), wait, timeout) @@ -253,16 +252,10 @@ class Container # Extended reboot required for OpenNebula execution flow def reboot(force) - if transient? - start - - transition_end # container reached the final state of rebooting - update - else - transition_start # container will be started later - update - + if check_status == 'Running' check_stop(force) + else + start end end @@ -476,14 +469,16 @@ class Container end # Flags a container indicating current status not definitive - # Stalls monitoring status query. Requires updating the container - def transition_start + # Stalls monitoring status query. + def avoid_monitoring @lxc['config']['user.one_status'] = '0' + update end - # Removes transient state flag. Requires updating the container. - def transition_end + # Removes transient state flag. + def allow_monitoring @lxc['config'].delete('user.one_status') + update end # Helper method for querying transition phase @@ -534,6 +529,8 @@ class Container def change_state(action, options) options.update(:action => action) + avoid_monitoring + response = @client.put("#{CONTAINERS}/#{name}/state", options) status = wait?(response, options[:wait], options[:timeout]) diff --git a/src/vmm_mad/remotes/lxd/deploy b/src/vmm_mad/remotes/lxd/deploy index 3616680fa1..dd1d2bd0ae 100755 --- a/src/vmm_mad/remotes/lxd/deploy +++ b/src/vmm_mad/remotes/lxd/deploy @@ -84,9 +84,6 @@ end # Updates container configuration with the OpenNebulaVM description # ------------------------------------------------------------------------------ container.save_xml(xml) -container.transition_end unless container.wild? -container.update - container.vnc('start') - puts container.name +container.allow_monitoring diff --git a/src/vmm_mad/remotes/lxd/reboot b/src/vmm_mad/remotes/lxd/reboot index 0ccbdc53f7..be68f6cdee 100755 --- a/src/vmm_mad/remotes/lxd/reboot +++ b/src/vmm_mad/remotes/lxd/reboot @@ -49,3 +49,4 @@ force = false force = true if ARGV[-1] == '-f' container.reboot(force) +container.allow_monitoring