mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ovirt|compute] Updates reference to service
This commit is contained in:
parent
9d3a27f10a
commit
9c6e17bd6c
8 changed files with 31 additions and 31 deletions
|
@ -10,7 +10,7 @@ module Fog
|
||||||
attribute :raw
|
attribute :raw
|
||||||
|
|
||||||
def networks
|
def networks
|
||||||
connection.list_networks(id)
|
service.list_networks(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
|
|
@ -10,11 +10,11 @@ module Fog
|
||||||
model Fog::Compute::Ovirt::Cluster
|
model Fog::Compute::Ovirt::Cluster
|
||||||
|
|
||||||
def all(filters = {})
|
def all(filters = {})
|
||||||
load connection.list_clusters(filters)
|
load service.list_clusters(filters)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id)
|
def get(id)
|
||||||
new connection.get_cluster(id)
|
new service.get_cluster(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,16 +14,16 @@ module Fog
|
||||||
def all(filters = {})
|
def all(filters = {})
|
||||||
requires :vm
|
requires :vm
|
||||||
if vm.is_a? Fog::Compute::Ovirt::Server
|
if vm.is_a? Fog::Compute::Ovirt::Server
|
||||||
load connection.list_vm_interfaces(vm.id)
|
load service.list_vm_interfaces(vm.id)
|
||||||
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
||||||
load connection.list_template_interfaces(vm.id)
|
load service.list_template_interfaces(vm.id)
|
||||||
else
|
else
|
||||||
raise 'interfaces should have vm or template'
|
raise 'interfaces should have vm or template'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id)
|
def get(id)
|
||||||
new connection.get_interface(id)
|
new service.get_interface(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,51 +46,51 @@ module Fog
|
||||||
|
|
||||||
def interfaces
|
def interfaces
|
||||||
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
|
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
|
||||||
:connection => connection,
|
:service => service,
|
||||||
:vm => self
|
:vm => self
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_interface attrs
|
def add_interface attrs
|
||||||
wait_for { stopped? } if attrs[:blocking]
|
wait_for { stopped? } if attrs[:blocking]
|
||||||
connection.add_interface(id, attrs)
|
service.add_interface(id, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_interface attrs
|
def update_interface attrs
|
||||||
wait_for { stopped? } if attrs[:blocking]
|
wait_for { stopped? } if attrs[:blocking]
|
||||||
connection.update_interface(id, attrs)
|
service.update_interface(id, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_interface attrs
|
def destroy_interface attrs
|
||||||
wait_for { stopped? } if attrs[:blocking]
|
wait_for { stopped? } if attrs[:blocking]
|
||||||
connection.destroy_interface(id, attrs)
|
service.destroy_interface(id, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def volumes
|
def volumes
|
||||||
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
|
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
|
||||||
:connection => connection,
|
:service => service,
|
||||||
:vm => self
|
:vm => self
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_volume attrs
|
def add_volume attrs
|
||||||
wait_for { stopped? } if attrs[:blocking]
|
wait_for { stopped? } if attrs[:blocking]
|
||||||
connection.add_volume(id, attrs)
|
service.add_volume(id, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_volume attrs
|
def destroy_volume attrs
|
||||||
wait_for { stopped? } if attrs[:blocking]
|
wait_for { stopped? } if attrs[:blocking]
|
||||||
connection.destroy_volume(id, attrs)
|
service.destroy_volume(id, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start(options = {})
|
def start(options = {})
|
||||||
wait_for { stopped? } if options[:blocking]
|
wait_for { stopped? } if options[:blocking]
|
||||||
connection.vm_action(:id =>id, :action => :start)
|
service.vm_action(:id =>id, :action => :start)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
||||||
def stop(options = {})
|
def stop(options = {})
|
||||||
connection.vm_action(:id =>id, :action => :stop)
|
service.vm_action(:id =>id, :action => :stop)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -100,26 +100,26 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def suspend(options = {})
|
def suspend(options = {})
|
||||||
connection.vm_action(:id =>id, :action => :suspend)
|
service.vm_action(:id =>id, :action => :suspend)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy(options = {})
|
def destroy(options = {})
|
||||||
(stop unless stopped?) rescue nil #ignore failure, destroy the machine anyway.
|
(stop unless stopped?) rescue nil #ignore failure, destroy the machine anyway.
|
||||||
wait_for { stopped? }
|
wait_for { stopped? }
|
||||||
connection.destroy_vm(:id => id)
|
service.destroy_vm(:id => id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ticket(options = {})
|
def ticket(options = {})
|
||||||
raise "Can not set console ticket, Server is not ready. Server status: #{status}" unless ready?
|
raise "Can not set console ticket, Server is not ready. Server status: #{status}" unless ready?
|
||||||
connection.vm_ticket(id, options)
|
service.vm_ticket(id, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
if persisted?
|
if persisted?
|
||||||
connection.update_vm(attributes)
|
service.update_vm(attributes)
|
||||||
else
|
else
|
||||||
self.id = connection.create_vm(attributes).id
|
self.id = service.create_vm(attributes).id
|
||||||
end
|
end
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,11 +10,11 @@ module Fog
|
||||||
model Fog::Compute::Ovirt::Server
|
model Fog::Compute::Ovirt::Server
|
||||||
|
|
||||||
def all(filters = {})
|
def all(filters = {})
|
||||||
load connection.list_virtual_machines(filters)
|
load service.list_virtual_machines(filters)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id)
|
def get(id)
|
||||||
new connection.get_virtual_machine(id)
|
new service.get_virtual_machine(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bootstrap(new_attributes = {})
|
def bootstrap(new_attributes = {})
|
||||||
|
|
|
@ -24,14 +24,14 @@ module Fog
|
||||||
|
|
||||||
def interfaces
|
def interfaces
|
||||||
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
|
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
|
||||||
:connection => connection,
|
:service => service,
|
||||||
:vm => self
|
:vm => self
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def volumes
|
def volumes
|
||||||
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
|
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
|
||||||
:connection => connection,
|
:service => service,
|
||||||
:vm => self
|
:vm => self
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -41,12 +41,12 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy(options = {})
|
def destroy(options = {})
|
||||||
connection.client.destroy_template(id)
|
service.client.destroy_template(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
||||||
connection.client.create_template(attributes)
|
service.client.create_template(attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
|
|
@ -10,11 +10,11 @@ module Fog
|
||||||
model Fog::Compute::Ovirt::Template
|
model Fog::Compute::Ovirt::Template
|
||||||
|
|
||||||
def all(filters = {})
|
def all(filters = {})
|
||||||
load connection.list_templates(filters)
|
load service.list_templates(filters)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id)
|
def get(id)
|
||||||
new connection.get_template(id)
|
new service.get_template(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,16 +14,16 @@ module Fog
|
||||||
def all(filters = {})
|
def all(filters = {})
|
||||||
requires :vm
|
requires :vm
|
||||||
if vm.is_a? Fog::Compute::Ovirt::Server
|
if vm.is_a? Fog::Compute::Ovirt::Server
|
||||||
load connection.list_vm_volumes(vm.id)
|
load service.list_vm_volumes(vm.id)
|
||||||
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
||||||
load connection.list_template_volumes(vm.id)
|
load service.list_template_volumes(vm.id)
|
||||||
else
|
else
|
||||||
raise 'volumes should have vm or template'
|
raise 'volumes should have vm or template'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id)
|
def get(id)
|
||||||
new connection.get_volume(id)
|
new service.get_volume(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue