diff --git a/lib/fog/ovirt/models/compute/cluster.rb b/lib/fog/ovirt/models/compute/cluster.rb index 815a9ece9..e5ce654e6 100644 --- a/lib/fog/ovirt/models/compute/cluster.rb +++ b/lib/fog/ovirt/models/compute/cluster.rb @@ -10,7 +10,7 @@ module Fog attribute :raw def networks - connection.list_networks(id) + service.list_networks(id) end def to_s diff --git a/lib/fog/ovirt/models/compute/clusters.rb b/lib/fog/ovirt/models/compute/clusters.rb index 41fc5c63c..c6d6b9f94 100644 --- a/lib/fog/ovirt/models/compute/clusters.rb +++ b/lib/fog/ovirt/models/compute/clusters.rb @@ -10,11 +10,11 @@ module Fog model Fog::Compute::Ovirt::Cluster def all(filters = {}) - load connection.list_clusters(filters) + load service.list_clusters(filters) end def get(id) - new connection.get_cluster(id) + new service.get_cluster(id) end end diff --git a/lib/fog/ovirt/models/compute/interfaces.rb b/lib/fog/ovirt/models/compute/interfaces.rb index c663e3a7b..982328273 100644 --- a/lib/fog/ovirt/models/compute/interfaces.rb +++ b/lib/fog/ovirt/models/compute/interfaces.rb @@ -14,16 +14,16 @@ module Fog def all(filters = {}) requires :vm 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 - load connection.list_template_interfaces(vm.id) + load service.list_template_interfaces(vm.id) else raise 'interfaces should have vm or template' end end def get(id) - new connection.get_interface(id) + new service.get_interface(id) end end diff --git a/lib/fog/ovirt/models/compute/server.rb b/lib/fog/ovirt/models/compute/server.rb index 162889ad7..5fb902cc4 100644 --- a/lib/fog/ovirt/models/compute/server.rb +++ b/lib/fog/ovirt/models/compute/server.rb @@ -46,51 +46,51 @@ module Fog def interfaces attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new( - :connection => connection, + :service => service, :vm => self ) end def add_interface attrs wait_for { stopped? } if attrs[:blocking] - connection.add_interface(id, attrs) + service.add_interface(id, attrs) end def update_interface attrs wait_for { stopped? } if attrs[:blocking] - connection.update_interface(id, attrs) + service.update_interface(id, attrs) end def destroy_interface attrs wait_for { stopped? } if attrs[:blocking] - connection.destroy_interface(id, attrs) + service.destroy_interface(id, attrs) end def volumes attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new( - :connection => connection, + :service => service, :vm => self ) end def add_volume attrs wait_for { stopped? } if attrs[:blocking] - connection.add_volume(id, attrs) + service.add_volume(id, attrs) end def destroy_volume attrs wait_for { stopped? } if attrs[:blocking] - connection.destroy_volume(id, attrs) + service.destroy_volume(id, attrs) end def start(options = {}) wait_for { stopped? } if options[:blocking] - connection.vm_action(:id =>id, :action => :start) + service.vm_action(:id =>id, :action => :start) reload end def stop(options = {}) - connection.vm_action(:id =>id, :action => :stop) + service.vm_action(:id =>id, :action => :stop) reload end @@ -100,26 +100,26 @@ module Fog end def suspend(options = {}) - connection.vm_action(:id =>id, :action => :suspend) + service.vm_action(:id =>id, :action => :suspend) reload end def destroy(options = {}) (stop unless stopped?) rescue nil #ignore failure, destroy the machine anyway. wait_for { stopped? } - connection.destroy_vm(:id => id) + service.destroy_vm(:id => id) end def ticket(options = {}) 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 def save if persisted? - connection.update_vm(attributes) + service.update_vm(attributes) else - self.id = connection.create_vm(attributes).id + self.id = service.create_vm(attributes).id end reload end diff --git a/lib/fog/ovirt/models/compute/servers.rb b/lib/fog/ovirt/models/compute/servers.rb index a0232ee81..2f5e09537 100644 --- a/lib/fog/ovirt/models/compute/servers.rb +++ b/lib/fog/ovirt/models/compute/servers.rb @@ -10,11 +10,11 @@ module Fog model Fog::Compute::Ovirt::Server def all(filters = {}) - load connection.list_virtual_machines(filters) + load service.list_virtual_machines(filters) end def get(id) - new connection.get_virtual_machine(id) + new service.get_virtual_machine(id) end def bootstrap(new_attributes = {}) diff --git a/lib/fog/ovirt/models/compute/template.rb b/lib/fog/ovirt/models/compute/template.rb index 239cae5c3..cfe56f9ed 100644 --- a/lib/fog/ovirt/models/compute/template.rb +++ b/lib/fog/ovirt/models/compute/template.rb @@ -24,14 +24,14 @@ module Fog def interfaces attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new( - :connection => connection, + :service => service, :vm => self ) end def volumes attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new( - :connection => connection, + :service => service, :vm => self ) end @@ -41,12 +41,12 @@ module Fog end def destroy(options = {}) - connection.client.destroy_template(id) + service.client.destroy_template(id) end def save 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 def to_s diff --git a/lib/fog/ovirt/models/compute/templates.rb b/lib/fog/ovirt/models/compute/templates.rb index 6a6bf906a..389159e56 100644 --- a/lib/fog/ovirt/models/compute/templates.rb +++ b/lib/fog/ovirt/models/compute/templates.rb @@ -10,11 +10,11 @@ module Fog model Fog::Compute::Ovirt::Template def all(filters = {}) - load connection.list_templates(filters) + load service.list_templates(filters) end def get(id) - new connection.get_template(id) + new service.get_template(id) end end diff --git a/lib/fog/ovirt/models/compute/volumes.rb b/lib/fog/ovirt/models/compute/volumes.rb index 42fd894aa..1d1d9b14f 100644 --- a/lib/fog/ovirt/models/compute/volumes.rb +++ b/lib/fog/ovirt/models/compute/volumes.rb @@ -14,16 +14,16 @@ module Fog def all(filters = {}) requires :vm 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 - load connection.list_template_volumes(vm.id) + load service.list_template_volumes(vm.id) else raise 'volumes should have vm or template' end end def get(id) - new connection.get_volume(id) + new service.get_volume(id) end end