velir_virtualbox 0.8.4
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 +37 -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 +63 -0
- data/lib/virtualbox/com/ffi/util.rb +121 -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 +381 -0
- data/lib/virtualbox/com/implementer/mscom.rb +189 -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/interface/4.0.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/appliance.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/cleanup_mode.rb +12 -0
- data/lib/virtualbox/com/interface/4.0.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/4.0.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/4.0.x/event_source.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/fault_tolerance_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/4.0.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/hw_virt_ex_property_type.rb +12 -0
- data/lib/virtualbox/com/interface/4.0.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/lock_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/machine.rb +132 -0
- data/lib/virtualbox/com/interface/4.0.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/4.0.x/medium.rb +53 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/network_adapter.rb +35 -0
- data/lib/virtualbox/com/interface/4.0.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/4.0.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/progress.rb +64 -0
- data/lib/virtualbox/com/interface/4.0.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/4.0.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/virtualbox.rb +50 -0
- data/lib/virtualbox/com/interface/4.0.x/vrde_server.rb +23 -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 +35 -0
- data/lib/virtualbox/ext/logger.rb +38 -0
- data/lib/virtualbox/ext/platform.rb +31 -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 +96 -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 +64 -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 +73 -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 +649 -0
- data/lib/virtualbox/vrde_server.rb +57 -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 +255 -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 +633 -0
- data/test/virtualbox/vrde_server_test.rb +83 -0
- data/test/virtualbox_test.rb +11 -0
- data/virtualbox.gemspec +24 -0
- metadata +464 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
module VirtualBox
|
|
2
|
+
# Represents a virtual machine snapshot. Snapshots allow users of virtual
|
|
3
|
+
# machines to make a lightweight "snapshot" of a virtual machine at any
|
|
4
|
+
# moment. This snapshot can be taken while the virtual machine is running
|
|
5
|
+
# or while its powered off. Snapshotting creates a differencing image for
|
|
6
|
+
# the hard drive which allows a virtual machine to restore itself to the
|
|
7
|
+
# exact state of where it was snapshotted.
|
|
8
|
+
#
|
|
9
|
+
# # Getting Snapshots
|
|
10
|
+
#
|
|
11
|
+
# Snapshots are accessed from the `current_snapshot` relationship on {VM}.
|
|
12
|
+
# There is no other way to access snapshots. After getting the current
|
|
13
|
+
# snapshot, you can easily traverse the tree of snapshots by accessing
|
|
14
|
+
# `parent` or `children` on the snapshot. An example follows:
|
|
15
|
+
#
|
|
16
|
+
# vm = VirtualBox::VM.find("MyWindowsXP")
|
|
17
|
+
# p vm.current_snapshot # the current snapshot
|
|
18
|
+
# p vm.current_snapshot.children # The children of the current snapshot
|
|
19
|
+
# p vm.current_snapshot.parent # The current snapshot's parent
|
|
20
|
+
# p vm.current_snapshot.parent.parent.children # You get the idea.
|
|
21
|
+
#
|
|
22
|
+
# # Taking a Snapshot
|
|
23
|
+
#
|
|
24
|
+
# To take a snapshot, call the {VM#take_snapshot} method. Please view
|
|
25
|
+
# the documentation on that method for more information.
|
|
26
|
+
#
|
|
27
|
+
# # Restoring a Snapshot
|
|
28
|
+
#
|
|
29
|
+
# To restore a snapshot, call the {#restore} method. A simple example
|
|
30
|
+
# is shown below:
|
|
31
|
+
#
|
|
32
|
+
# vm = VirtualBox::VM.find("MyWindowsXP")
|
|
33
|
+
# snapshot = vm.current_snapshot.parent
|
|
34
|
+
# snapshot.restore
|
|
35
|
+
#
|
|
36
|
+
# **Note:** The VM object will not immediately update to reflect any settings
|
|
37
|
+
# changes or current snapshot changes from the restore. To grab the updates,
|
|
38
|
+
# either load a new VM object or call {VM#reload}.
|
|
39
|
+
#
|
|
40
|
+
# # Deleting a Snapshot
|
|
41
|
+
#
|
|
42
|
+
# To delete a snapshot, simply find the snapshot of interest and call
|
|
43
|
+
# it's {#destroy} method. A quick example is shown below:
|
|
44
|
+
#
|
|
45
|
+
# vm = VirtualBox::VM.find("MyWindowsXP")
|
|
46
|
+
# snapshot = vm.current_snapshot # Grab the current snapshot
|
|
47
|
+
# snapshot.destroy # Destroy it
|
|
48
|
+
#
|
|
49
|
+
# Note that this doesn't actually affect the `current_snapshot`
|
|
50
|
+
# relationship on the VM. To update all the proper values, you have to call
|
|
51
|
+
# {VM#reload}.
|
|
52
|
+
#
|
|
53
|
+
class Snapshot < AbstractModel
|
|
54
|
+
attribute :uuid, :readonly => true, :property => :id
|
|
55
|
+
attribute :name
|
|
56
|
+
attribute :description
|
|
57
|
+
attribute :time_stamp, :readonly => true
|
|
58
|
+
attribute :online, :readonly => true, :boolean => true
|
|
59
|
+
attribute :interface, :readonly => true, :property => false
|
|
60
|
+
relationship :parent, :Snapshot, :lazy => true
|
|
61
|
+
relationship :machine, :VM, :lazy => true
|
|
62
|
+
relationship :children, :Snapshot, :lazy => true
|
|
63
|
+
|
|
64
|
+
class << self
|
|
65
|
+
# Populates a relationship with another model. Since a snapshot
|
|
66
|
+
# can be in a relationship with multiple items, this method forwards
|
|
67
|
+
# to other methods such as {populate_vm_relationship}.
|
|
68
|
+
#
|
|
69
|
+
# **This method typically won't be used except internally.**
|
|
70
|
+
def populate_relationship(caller, data)
|
|
71
|
+
if data.is_a?(COM::Util.versioned_interface(:Machine))
|
|
72
|
+
populate_machine_relationship(caller, data)
|
|
73
|
+
elsif data.is_a?(Array)
|
|
74
|
+
populate_children_relationship(caller, data)
|
|
75
|
+
elsif data.is_a?(COM::Util.versioned_interface(:Snapshot)) || data.nil?
|
|
76
|
+
populate_parent_relationship(caller, data)
|
|
77
|
+
else
|
|
78
|
+
raise Exceptions::Exception.new("Invalid relationship data for Snapshot: #{data}")
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Populates the VM relationship as the "current snapshot."
|
|
83
|
+
#
|
|
84
|
+
# **This method typically won't be used except internally.**
|
|
85
|
+
#
|
|
86
|
+
# @return [Snapshot]
|
|
87
|
+
def populate_machine_relationship(caller, machine)
|
|
88
|
+
# The current snapshot can and will be nil if there are no snapshots
|
|
89
|
+
# taken. In that case, we just return nil.
|
|
90
|
+
snapshot = machine.current_snapshot
|
|
91
|
+
snapshot ? new(machine.current_snapshot) : nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Populates the VM relationship as the "current snapshot."
|
|
95
|
+
#
|
|
96
|
+
# **This method typically won't be used except internally.**
|
|
97
|
+
#
|
|
98
|
+
# @return [Snapshot]
|
|
99
|
+
def populate_parent_relationship(caller, parent)
|
|
100
|
+
# If the parent is nil then that means the child is the root
|
|
101
|
+
# snapshot
|
|
102
|
+
parent ? new(parent) : nil
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Populates the snapshot child tree relationship.
|
|
106
|
+
#
|
|
107
|
+
# **This method typically won't be used except internally.**
|
|
108
|
+
#
|
|
109
|
+
# @return [Array<Snapshot>]
|
|
110
|
+
def populate_children_relationship(caller, snapshots)
|
|
111
|
+
result = Proxies::Collection.new(caller)
|
|
112
|
+
|
|
113
|
+
snapshots.each do |snapshot|
|
|
114
|
+
result << new(snapshot)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
result
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Initializes a new snapshot. This should never be called on its own.
|
|
122
|
+
# Snapshots should be accessed beginning with the `current_snapshot` on
|
|
123
|
+
# a VM, and can be further accessed by traversing the parent/child tree
|
|
124
|
+
# of the snapshot.
|
|
125
|
+
def initialize(snapshot)
|
|
126
|
+
write_attribute(:interface, snapshot)
|
|
127
|
+
initialize_attributes(snapshot)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def initialize_attributes(snapshot)
|
|
131
|
+
# Load the interface attributes
|
|
132
|
+
load_interface_attributes(snapshot)
|
|
133
|
+
|
|
134
|
+
# Clear dirtiness, since this should only be called initially and
|
|
135
|
+
# therefore shouldn't affect dirtiness
|
|
136
|
+
clear_dirty!
|
|
137
|
+
|
|
138
|
+
# But this is an existing record
|
|
139
|
+
existing_record!
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Loads the lazy relationships.
|
|
143
|
+
#
|
|
144
|
+
# **This method should only be called internally.**
|
|
145
|
+
def load_relationship(name)
|
|
146
|
+
populate_relationship(:parent, interface.parent)
|
|
147
|
+
populate_relationship(:machine, interface.machine)
|
|
148
|
+
populate_relationship(:children, interface.children)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Timestamp that the snapshot was taken. This method overwrites the
|
|
152
|
+
# typical attribute so it can return a Time object.
|
|
153
|
+
def time_stamp
|
|
154
|
+
# Seconds, microseconds, since the time stamp is in milliseconds
|
|
155
|
+
value = read_attribute(:time_stamp)
|
|
156
|
+
Time.at(value / 1000, (value % 1000) * 1000)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Restore a snapshot. This will restore this snapshot's virtual machine
|
|
160
|
+
# to the state that this snapshot represents. This method will block while
|
|
161
|
+
# the restore occurs.
|
|
162
|
+
#
|
|
163
|
+
# If a block is given to the function, it will be yielded with a progress
|
|
164
|
+
# object which can be used to track the progress of the operation.
|
|
165
|
+
def restore(&block)
|
|
166
|
+
machine.with_open_session do |session|
|
|
167
|
+
session.console.restore_snapshot(interface).wait(&block)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Destroy a snapshot. This will physically remove the snapshot. Once this
|
|
172
|
+
# method is called, there is no undo. If this snapshot is a parent of other
|
|
173
|
+
# snapshots, the differencing image of this snapshot will be merged with
|
|
174
|
+
# the child snapshots so no data is lost. This process can sometimes take
|
|
175
|
+
# some time. This method will block while this process occurs.
|
|
176
|
+
#
|
|
177
|
+
# If a block is given to the function, it will be yielded with a progress
|
|
178
|
+
# object which can be used to track the progress of the operation.
|
|
179
|
+
def destroy(&block)
|
|
180
|
+
machine.with_open_session do |session|
|
|
181
|
+
session.console.delete_snapshot(uuid).wait(&block)
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
@@ -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,73 @@
|
|
|
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 :info_vd_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 :medium_formats, :readonly => true
|
|
22
|
+
attribute :default_hard_disk_format
|
|
23
|
+
attribute :vrde_auth_library
|
|
24
|
+
attribute :web_service_auth_library
|
|
25
|
+
attribute :log_history_count
|
|
26
|
+
attribute :default_audio_driver, :readonly => true
|
|
27
|
+
|
|
28
|
+
class << self
|
|
29
|
+
# Populates the system properties relationship for anything
|
|
30
|
+
# which is related to it.
|
|
31
|
+
#
|
|
32
|
+
# **This method typically won't be used except internally.**
|
|
33
|
+
#
|
|
34
|
+
# @return [SystemProperties]
|
|
35
|
+
def populate_relationship(caller, data)
|
|
36
|
+
new(data)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Saves the relationship. This simply calls {#save} on the
|
|
40
|
+
# relationship object.
|
|
41
|
+
#
|
|
42
|
+
# **This method typically won't be used except internally.**
|
|
43
|
+
def save_relationship(caller, item)
|
|
44
|
+
item.save
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Initializes the system properties object. This shouldn't be called
|
|
49
|
+
# directly. Instead `Global#system_properties` should be used to
|
|
50
|
+
# retrieve this object.
|
|
51
|
+
def initialize(isysprop)
|
|
52
|
+
initialize_attributes(isysprop)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Initializes the attributes of an existing shared folder.
|
|
56
|
+
def initialize_attributes(isysprop)
|
|
57
|
+
# Save the interface to an attribute
|
|
58
|
+
write_attribute(:interface, isysprop)
|
|
59
|
+
|
|
60
|
+
# Load the attributes from the interface
|
|
61
|
+
load_interface_attributes(interface)
|
|
62
|
+
|
|
63
|
+
# Clear dirty and mark as existing
|
|
64
|
+
clear_dirty!
|
|
65
|
+
existing_record!
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Saves the system properties.
|
|
69
|
+
def save
|
|
70
|
+
save_changed_interface_attributes(interface)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
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
|