Class: Virtuoso::VirtualBox::Interface
- Inherits:
-
Object
- Object
- Virtuoso::VirtualBox::Interface
- Defined in:
- lib/virtuoso/virtualbox/interface.rb
Instance Method Summary collapse
- #create!(vm_name, bond_interface, disk_size) ⇒ Object
- #destroy!(vm_name, physically_delete_media = true) ⇒ Object
-
#initialize ⇒ Interface
constructor
A new instance of Interface.
- #installed? ⇒ Boolean
Constructor Details
#initialize ⇒ Interface
Returns a new instance of Interface.
12 13 14 15 16 |
# File 'lib/virtuoso/virtualbox/interface.rb', line 12 def initialize @log = Logger.new(STDOUT) @virtualbox = Hash.new @virtualbox[:version] = ::VirtualBox.version end |
Instance Method Details
#create!(vm_name, bond_interface, disk_size) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/virtuoso/virtualbox/interface.rb', line 18 def create!(vm_name, bond_interface, disk_size) vm = create_vm!(vm_name) vm = setup_vm!(vm) vm.reload storage_controller = add_storage_controller!(vm) disk = create_disk!(vm_name, disk_size) attach_disk!(vm, storage_controller, disk) add_bridged_network_interface!(vm, 1, bond_interface) set_boot_order!(vm) end |
#destroy!(vm_name, physically_delete_media = true) ⇒ Object
29 30 31 32 33 |
# File 'lib/virtuoso/virtualbox/interface.rb', line 29 def destroy!(vm_name, physically_delete_media=true) vm = ::VirtualBox::VM.find(vm_name) raise Errors::VMNotFoundError if vm.nil? vm.destroy(:destroy_medium => physically_delete_media ) end |
#installed? ⇒ Boolean
35 36 37 |
# File 'lib/virtuoso/virtualbox/interface.rb', line 35 def installed? @virtualbox[:version].nil? ? false : true end |