Module: Hypercube::Backend::VirtualBox::Commands

Defined in:
lib/hypercube/backends/virtual_box.rb

Class Method Summary collapse

Class Method Details

.add_drive(vm) ⇒ Object



68
69
70
# File 'lib/hypercube/backends/virtual_box.rb', line 68

def add_drive vm
  "storagectl #{vm} --name SATA --add SATA --controller IntelAhci"
end

.attribute_mapObject



62
63
64
65
66
# File 'lib/hypercube/backends/virtual_box.rb', line 62

def attribute_map
  {
    'hd' => 'SATA-0-0'
  }
end

.create(vm) ⇒ Object



39
40
41
# File 'lib/hypercube/backends/virtual_box.rb', line 39

def create vm
  "createvm --name #{vm} --register"
end

.destroy(vm) ⇒ Object



43
44
45
# File 'lib/hypercube/backends/virtual_box.rb', line 43

def destroy vm
  "unregistervm #{vm} --delete"
end

.hd=(vm, path) ⇒ Object



47
48
49
# File 'lib/hypercube/backends/virtual_box.rb', line 47

def hd= vm, path
  "modifyvm #{vm} --sataport1 \"#{path}\""
end

.info(vm, attribute = nil) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/hypercube/backends/virtual_box.rb', line 51

def info vm, attribute = nil
  output = "showvminfo #{vm} #{ attribute && '-machinereadable' }"

  if attribute then
    local_name = attribute_map[attribute]
    output.split("\n").detect{|line| line =~ /#{local_name}/}
  else
    output
  end
end

.listObject



35
36
37
# File 'lib/hypercube/backends/virtual_box.rb', line 35

def list
  "list vms"
end