bbrowning-virtualbox 0.7.6.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +8 -0
- data/.yardopts +3 -0
- data/Gemfile +16 -0
- data/LICENSE +19 -0
- data/Rakefile +33 -0
- data/Readme.md +70 -0
- data/docs/GettingStarted.md +196 -0
- data/docs/WhatsNew.md +12 -0
- data/features/README.md +33 -0
- data/features/global.feature +19 -0
- data/features/global_extra_data.feature +27 -0
- data/features/step_definitions/abstract_model_steps.rb +39 -0
- data/features/step_definitions/extra_data_steps.rb +36 -0
- data/features/step_definitions/global_steps.rb +29 -0
- data/features/step_definitions/nat_engine_steps.rb +76 -0
- data/features/step_definitions/network_adapter_steps.rb +38 -0
- data/features/step_definitions/shared_folder_steps.rb +76 -0
- data/features/step_definitions/snapshot_steps.rb +74 -0
- data/features/step_definitions/storage_controller_steps.rb +16 -0
- data/features/step_definitions/virtualbox_steps.rb +17 -0
- data/features/step_definitions/vm_steps.rb +50 -0
- data/features/support/env.rb +61 -0
- data/features/support/helpers.rb +38 -0
- data/features/support/hooks.rb +30 -0
- data/features/support/ordered_hash.rb +49 -0
- data/features/support/vboxmanage.rb +191 -0
- data/features/version.feature +16 -0
- data/features/vm.feature +13 -0
- data/features/vm_bios.feature +29 -0
- data/features/vm_cpu.feature +29 -0
- data/features/vm_extra_data.feature +35 -0
- data/features/vm_hw_virt.feature +29 -0
- data/features/vm_nat_engine.feature +57 -0
- data/features/vm_network_adapters.feature +27 -0
- data/features/vm_shared_folders.feature +42 -0
- data/features/vm_snapshots.feature +29 -0
- data/features/vm_storage_controllers.feature +11 -0
- data/lib/virtualbox.rb +11 -0
- data/lib/virtualbox/abstract_model.rb +281 -0
- data/lib/virtualbox/abstract_model/attributable.rb +290 -0
- data/lib/virtualbox/abstract_model/dirty.rb +177 -0
- data/lib/virtualbox/abstract_model/interface_attributes.rb +98 -0
- data/lib/virtualbox/abstract_model/relatable.rb +332 -0
- data/lib/virtualbox/abstract_model/validatable.rb +167 -0
- data/lib/virtualbox/abstract_model/version_matcher.rb +35 -0
- data/lib/virtualbox/appliance.rb +62 -0
- data/lib/virtualbox/audio_adapter.rb +52 -0
- data/lib/virtualbox/bios.rb +50 -0
- data/lib/virtualbox/com.rb +23 -0
- data/lib/virtualbox/com/abstract_enum.rb +43 -0
- data/lib/virtualbox/com/abstract_implementer.rb +45 -0
- data/lib/virtualbox/com/abstract_interface.rb +167 -0
- data/lib/virtualbox/com/base_interface.rb +38 -0
- data/lib/virtualbox/com/ffi/interface.rb +150 -0
- data/lib/virtualbox/com/ffi/interfaces.rb +54 -0
- data/lib/virtualbox/com/ffi/util.rb +119 -0
- data/lib/virtualbox/com/ffi/vboxxpcomc.rb +31 -0
- data/lib/virtualbox/com/ffi_interface.rb +96 -0
- data/lib/virtualbox/com/implementer/base.rb +59 -0
- data/lib/virtualbox/com/implementer/ffi.rb +361 -0
- data/lib/virtualbox/com/implementer/mscom.rb +175 -0
- data/lib/virtualbox/com/implementer/nil.rb +10 -0
- data/lib/virtualbox/com/interface/3.1.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.1.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/guest_os_type.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/host.rb +42 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/machine.rb +105 -0
- data/lib/virtualbox/com/interface/3.1.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/medium.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.1.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/system_properties.rb +37 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_controller.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_server.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.2.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/3.2.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/machine.rb +118 -0
- data/lib/virtualbox/com/interface/3.2.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/medium.rb +51 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter.rb +34 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.2.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_server.rb +21 -0
- data/lib/virtualbox/com/mscom_interface.rb +44 -0
- data/lib/virtualbox/com/nil_interface.rb +7 -0
- data/lib/virtualbox/com/util.rb +32 -0
- data/lib/virtualbox/cpu.rb +61 -0
- data/lib/virtualbox/dhcp_server.rb +89 -0
- data/lib/virtualbox/dvd.rb +27 -0
- data/lib/virtualbox/exceptions.rb +39 -0
- data/lib/virtualbox/ext/byte_normalizer.rb +17 -0
- data/lib/virtualbox/ext/glob_loader.rb +22 -0
- data/lib/virtualbox/ext/logger.rb +38 -0
- data/lib/virtualbox/ext/platform.rb +27 -0
- data/lib/virtualbox/ext/subclass_listing.rb +24 -0
- data/lib/virtualbox/extra_data.rb +127 -0
- data/lib/virtualbox/forwarded_port.rb +222 -0
- data/lib/virtualbox/global.rb +102 -0
- data/lib/virtualbox/guest_property.rb +116 -0
- data/lib/virtualbox/hard_drive.rb +246 -0
- data/lib/virtualbox/host.rb +71 -0
- data/lib/virtualbox/host_network_interface.rb +137 -0
- data/lib/virtualbox/hw_virtualization.rb +63 -0
- data/lib/virtualbox/lib.rb +84 -0
- data/lib/virtualbox/media.rb +20 -0
- data/lib/virtualbox/medium.rb +145 -0
- data/lib/virtualbox/medium_attachment.rb +61 -0
- data/lib/virtualbox/nat_engine.rb +71 -0
- data/lib/virtualbox/nat_forwarded_port.rb +171 -0
- data/lib/virtualbox/network_adapter.rb +166 -0
- data/lib/virtualbox/proxies/collection.rb +57 -0
- data/lib/virtualbox/shared_folder.rb +220 -0
- data/lib/virtualbox/snapshot.rb +185 -0
- data/lib/virtualbox/storage_controller.rb +160 -0
- data/lib/virtualbox/system_properties.rb +74 -0
- data/lib/virtualbox/usb_controller.rb +59 -0
- data/lib/virtualbox/usb_device_filter.rb +74 -0
- data/lib/virtualbox/version.rb +36 -0
- data/lib/virtualbox/virtual_system_description.rb +47 -0
- data/lib/virtualbox/vm.rb +684 -0
- data/lib/virtualbox/vrdp_server.rb +59 -0
- data/test/test_helper.rb +18 -0
- data/test/virtualbox/abstract_model/attributable_test.rb +269 -0
- data/test/virtualbox/abstract_model/dirty_test.rb +83 -0
- data/test/virtualbox/abstract_model/interface_attributes_test.rb +194 -0
- data/test/virtualbox/abstract_model/relatable_test.rb +348 -0
- data/test/virtualbox/abstract_model/validatable_test.rb +308 -0
- data/test/virtualbox/abstract_model/version_matcher_test.rb +41 -0
- data/test/virtualbox/abstract_model_test.rb +462 -0
- data/test/virtualbox/appliance_test.rb +159 -0
- data/test/virtualbox/audio_adapter_test.rb +83 -0
- data/test/virtualbox/bios_test.rb +83 -0
- data/test/virtualbox/com/abstract_enum_test.rb +49 -0
- data/test/virtualbox/com/abstract_implementer_test.rb +40 -0
- data/test/virtualbox/com/abstract_interface_test.rb +140 -0
- data/test/virtualbox/com/ffi/interface_test.rb +249 -0
- data/test/virtualbox/com/ffi/util_test.rb +108 -0
- data/test/virtualbox/com/ffi_interface_test.rb +42 -0
- data/test/virtualbox/com/implementer/base_test.rb +38 -0
- data/test/virtualbox/com/implementer/ffi_test.rb +527 -0
- data/test/virtualbox/com/implementer/mscom_test.rb +247 -0
- data/test/virtualbox/com/mscom_interface_test.rb +17 -0
- data/test/virtualbox/com/util_test.rb +17 -0
- data/test/virtualbox/cpu_test.rb +103 -0
- data/test/virtualbox/dhcp_server_test.rb +165 -0
- data/test/virtualbox/dvd_test.rb +28 -0
- data/test/virtualbox/ext/byte_normalizer_test.rb +34 -0
- data/test/virtualbox/ext/platform_test.rb +50 -0
- data/test/virtualbox/ext/subclass_listing_test.rb +25 -0
- data/test/virtualbox/extra_data_test.rb +155 -0
- data/test/virtualbox/forwarded_port_test.rb +286 -0
- data/test/virtualbox/global_test.rb +46 -0
- data/test/virtualbox/hard_drive_test.rb +141 -0
- data/test/virtualbox/host_network_interface_test.rb +254 -0
- data/test/virtualbox/host_test.rb +94 -0
- data/test/virtualbox/hw_virtualization_test.rb +103 -0
- data/test/virtualbox/lib_test.rb +93 -0
- data/test/virtualbox/medium_attachment_test.rb +147 -0
- data/test/virtualbox/medium_test.rb +192 -0
- data/test/virtualbox/nat_engine_test.rb +106 -0
- data/test/virtualbox/nat_forwarded_port_test.rb +222 -0
- data/test/virtualbox/network_adapter_test.rb +191 -0
- data/test/virtualbox/proxies/collection_test.rb +102 -0
- data/test/virtualbox/shared_folder_test.rb +219 -0
- data/test/virtualbox/snapshot_test.rb +231 -0
- data/test/virtualbox/storage_controller_test.rb +197 -0
- data/test/virtualbox/system_properties_test.rb +87 -0
- data/test/virtualbox/usb_controller_test.rb +112 -0
- data/test/virtualbox/usb_device_filter_test.rb +93 -0
- data/test/virtualbox/version_test.rb +59 -0
- data/test/virtualbox/virtual_system_description_test.rb +61 -0
- data/test/virtualbox/vm_test.rb +637 -0
- data/test/virtualbox/vrdp_server_test.rb +83 -0
- data/test/virtualbox_test.rb +11 -0
- data/virtualbox.gemspec +25 -0
- metadata +397 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
# Represents a single storage controller which can be attached to a
|
|
3
|
+
# virtual machine.
|
|
4
|
+
#
|
|
5
|
+
# **Currently, storage controllers can not be created from scratch.
|
|
6
|
+
# Therefore, the only way to use this model is through a relationship
|
|
7
|
+
# of a {VM} object.**
|
|
8
|
+
#
|
|
9
|
+
# # Attributes and Relationships
|
|
10
|
+
#
|
|
11
|
+
# Properties of the storage controller are exposed using standard ruby instance
|
|
12
|
+
# methods which are generated on the fly. Because of this, they are not listed
|
|
13
|
+
# below as available instance methods.
|
|
14
|
+
#
|
|
15
|
+
# These attributes can be accessed and modified via standard ruby-style
|
|
16
|
+
# `instance.attribute` and `instance.attribute=` methods. The attributes are
|
|
17
|
+
# listed below.
|
|
18
|
+
#
|
|
19
|
+
# Relationships are also accessed like attributes but can't be set. Instead,
|
|
20
|
+
# they are typically references to other objects such as an {AttachedDevice} which
|
|
21
|
+
# in turn have their own attributes which can be modified.
|
|
22
|
+
#
|
|
23
|
+
# ## Attributes
|
|
24
|
+
#
|
|
25
|
+
# This is copied directly from the class header, but lists all available
|
|
26
|
+
# attributes. If you don't understand what this means, read {Attributable}.
|
|
27
|
+
#
|
|
28
|
+
# attribute :parent, :readonly => true
|
|
29
|
+
# attribute :name
|
|
30
|
+
# attribute :type
|
|
31
|
+
# attribute :max_ports, :populate_key => :maxportcount
|
|
32
|
+
# attribute :ports, :populate_key => :portcount
|
|
33
|
+
#
|
|
34
|
+
# ## Relationships
|
|
35
|
+
#
|
|
36
|
+
# In addition to the basic attributes, a virtual machine is related
|
|
37
|
+
# to other things. The relationships are listed below. If you don't
|
|
38
|
+
# understand this, read {Relatable}.
|
|
39
|
+
#
|
|
40
|
+
# relationship :devices, AttachedDevice, :dependent => :destroy
|
|
41
|
+
#
|
|
42
|
+
class StorageController < AbstractModel
|
|
43
|
+
attribute :parent, :readonly => true, :property => false
|
|
44
|
+
attribute :interface, :readonly => true, :property => false
|
|
45
|
+
attribute :name, :readonly => true
|
|
46
|
+
attribute :port_count
|
|
47
|
+
attribute :bus, :readonly => true
|
|
48
|
+
attribute :controller_type
|
|
49
|
+
|
|
50
|
+
class << self
|
|
51
|
+
# Populates a relationship with another model.
|
|
52
|
+
#
|
|
53
|
+
# **This method typically won't be used except internally.**
|
|
54
|
+
#
|
|
55
|
+
# @return [Array<StorageController>]
|
|
56
|
+
def populate_relationship(caller, data)
|
|
57
|
+
if data.is_a?(COM::Util.versioned_interface(:Machine))
|
|
58
|
+
populate_array_relationship(caller, data)
|
|
59
|
+
elsif data.is_a?(MediumAttachment)
|
|
60
|
+
populate_attachment_relationship(caller, data)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Populates a has many relationship for a {VM}.
|
|
65
|
+
#
|
|
66
|
+
# **This method typically won't be used except internally.**
|
|
67
|
+
#
|
|
68
|
+
# @return [Array<StorageController>]
|
|
69
|
+
def populate_array_relationship(caller, imachine)
|
|
70
|
+
relation = Proxies::Collection.new(caller)
|
|
71
|
+
|
|
72
|
+
imachine.storage_controllers.each do |icontroller|
|
|
73
|
+
relation << new(caller, icontroller)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
relation
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Populates a single relationship for a {MediumAttachment}.
|
|
80
|
+
#
|
|
81
|
+
# **This method typically won't be used except internally.**
|
|
82
|
+
#
|
|
83
|
+
# @return [Array<StorageController>]
|
|
84
|
+
def populate_attachment_relationship(caller, attachment)
|
|
85
|
+
# Find the storage controller with the matching name
|
|
86
|
+
attachment.parent.storage_controllers.find do |sc|
|
|
87
|
+
sc.name == attachment.controller_name
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Destroys a relationship with another model.
|
|
92
|
+
#
|
|
93
|
+
# **This method typically won't be used except internally.**
|
|
94
|
+
def destroy_relationship(caller, data, *args)
|
|
95
|
+
data.each { |v| v.destroy(*args) }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Saves the relationship. This simply calls {#save} on every
|
|
99
|
+
# member of the relationship.
|
|
100
|
+
#
|
|
101
|
+
# **This method typically won't be used except internally.**
|
|
102
|
+
def save_relationship(caller, controllers)
|
|
103
|
+
controllers.each do |sc|
|
|
104
|
+
sc.save
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Since storage controllers still can't be created from scratch,
|
|
110
|
+
# this method shouldn't be called. Instead, storage controllers
|
|
111
|
+
# can be retrieved through relationships of other models such
|
|
112
|
+
# as {VM}.
|
|
113
|
+
def initialize(caller, icontroller)
|
|
114
|
+
super()
|
|
115
|
+
|
|
116
|
+
populate_attributes({
|
|
117
|
+
:parent => caller,
|
|
118
|
+
:interface => icontroller
|
|
119
|
+
}, :ignore_relationships => true)
|
|
120
|
+
load_interface_attributes(icontroller)
|
|
121
|
+
clear_dirty!
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Retrieves the array of medium attachments related to this storage controller.
|
|
125
|
+
# This is not implemented as a relationship simply because it would have been
|
|
126
|
+
# difficult to do so (circular) and its not really necessary.
|
|
127
|
+
def medium_attachments
|
|
128
|
+
parent.medium_attachments.find_all do |ma|
|
|
129
|
+
ma.storage_controller == self
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Saves the storage controller. This method shouldn't be called directly.
|
|
134
|
+
# Instead, {VM#save} should be called, which will save all attached storage
|
|
135
|
+
# controllers as well. This will setup the proper parameter for `interface`
|
|
136
|
+
# here.
|
|
137
|
+
def save
|
|
138
|
+
parent.with_open_session do |session|
|
|
139
|
+
machine = session.machine
|
|
140
|
+
save_changed_interface_attributes(machine.get_storage_controller_by_name(name))
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Destroys the storage controller. This first detaches all attachments on this
|
|
145
|
+
# storage controller. Note that this does *not* delete the media on the attachments,
|
|
146
|
+
# unless specified by the options.
|
|
147
|
+
def destroy(*args)
|
|
148
|
+
# First remove all attachments
|
|
149
|
+
medium_attachments.each do |ma|
|
|
150
|
+
ma.destroy(*args)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Finally, remove ourselves
|
|
154
|
+
parent.with_open_session do |session|
|
|
155
|
+
machine = session.machine
|
|
156
|
+
machine.remove_storage_controller(name)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
# Represents the system properties associated with this VirtualBox
|
|
3
|
+
# installation. Many of these properties are readonly and represent
|
|
4
|
+
# limits on the system (max RAM available, max CPU, etc.). There are
|
|
5
|
+
# also configurable options which can be saved such as the default
|
|
6
|
+
# hard disk folder, or default machine folder.
|
|
7
|
+
class SystemProperties < AbstractModel
|
|
8
|
+
attribute :interface, :readonly => true, :property => false
|
|
9
|
+
attribute :min_guest_ram, :readonly => true
|
|
10
|
+
attribute :max_guest_ram, :readonly => true
|
|
11
|
+
attribute :min_guest_vram, :readonly => true
|
|
12
|
+
attribute :max_guest_vram, :readonly => true
|
|
13
|
+
attribute :min_guest_cpu_count, :readonly => true
|
|
14
|
+
attribute :max_guest_cpu_count, :readonly => true
|
|
15
|
+
attribute :max_vdi_size, :readonly => true
|
|
16
|
+
attribute :network_adapter_count, :readonly => true
|
|
17
|
+
attribute :serial_port_count, :readonly => true
|
|
18
|
+
attribute :parallel_port_count, :readonly => true
|
|
19
|
+
attribute :max_boot_position, :readonly => true
|
|
20
|
+
attribute :default_machine_folder
|
|
21
|
+
attribute :default_hard_disk_folder
|
|
22
|
+
attribute :medium_formats, :readonly => true
|
|
23
|
+
attribute :default_hard_disk_format
|
|
24
|
+
attribute :remote_display_auth_library
|
|
25
|
+
attribute :web_service_auth_library
|
|
26
|
+
attribute :log_history_count
|
|
27
|
+
attribute :default_audio_driver, :readonly => true
|
|
28
|
+
|
|
29
|
+
class << self
|
|
30
|
+
# Populates the system properties relationship for anything
|
|
31
|
+
# which is related to it.
|
|
32
|
+
#
|
|
33
|
+
# **This method typically won't be used except internally.**
|
|
34
|
+
#
|
|
35
|
+
# @return [SystemProperties]
|
|
36
|
+
def populate_relationship(caller, data)
|
|
37
|
+
new(data)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Saves the relationship. This simply calls {#save} on the
|
|
41
|
+
# relationship object.
|
|
42
|
+
#
|
|
43
|
+
# **This method typically won't be used except internally.**
|
|
44
|
+
def save_relationship(caller, item)
|
|
45
|
+
item.save
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initializes the system properties object. This shouldn't be called
|
|
50
|
+
# directly. Instead `Global#system_properties` should be used to
|
|
51
|
+
# retrieve this object.
|
|
52
|
+
def initialize(isysprop)
|
|
53
|
+
initialize_attributes(isysprop)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the attributes of an existing shared folder.
|
|
57
|
+
def initialize_attributes(isysprop)
|
|
58
|
+
# Save the interface to an attribute
|
|
59
|
+
write_attribute(:interface, isysprop)
|
|
60
|
+
|
|
61
|
+
# Load the attributes from the interface
|
|
62
|
+
load_interface_attributes(interface)
|
|
63
|
+
|
|
64
|
+
# Clear dirty and mark as existing
|
|
65
|
+
clear_dirty!
|
|
66
|
+
existing_record!
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Saves the system properties.
|
|
70
|
+
def save
|
|
71
|
+
save_changed_interface_attributes(interface)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
# Represents a USB controller within VirtualBox. This class is a relationship
|
|
3
|
+
# to {VM} objects.
|
|
4
|
+
class USBController < AbstractModel
|
|
5
|
+
attribute :parent, :readonly => true, :property => false
|
|
6
|
+
attribute :interface, :readonly => true, :property => false
|
|
7
|
+
attribute :enabled, :boolean => true
|
|
8
|
+
attribute :enabled_ehci, :boolean => true
|
|
9
|
+
attribute :usb_standard, :readonly => true
|
|
10
|
+
relationship :device_filters, :USBDeviceFilter
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
# Populates the USB controller relationship for anything
|
|
14
|
+
# which is related to it.
|
|
15
|
+
#
|
|
16
|
+
# **This method typically won't be used except internally.**
|
|
17
|
+
#
|
|
18
|
+
# @return [USBController]
|
|
19
|
+
def populate_relationship(caller, machine)
|
|
20
|
+
new(caller, machine.usb_controller)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Saves the relationship. This simply calls {#save} on the
|
|
24
|
+
# relationship object.
|
|
25
|
+
#
|
|
26
|
+
# **This method typically won't be used except internally.**
|
|
27
|
+
def save_relationship(caller, item)
|
|
28
|
+
item.save
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def initialize(parent, iusb)
|
|
33
|
+
initialize_attributes(parent, iusb)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize_attributes(parent, iusb)
|
|
37
|
+
# Write the parent and interface attributes
|
|
38
|
+
write_attribute(:parent, parent)
|
|
39
|
+
write_attribute(:interface, iusb)
|
|
40
|
+
|
|
41
|
+
# Load the interface attributes
|
|
42
|
+
load_interface_attributes(interface)
|
|
43
|
+
|
|
44
|
+
# Setup the relationships
|
|
45
|
+
populate_relationships(interface)
|
|
46
|
+
|
|
47
|
+
# Clear dirty and mark as existing
|
|
48
|
+
clear_dirty!
|
|
49
|
+
existing_record!
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Saves the USB controller.
|
|
53
|
+
def save
|
|
54
|
+
parent.with_open_session do |session|
|
|
55
|
+
save_changed_interface_attributes(session.machine.usb_controller)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
# Represents a USB device filter within VirtualBox. This class
|
|
3
|
+
# is a relationship to {USBController} objects.
|
|
4
|
+
class USBDeviceFilter < AbstractModel
|
|
5
|
+
attribute :parent, :readonly => true, :property => false
|
|
6
|
+
attribute :parent_collection, :readonly => true, :property => false
|
|
7
|
+
attribute :interface, :readonly => true, :property => false
|
|
8
|
+
attribute :name
|
|
9
|
+
attribute :active, :boolean => true
|
|
10
|
+
attribute :vendor_id
|
|
11
|
+
attribute :product_id
|
|
12
|
+
attribute :revision
|
|
13
|
+
attribute :manufacturer
|
|
14
|
+
attribute :product
|
|
15
|
+
attribute :serial_number
|
|
16
|
+
attribute :port
|
|
17
|
+
attribute :remote
|
|
18
|
+
attribute :masked_interfaces
|
|
19
|
+
|
|
20
|
+
class << self
|
|
21
|
+
# Populates the USB controller relationship for anything
|
|
22
|
+
# which is related to it.
|
|
23
|
+
#
|
|
24
|
+
# **This method typically won't be used except internally.**
|
|
25
|
+
#
|
|
26
|
+
# @return [USBDeviceFilter]
|
|
27
|
+
def populate_relationship(caller, usbcontroller)
|
|
28
|
+
result = Proxies::Collection.new(caller)
|
|
29
|
+
|
|
30
|
+
usbcontroller.device_filters.each do |filter|
|
|
31
|
+
result << new(filter)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
result
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Saves the relationship. This simply calls {#save} on the
|
|
38
|
+
# relationship object.
|
|
39
|
+
#
|
|
40
|
+
# **This method typically won't be used except internally.**
|
|
41
|
+
def save_relationship(caller, item)
|
|
42
|
+
item.save
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def initialize(iusb)
|
|
47
|
+
initialize_attributes(iusb)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def initialize_attributes(iusb)
|
|
51
|
+
# Write the parent and interface attributes
|
|
52
|
+
write_attribute(:interface, iusb)
|
|
53
|
+
|
|
54
|
+
# Load the interface attributes
|
|
55
|
+
load_interface_attributes(interface)
|
|
56
|
+
|
|
57
|
+
# Clear dirty and mark as existing
|
|
58
|
+
clear_dirty!
|
|
59
|
+
existing_record!
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def added_to_relationship(proxy)
|
|
63
|
+
write_attribute(:parent, proxy.parent)
|
|
64
|
+
write_attribute(:parent_collection, proxy)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Saves the USB device.
|
|
68
|
+
def save
|
|
69
|
+
parent.with_open_session do |session|
|
|
70
|
+
# TODO: save_changed_interface_attributes(session.machine.usb_controller)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
VERSION = "0.7.6.dev"
|
|
3
|
+
|
|
4
|
+
module Version
|
|
5
|
+
# Returns a boolean denoting whether the current VirtualBox
|
|
6
|
+
# version is supported or not. This will return `false` if the
|
|
7
|
+
# version is invalid, the version is not detected, etc. That means
|
|
8
|
+
# that even if VirtualBox is not installed, this will simply
|
|
9
|
+
# return `false`.
|
|
10
|
+
#
|
|
11
|
+
# @return [Boolean]
|
|
12
|
+
def supported?
|
|
13
|
+
!version.nil?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Returns the version string of the VirtualBox installed, ex. "3.1.6"
|
|
17
|
+
# This string is cached since the version typically doesn't change
|
|
18
|
+
# during runtime. If you must refresh the version, send the boolean
|
|
19
|
+
# `true` as the first parameter.
|
|
20
|
+
def version(refresh=false)
|
|
21
|
+
@_version = Lib.lib.virtualbox.version if @_version.nil? || refresh
|
|
22
|
+
@_version
|
|
23
|
+
rescue Exception
|
|
24
|
+
nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Returns the revision string of the VirtualBox installed, ex. "51742"
|
|
28
|
+
# This string is cached since the revision doesn't typically change during
|
|
29
|
+
# runtime. If you must refresh the version, send the boolean `true` as the
|
|
30
|
+
# first parameter.
|
|
31
|
+
def revision(refresh=false)
|
|
32
|
+
@_revision = Lib.lib.virtualbox.revision.to_s if @_revision.nil? || refresh
|
|
33
|
+
@_revision
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
# Represents a description of a virtual system in an {Appliance}. This contains
|
|
3
|
+
# the values that are in the OVF files as well as recommend values from VirtualBox.
|
|
4
|
+
class VirtualSystemDescription < AbstractModel
|
|
5
|
+
attribute :interface, :readonly => true
|
|
6
|
+
attribute :descriptions, :readonly => true, :default => {}
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
def populate_relationship(caller, data)
|
|
10
|
+
result = Proxies::Collection.new(caller)
|
|
11
|
+
|
|
12
|
+
data.each do |vsd|
|
|
13
|
+
result << new(vsd)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
result
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initialize(ivsd)
|
|
21
|
+
write_attribute(:interface, ivsd)
|
|
22
|
+
initialize_attributes(ivsd)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def initialize_attributes(ivsd)
|
|
26
|
+
# Grab all the descriptions, iterate over each, and add to the hash of
|
|
27
|
+
# descriptions. This multiple loop method is used instead of `get_description` since
|
|
28
|
+
# that method doesn't work well with MSCOM.
|
|
29
|
+
COM::Util.versioned_interface(:VirtualSystemDescriptionType).each_with_index do |type, index|
|
|
30
|
+
COM::Util.versioned_interface(:VirtualSystemDescriptionValueType).each_with_index do |value_type, value_index|
|
|
31
|
+
value = ivsd.get_values_by_type(type, value_type)
|
|
32
|
+
if value && value != [] && value != [nil]
|
|
33
|
+
descriptions[type] ||= {}
|
|
34
|
+
descriptions[type][value_type] = value.first
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Clear dirtiness, since this should only be called initially and
|
|
40
|
+
# therefore shouldn't affect dirtiness
|
|
41
|
+
clear_dirty!
|
|
42
|
+
|
|
43
|
+
# But this is an existing record
|
|
44
|
+
existing_record!
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|