mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
parent
cff5f1807e
commit
6930839e87
@ -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])
|
||||
|
||||
|
@ -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
|
||||
|
@ -49,3 +49,4 @@ force = false
|
||||
force = true if ARGV[-1] == '-f'
|
||||
|
||||
container.reboot(force)
|
||||
container.allow_monitoring
|
||||
|
Loading…
Reference in New Issue
Block a user