Class: Fog::Compute::Ovirt::Server
- Inherits:
-
Server
show all
- Defined in:
- lib/fog/ovirt/models/compute/server.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Server
#scp, #scp_download, #ssh
Methods inherited from Model
#initialize, #inspect, #reload, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#destroy(options = {}) ⇒ Object
62
63
64
65
66
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 62
def destroy(options = {})
(stop unless stopped?) rescue nil wait_for { stopped? }
connection.destroy_vm(:id => id)
end
|
#mac ⇒ Object
37
38
39
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 37
def mac
raw.interfaces.first.mac if raw.interfaces
end
|
#ready? ⇒ Boolean
29
30
31
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 29
def ready?
!(status =~ /down/i)
end
|
#reboot(options = {}) ⇒ Object
52
53
54
55
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 52
def reboot(options = {})
stop unless stopped?
start options.merge(:blocking => true)
end
|
#save ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 68
def save
if identity
connection.update_vm(attributes)
else
self.id = connection.create_vm(attributes).id
end
reload
end
|
#start(options = {}) ⇒ Object
41
42
43
44
45
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 41
def start(options = {})
wait_for { stopped? } if options[:blocking]
connection.vm_action(:id =>id, :action => :start)
reload
end
|
#stop(options = {}) ⇒ Object
47
48
49
50
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 47
def stop(options = {})
connection.vm_action(:id =>id, :action => :stop)
reload
end
|
#stopped? ⇒ Boolean
33
34
35
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 33
def stopped?
!!(status =~ /down/i)
end
|
#suspend(options = {}) ⇒ Object
57
58
59
60
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 57
def suspend(options = {})
connection.vm_action(:id =>id, :action => :suspend)
reload
end
|
#to_s ⇒ Object
77
78
79
|
# File 'lib/fog/ovirt/models/compute/server.rb', line 77
def to_s
name
end
|