velir_virtualbox 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- 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,35 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
class AbstractModel
|
3
|
+
module VersionMatcher
|
4
|
+
# Asserts that two versions match. Otherwise raises an
|
5
|
+
# exception.
|
6
|
+
def assert_version_match(req, cur)
|
7
|
+
if !version_match?(req, cur)
|
8
|
+
message = "Required version: #{req}; Current: #{cur}"
|
9
|
+
raise Exceptions::UnsupportedVersionException.new(message)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Checks if a given version requirement matches the current
|
14
|
+
# version.
|
15
|
+
#
|
16
|
+
# @return [Boolean]
|
17
|
+
def version_match?(requirement, current)
|
18
|
+
split_version(requirement) == split_version(current)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Splits a version string into a two-item array with the parts
|
22
|
+
# of the version, respectively. If the version has more than two
|
23
|
+
# parts, the rest are ignored.
|
24
|
+
#
|
25
|
+
# @param [String] version
|
26
|
+
# @return [Array]
|
27
|
+
def split_version(version)
|
28
|
+
version.split(/\./)[0,2]
|
29
|
+
rescue Exception
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
# Represents an VirtualBox "appliance" which is an exported virtual machine or
|
3
|
+
# virtual machines. Appliances typically come with an OVF file and one or more
|
4
|
+
# compressed hard disks, and can be used to import directly into other VirtualBox
|
5
|
+
# installations. Appliances allow for virtual machine portability.
|
6
|
+
class Appliance < AbstractModel
|
7
|
+
attribute :path
|
8
|
+
attribute :interface, :readonly => true, :property => false
|
9
|
+
relationship :virtual_systems, :VirtualSystemDescription
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
write_attribute(:interface, Lib.lib.virtualbox.create_appliance)
|
13
|
+
|
14
|
+
initialize_from_path(*args) if args.length == 1
|
15
|
+
|
16
|
+
clear_dirty!
|
17
|
+
end
|
18
|
+
|
19
|
+
# Initializes this Appliance instance from a path to an OVF file. This sets
|
20
|
+
# up the relationships and so on.
|
21
|
+
#
|
22
|
+
# @param [String] path Path to the OVF file.
|
23
|
+
def initialize_from_path(path)
|
24
|
+
# Read in the data from the path
|
25
|
+
interface.read(path).wait_for_completion(-1)
|
26
|
+
|
27
|
+
# Interpret the data to fill in the interface properties
|
28
|
+
interface.interpret
|
29
|
+
|
30
|
+
# Load the interface attributes
|
31
|
+
load_interface_attributes(interface)
|
32
|
+
|
33
|
+
# Fill in the virtual systems
|
34
|
+
populate_relationship(:virtual_systems, interface.virtual_system_descriptions)
|
35
|
+
|
36
|
+
# Should be an existing record
|
37
|
+
existing_record!
|
38
|
+
end
|
39
|
+
|
40
|
+
# Imports the machines associated with this appliance. If a block is given,
|
41
|
+
# it will be yielded every percent that the operation progresses. This can be
|
42
|
+
# done to check the progress of the import.
|
43
|
+
def import(&block)
|
44
|
+
interface.import_machines.wait(&block)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Exports the machines to the given path. If a block is given, it will be yielded
|
48
|
+
# every percent that the operation progresses. This can be done to check the progress
|
49
|
+
# of the export in real-time.
|
50
|
+
def export(&block)
|
51
|
+
interface.write("ovf-1.0", true, path).wait(&block)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Adds a VM to the appliance
|
55
|
+
def add_machine(vm, options = {})
|
56
|
+
sys_desc = vm.interface.export(interface, path)
|
57
|
+
options.each do |key, value|
|
58
|
+
sys_desc.add_description(key, value, value)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
class AudioAdapter < AbstractModel
|
3
|
+
attribute :parent, :readonly => true, :property => false
|
4
|
+
attribute :enabled, :boolean => true
|
5
|
+
attribute :audio_controller
|
6
|
+
attribute :audio_driver
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# Populates a relationship with another model.
|
10
|
+
#
|
11
|
+
# **This method typically won't be used except internally.**
|
12
|
+
#
|
13
|
+
# @return [BIOS]
|
14
|
+
def populate_relationship(caller, imachine)
|
15
|
+
data = new(caller, imachine.audio_adapter)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Saves the relationship.
|
19
|
+
#
|
20
|
+
# **This method typically won't be used except internally.**
|
21
|
+
def save_relationship(caller, instance)
|
22
|
+
instance.save
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(parent, iaudio)
|
27
|
+
write_attribute(:parent, parent)
|
28
|
+
|
29
|
+
# Load the attributes and mark the whole thing as existing
|
30
|
+
load_interface_attributes(iaudio)
|
31
|
+
clear_dirty!
|
32
|
+
existing_record!
|
33
|
+
end
|
34
|
+
|
35
|
+
def validate
|
36
|
+
super
|
37
|
+
|
38
|
+
validates_inclusion_of :enabled, :in => [true, false]
|
39
|
+
validates_inclusion_of :audio_controller, :in => COM::Util.versioned_interface(:AudioControllerType).map
|
40
|
+
validates_inclusion_of :audio_driver, :in => COM::Util.versioned_interface(:AudioDriverType).map
|
41
|
+
end
|
42
|
+
|
43
|
+
def save
|
44
|
+
parent.with_open_session do |session|
|
45
|
+
machine = session.machine
|
46
|
+
|
47
|
+
# Save them
|
48
|
+
save_changed_interface_attributes(machine.audio_adapter)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
# Represents the BIOS settings of a {VM}.
|
3
|
+
class BIOS < AbstractModel
|
4
|
+
attribute :parent, :readonly => true, :property => false
|
5
|
+
attribute :acpi_enabled, :boolean => true
|
6
|
+
attribute :io_apic_enabled, :boolean => true
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# Populates a relationship with another model.
|
10
|
+
#
|
11
|
+
# **This method typically won't be used except internally.**
|
12
|
+
#
|
13
|
+
# @return [BIOS]
|
14
|
+
def populate_relationship(caller, imachine)
|
15
|
+
data = new(caller, imachine.bios_settings)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Saves the relationship.
|
19
|
+
#
|
20
|
+
# **This method typically won't be used except internally.**
|
21
|
+
def save_relationship(caller, instance)
|
22
|
+
instance.save
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(parent, bios_settings)
|
27
|
+
write_attribute(:parent, parent)
|
28
|
+
|
29
|
+
# Load the attributes and mark the whole thing as existing
|
30
|
+
load_interface_attributes(bios_settings)
|
31
|
+
clear_dirty!
|
32
|
+
existing_record!
|
33
|
+
end
|
34
|
+
|
35
|
+
def validate
|
36
|
+
super
|
37
|
+
|
38
|
+
validates_inclusion_of :acpi_enabled, :io_apic_enabled, :in => [true, false]
|
39
|
+
end
|
40
|
+
|
41
|
+
def save
|
42
|
+
parent.with_open_session do |session|
|
43
|
+
machine = session.machine
|
44
|
+
|
45
|
+
# Save them
|
46
|
+
save_changed_interface_attributes(machine.bios_settings)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
module COM
|
3
|
+
WSTRING = :unicode_string
|
4
|
+
T_INT32 = :int
|
5
|
+
T_INT64 = :long
|
6
|
+
T_ULONG = :ulong
|
7
|
+
T_UINT8 = :uchar
|
8
|
+
T_UINT16 = :ushort
|
9
|
+
T_UINT32 = :uint
|
10
|
+
T_UINT64 = :ulong
|
11
|
+
T_BOOL = :char
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# The com directory of the gem
|
16
|
+
comdir = File.join(File.dirname(__FILE__), 'com')
|
17
|
+
|
18
|
+
# Require the abstract interface first then glob load all
|
19
|
+
# of the interfaces
|
20
|
+
require File.expand_path("abstract_interface", comdir)
|
21
|
+
require File.expand_path("abstract_enum", comdir)
|
22
|
+
VirtualBox::GlobLoader.glob_require(File.join(comdir, "interface"))
|
23
|
+
VirtualBox::GlobLoader.glob_require(comdir, %w{base_interface abstract_interface abstract_implementer util ffi/interface ffi/util implementer/base})
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
module COM
|
3
|
+
# Represents a C enum type. Provides functionality to easily convert
|
4
|
+
# an int value to its proper symbol within the enum.
|
5
|
+
class AbstractEnum
|
6
|
+
extend Enumerable
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# Defines the mapping of int => symbol for the given Enum.
|
10
|
+
# The parameter to this can be an Array or Hash or anything which
|
11
|
+
# can be indexed with `[]` and an integer and returns a value of
|
12
|
+
# some sort. If value is left nil, it will return the current mapping
|
13
|
+
def map(value = nil)
|
14
|
+
@map = value if value
|
15
|
+
@map
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the symbol associatd with the given key
|
19
|
+
def [](key)
|
20
|
+
@map[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the index associated with a value
|
24
|
+
def index(key)
|
25
|
+
@map.index(key)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Iterate over the enum, yielding each item to a block.
|
29
|
+
def each
|
30
|
+
@map.each do |key|
|
31
|
+
yield key
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Provided mostly for testing purposes only, but resets the mapping
|
36
|
+
# to nil.
|
37
|
+
def reset!
|
38
|
+
@map = nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
module COM
|
3
|
+
# Base class for a COM interface implementer. Any child of this class is
|
4
|
+
# responsible for properly handling the various method and propery calls
|
5
|
+
# of a given {AbstractInterface} and making them do actual work.
|
6
|
+
#
|
7
|
+
# This abstraction is necessary to change the behavior of calls between
|
8
|
+
# Windows (COM) and Unix (XPCOM), which have different calling conventions.
|
9
|
+
class AbstractImplementer
|
10
|
+
attr_reader :interface
|
11
|
+
attr_reader :lib
|
12
|
+
|
13
|
+
# Initializes an implementer for the given {AbstractInterface}. The
|
14
|
+
# implementor's other methods, such as {read_property} or
|
15
|
+
# {call_function} are responsible for executing the said action on
|
16
|
+
# the interface.
|
17
|
+
#
|
18
|
+
# @param [AbstractInterface] interface
|
19
|
+
def initialize(interface, lib)
|
20
|
+
@interface = interface
|
21
|
+
@lib = lib
|
22
|
+
end
|
23
|
+
|
24
|
+
# Read a property of the interface.
|
25
|
+
#
|
26
|
+
# @param [Symbol] name The propery name
|
27
|
+
def read_property(name, opts)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Writes a property of the interface.
|
31
|
+
#
|
32
|
+
# @param [Symbol] name The property name
|
33
|
+
# @param [Object] value The value to set
|
34
|
+
def write_property(name, value, opts)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Calls a function on the interface.
|
38
|
+
#
|
39
|
+
# @param [Symbol] name The function name
|
40
|
+
# @param [Array] args The arguments to the function
|
41
|
+
def call_function(name, args, opts)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
module COM
|
3
|
+
# Base class for a COM (component object model) interface class. This
|
4
|
+
# abstraction is necessary to maintain a common ground between
|
5
|
+
# Windows COM usage and the VirtualBox C API for unix based systems.
|
6
|
+
#
|
7
|
+
# # Defining an Interface
|
8
|
+
#
|
9
|
+
# Defining an interface is done by subclassing AbstractInterface and
|
10
|
+
# using the provided class methods to define the COM methods and
|
11
|
+
# properties. A small example class is shown below:
|
12
|
+
#
|
13
|
+
# class Time < AbstractInterface
|
14
|
+
# function :now, [[:out, :uint]]
|
15
|
+
# property :hour, :uint
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# # Accessing an Interface
|
19
|
+
#
|
20
|
+
# Interfaces are never accessed directly. Instead, an {InterfaceRunner}
|
21
|
+
# should be used. Depending on the OS of the running system, the VirtualBox
|
22
|
+
# gem will automatically either load the MSCOM interface (on Windows)
|
23
|
+
# or the XPCOM interface (on Unix). One loaded, interfaces can simply be
|
24
|
+
# accessed:
|
25
|
+
#
|
26
|
+
# # Assume `time` was retrieved already
|
27
|
+
# puts time.foo.to_s
|
28
|
+
# time.hour = 20
|
29
|
+
# x = time.now
|
30
|
+
#
|
31
|
+
# The above example shows how the properties and functions can be used
|
32
|
+
# with a given interface.
|
33
|
+
#
|
34
|
+
class AbstractInterface
|
35
|
+
attr_reader :implementer
|
36
|
+
attr_reader :lib
|
37
|
+
|
38
|
+
class << self
|
39
|
+
# Adds a function to the interface with the given name and function
|
40
|
+
# spec. The spec determines the arguments required, the order they
|
41
|
+
# are required in, and any out-arguments.
|
42
|
+
def function(name, type, spec, opts={})
|
43
|
+
members << [name, {
|
44
|
+
:type => :function,
|
45
|
+
:value_type => type,
|
46
|
+
:spec => spec,
|
47
|
+
:opts => opts
|
48
|
+
}]
|
49
|
+
|
50
|
+
# Define the method to call the function
|
51
|
+
define_method(name) { |*args| call_function(name, *args) }
|
52
|
+
end
|
53
|
+
|
54
|
+
# Adds a property to the interface with the given name, type, and
|
55
|
+
# options.
|
56
|
+
def property(name, type, opts={})
|
57
|
+
members << [name, {
|
58
|
+
:type => :property,
|
59
|
+
:value_type => type,
|
60
|
+
:opts => opts
|
61
|
+
}]
|
62
|
+
|
63
|
+
# Define the method to read the property
|
64
|
+
define_method(name) { read_property(name) }
|
65
|
+
|
66
|
+
# Define method to write the property
|
67
|
+
define_method("#{name}=".to_sym) { |value| write_property(name, value) } unless opts[:readonly]
|
68
|
+
end
|
69
|
+
|
70
|
+
# Returns the information for a given member
|
71
|
+
#
|
72
|
+
# @return [Hash]
|
73
|
+
def member(name)
|
74
|
+
members.each do |current_name, opts|
|
75
|
+
if name == current_name
|
76
|
+
return opts
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns the members of the interface as an array.
|
84
|
+
#
|
85
|
+
# @return [Array]
|
86
|
+
def members
|
87
|
+
@members ||= []
|
88
|
+
end
|
89
|
+
|
90
|
+
# Returns the functions of the interface as an array in the order they
|
91
|
+
# were defined.
|
92
|
+
#
|
93
|
+
# @return [Array]
|
94
|
+
def functions
|
95
|
+
members.find_all do |data|
|
96
|
+
data[1][:type] == :function
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns the properties of the interface as an array in the order they
|
101
|
+
# were defined.
|
102
|
+
#
|
103
|
+
# @return [Array]
|
104
|
+
def properties
|
105
|
+
members.find_all do |data|
|
106
|
+
data[1][:type] == :property
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Initializes the interface with the given implementer
|
112
|
+
def initialize(implementer, lib, *args)
|
113
|
+
# Instantiate the implementer and set it
|
114
|
+
@lib = lib
|
115
|
+
@implementer = implementer.new(self, lib, *args)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Reads a property with the given name by calling the read_property
|
119
|
+
# method on the implementer.
|
120
|
+
def read_property(name)
|
121
|
+
# Just call it on the implementer
|
122
|
+
@implementer.read_property(name, member(name))
|
123
|
+
end
|
124
|
+
|
125
|
+
# Writes a property with the given name and value by calling the
|
126
|
+
# `write_property` method on the implementer.
|
127
|
+
def write_property(name, value)
|
128
|
+
@implementer.write_property(name, value, member(name))
|
129
|
+
end
|
130
|
+
|
131
|
+
# Calls a function with the given name by calling call_function on the
|
132
|
+
# implementer.
|
133
|
+
def call_function(name, *args)
|
134
|
+
@implementer.call_function(name, args, member(name))
|
135
|
+
end
|
136
|
+
|
137
|
+
# Returns a boolean if a given function exists or not
|
138
|
+
def has_function?(name)
|
139
|
+
info = member(name)
|
140
|
+
!info.nil? && info[:type] == :function
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns a boolean if a given property exists or not.
|
144
|
+
def has_property?(name)
|
145
|
+
info = member(name)
|
146
|
+
!info.nil? && info[:type] == :property
|
147
|
+
end
|
148
|
+
|
149
|
+
# Returns the member of the interface specified by name. This simply
|
150
|
+
# calls {AbstractInterface.member}
|
151
|
+
def member(name)
|
152
|
+
self.class.member(name)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the members of the interface as an array. This simply calls
|
156
|
+
# {AbstractInterface.members}.
|
157
|
+
def members
|
158
|
+
self.class.members
|
159
|
+
end
|
160
|
+
|
161
|
+
# Concise inspect
|
162
|
+
def inspect
|
163
|
+
"#<#{self.class.name}>"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|