mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[virtual_box|compute] Updates reference to service
This commit is contained in:
parent
e959078e89
commit
5b705bc689
8 changed files with 21 additions and 21 deletions
|
|
@ -37,17 +37,17 @@ module Fog
|
|||
raise e.message
|
||||
end
|
||||
|
||||
@connection = ::VirtualBox::Global.global.lib.virtualbox
|
||||
@service = ::VirtualBox::Global.global.lib.virtualbox
|
||||
end
|
||||
|
||||
def respond_to?(method, *)
|
||||
super or @connection.respond_to? method
|
||||
super or @service.respond_to? method
|
||||
end
|
||||
|
||||
# hack to provide 'requests'
|
||||
def method_missing(method_sym, *arguments, &block)
|
||||
if @connection.respond_to?(method_sym)
|
||||
@connection.send(method_sym, *arguments)
|
||||
if @service.respond_to?(method_sym)
|
||||
@service.send(method_sym, *arguments)
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ module Fog
|
|||
undef_method :medium_format
|
||||
def medium_format
|
||||
Fog::Compute::VirtualBox::MediumFormat.new(
|
||||
:connection => connection,
|
||||
:service => service,
|
||||
:raw => raw.medium_format
|
||||
)
|
||||
end
|
||||
|
|
@ -55,7 +55,7 @@ module Fog
|
|||
:access_mode_read_write
|
||||
end
|
||||
|
||||
self.raw = connection.open_medium(location, device_type, access_mode)
|
||||
self.raw = service.open_medium(location, device_type, access_mode)
|
||||
|
||||
else
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ module Fog
|
|||
|
||||
def all
|
||||
data = []
|
||||
data.concat(connection.dvd_images)
|
||||
data.concat(connection.floppy_images)
|
||||
data.concat(connection.hard_disks)
|
||||
data.concat(service.dvd_images)
|
||||
data.concat(service.floppy_images)
|
||||
data.concat(service.hard_disks)
|
||||
data = data.map do |medium|
|
||||
{:raw => medium}
|
||||
end
|
||||
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
end
|
||||
|
||||
def get(medium_identity)
|
||||
data = connection.find_medium(medium_identity)
|
||||
data = service.find_medium(medium_identity)
|
||||
new(:raw => data)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
undef_method :redirects
|
||||
def redirects
|
||||
Fog::Compute::VirtualBox::NATRedirects.new(
|
||||
:connection => connection,
|
||||
:service => service,
|
||||
:machine => machine,
|
||||
:nat_engine => self
|
||||
)
|
||||
|
|
@ -47,7 +47,7 @@ module Fog
|
|||
def raw
|
||||
@raw
|
||||
end
|
||||
|
||||
|
||||
def raw=(new_raw)
|
||||
@raw = new_raw
|
||||
raw_attributes = {}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ module Fog
|
|||
undef_method :nat_driver
|
||||
def nat_driver
|
||||
Fog::Compute::VirtualBox::NATEngine.new(
|
||||
:connection => connection,
|
||||
:service => service,
|
||||
:machine => machine,
|
||||
:network_adapter => self,
|
||||
:raw => raw.nat_driver
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module Fog
|
|||
requires :machine
|
||||
data = []
|
||||
raw_machine = machine.instance_variable_get(:@raw)
|
||||
connection.system_properties.network_adapter_count.times do |index|
|
||||
service.system_properties.network_adapter_count.times do |index|
|
||||
data << {
|
||||
:raw => raw_machine.get_network_adapter(index)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ module Fog
|
|||
wait_for { raw.session_state == :closed }
|
||||
end
|
||||
raw.unregister(:full)
|
||||
config_file = connection.compose_machine_filename(name)
|
||||
config_file = service.compose_machine_filename(name)
|
||||
config_directory = config_file.split(File::SEPARATOR)[0...-1].join(File::SEPARATOR)
|
||||
FileUtils.rm_rf(config_directory)
|
||||
true
|
||||
|
|
@ -91,7 +91,7 @@ module Fog
|
|||
|
||||
def network_adapters
|
||||
Fog::Compute::VirtualBox::NetworkAdapters.new(
|
||||
:connection => connection,
|
||||
:service => service,
|
||||
:machine => self
|
||||
)
|
||||
end
|
||||
|
|
@ -117,8 +117,8 @@ module Fog
|
|||
def save
|
||||
unless identity
|
||||
requires :name, :os
|
||||
self.raw = connection.create_machine(nil, name, os)
|
||||
connection.register_machine(raw)
|
||||
self.raw = service.create_machine(nil, name, os)
|
||||
service.register_machine(raw)
|
||||
with_session do |session|
|
||||
for attribute in [:description, :memory_size, :rtc_use_utc, :vram_size]
|
||||
session.machine.send(:"#{attribute}=", attributes[attribute])
|
||||
|
|
@ -161,7 +161,7 @@ module Fog
|
|||
|
||||
def storage_controllers
|
||||
Fog::Compute::VirtualBox::StorageControllers.new(
|
||||
:connection => connection,
|
||||
:service => service,
|
||||
:machine => self
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
model Fog::Compute::VirtualBox::Server
|
||||
|
||||
def all
|
||||
data = connection.machines.map do |machine|
|
||||
data = service.machines.map do |machine|
|
||||
{
|
||||
:raw => machine
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ module Fog
|
|||
end
|
||||
|
||||
def get(server_id)
|
||||
machine = connection.find_machine(server_id)
|
||||
machine = service.find_machine(server_id)
|
||||
new(:raw => machine)
|
||||
rescue ::VirtualBox::Exceptions::ObjectNotFoundException
|
||||
nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue