Module: VagrantPlugins::Skytap::API::RunstateOperations
- Includes:
- Busyable
- Included in:
- Environment, Vm
- Defined in:
- lib/vagrant-skytap/api/runstate_operations.rb
Constant Summary
Constants included
from Busyable
Busyable::WAIT_ITERATION_PERIOD, Busyable::WAIT_TIMEOUT
Instance Method Summary
collapse
Methods included from Busyable
#retry_while_resource_busy, #update_with_retry
Instance Method Details
#busy? ⇒ Boolean
49
50
51
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 49
def busy?
runstate == 'busy'
end
|
#poweroff! ⇒ Object
22
23
24
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 22
def poweroff!
set_runstate :halted, :stopped
end
|
10
11
12
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 10
def run!
set_runstate :running
end
|
#running? ⇒ Boolean
57
58
59
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 57
def running?
runstate == 'running'
end
|
45
46
47
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 45
def runstate
get_api_attribute('runstate')
end
|
#set_runstate(new_runstate, completed_runstate = nil) ⇒ Object
26
27
28
29
30
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 26
def set_runstate(new_runstate, completed_runstate = nil)
completed_runstate ||= new_runstate
update_with_retry(runstate: new_runstate)
wait_for_runstate(completed_runstate) unless runstate == completed_runstate
end
|
18
19
20
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 18
def stop!
set_runstate :stopped
end
|
#stopped? ⇒ Boolean
53
54
55
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 53
def stopped?
runstate == 'stopped'
end
|
14
15
16
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 14
def suspend!
set_runstate :suspended
end
|
#wait_for_runstate(expected_runstate) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 36
def wait_for_runstate(expected_runstate)
expected_runstate = expected_runstate.to_s
retry_while_resource_busy do
unless reload.busy?
break if runstate == expected_runstate || expected_runstate == 'ready'
end
end
end
|
#wait_until_ready ⇒ Object
32
33
34
|
# File 'lib/vagrant-skytap/api/runstate_operations.rb', line 32
def wait_until_ready
wait_for_runstate :ready
end
|