Class: Vixen::Model::VM
- Inherits:
-
Base
- Object
- Base
- Vixen::Model::VM
show all
- Defined in:
- lib/vixen/model/vm.rb
Instance Attribute Summary
Attributes inherited from Base
#handle
Instance Method Summary
collapse
Methods inherited from Base
finalize, #get_string_property, #initialize
Instance Method Details
#create_snapshot(name, description = "", &block) ⇒ Object
#current_power_states ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/vixen/model/vm.rb', line 95
def current_power_states
states = []
bitwise_state = Vixen::Bridge.current_power_state handle
[ :powering_off, :powered_off, :powering_on, :powered_on, :suspending,
:suspended, :tools_running, :resetting, :blocked_on_msg, :paused,
:resuming
].each do |state|
states << state if ((bitwise_state & Vixen::Constants::VixPowerState[state]) == Vixen::Constants::VixPowerState[state])
end
states
end
|
#current_snapshot ⇒ Object
#power_off(opts = {}, &block) ⇒ Object
#power_on(&block) ⇒ Object
22
23
24
25
26
|
# File 'lib/vixen/model/vm.rb', line 22
def power_on(&block)
return self if powered_on? or powering_on? or resuming? or resetting?
Vixen::Bridge.power_on handle, &block
self
end
|
#powered_off? ⇒ Boolean
67
68
69
|
# File 'lib/vixen/model/vm.rb', line 67
def powered_off?
current_power_states.include? :powered_off
end
|
#powered_on? ⇒ Boolean
75
76
77
|
# File 'lib/vixen/model/vm.rb', line 75
def powered_on?
current_power_states.include? :powered_on
end
|
#powering_off? ⇒ Boolean
63
64
65
|
# File 'lib/vixen/model/vm.rb', line 63
def powering_off?
current_power_states.include? :powering_off
end
|
#powering_on? ⇒ Boolean
71
72
73
|
# File 'lib/vixen/model/vm.rb', line 71
def powering_on?
current_power_states.include? :powering_on
end
|
#remove_snapshot(snapshot, &block) ⇒ Object
18
19
20
|
# File 'lib/vixen/model/vm.rb', line 18
def remove_snapshot(snapshot, &block)
Vixen::Bridge.remove_snaphost self, snapshot, &block
end
|
#reset(opts = {}, &block) ⇒ Object
#resetting? ⇒ Boolean
91
92
93
|
# File 'lib/vixen/model/vm.rb', line 91
def resetting?
current_power_states.include? :resetting
end
|
#resume(&block) ⇒ Object
28
29
30
|
# File 'lib/vixen/model/vm.rb', line 28
def resume(&block)
power_on &block
end
|
#resuming? ⇒ Boolean
79
80
81
|
# File 'lib/vixen/model/vm.rb', line 79
def resuming?
current_power_states.include? :resuming
end
|
#revert_to_snapshot(snapshot, &block) ⇒ Object
14
15
16
|
# File 'lib/vixen/model/vm.rb', line 14
def revert_to_snapshot(snapshot, &block)
Vixen::Bridge.revert_to_snapshot self, snapshot, &block
end
|
#suspend(&block) ⇒ Object
32
33
34
35
|
# File 'lib/vixen/model/vm.rb', line 32
def suspend(&block)
Vixen::Bridge.suspend handle, &block
self
end
|
#suspended? ⇒ Boolean
87
88
89
|
# File 'lib/vixen/model/vm.rb', line 87
def suspended?
current_power_states.include? :suspended
end
|
#suspending? ⇒ Boolean
83
84
85
|
# File 'lib/vixen/model/vm.rb', line 83
def suspending?
current_power_states.include? :suspending
end
|