Class: Lab::Drivers::VmDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/lab/driver/vm_driver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ VmDriver

Returns a new instance of VmDriver.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/lab/driver/vm_driver.rb', line 21

def initialize(config)

  @vmid = filter_command(config["vmid"].to_s)
  @location = filter_command(config["location"])
  @credentials = config["credentials"] || []
  @tools = filter_input(config["tools"])
  @arch = filter_input(config["arch"])
  @os = filter_input(config["os"])
  @hostname = filter_input(config["hostname"]) || filter_input(config["vmid"].to_s)

  # Currently only implemented for the first set
  if @credentials.count > 0
    @vm_user = filter_input(@credentials[0]['user'])
    @vm_pass = filter_input(@credentials[0]['pass'])
    @vm_keyfile = filter_input(@credentials[0]['keyfile'])
  end
end

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



19
20
21
# File 'lib/lab/driver/vm_driver.rb', line 19

def credentials
  @credentials
end

#locationObject

Returns the value of attribute location.



16
17
18
# File 'lib/lab/driver/vm_driver.rb', line 16

def location
  @location
end

#osObject

Returns the value of attribute os.



17
18
19
# File 'lib/lab/driver/vm_driver.rb', line 17

def os
  @os
end

#toolsObject

Returns the value of attribute tools.



18
19
20
# File 'lib/lab/driver/vm_driver.rb', line 18

def tools
  @tools
end

#vmidObject

Returns the value of attribute vmid.



15
16
17
# File 'lib/lab/driver/vm_driver.rb', line 15

def vmid
  @vmid
end

Instance Method Details

#check_file_exists(file) ⇒ Object



98
99
100
# File 'lib/lab/driver/vm_driver.rb', line 98

def check_file_exists(file)
  raise "Command not Implemented"
end

#cleanupObject



106
107
108
# File 'lib/lab/driver/vm_driver.rb', line 106

def cleanup
  raise "Command not Implemented"
end

#copy_from(from, to) ⇒ Object



90
91
92
# File 'lib/lab/driver/vm_driver.rb', line 90

def copy_from(from, to)
  raise "Command not Implemented"
end

#copy_to(from, to) ⇒ Object



94
95
96
# File 'lib/lab/driver/vm_driver.rb', line 94

def copy_to(from, to)
  raise "Command not Implemented"
end

#create_directory(directory) ⇒ Object



102
103
104
# File 'lib/lab/driver/vm_driver.rb', line 102

def create_directory(directory)
  raise "Command not Implemented"
end

#create_snapshot(snapshot) ⇒ Object



74
75
76
# File 'lib/lab/driver/vm_driver.rb', line 74

def create_snapshot(snapshot)
  raise "Command not Implemented"
end

#delete_snapshot(snapshot) ⇒ Object



82
83
84
# File 'lib/lab/driver/vm_driver.rb', line 82

def delete_snapshot(snapshot)
  raise "Command not Implemented"
end

#pauseObject



62
63
64
# File 'lib/lab/driver/vm_driver.rb', line 62

def pause
  raise "Command not Implemented"
end

#registerObject

This interface must be implemented in a child driver class #########################################################



42
43
44
# File 'lib/lab/driver/vm_driver.rb', line 42

def register
  raise "Command not Implemented"
end

#resetObject



70
71
72
# File 'lib/lab/driver/vm_driver.rb', line 70

def reset
  raise "Command not Implemented"
end

#resumeObject



66
67
68
# File 'lib/lab/driver/vm_driver.rb', line 66

def resume
  raise "Command not Implemented"
end

#revert_snapshot(snapshot) ⇒ Object



78
79
80
# File 'lib/lab/driver/vm_driver.rb', line 78

def revert_snapshot(snapshot)
  raise "Command not Implemented"
end

#run_command(command) ⇒ Object



86
87
88
# File 'lib/lab/driver/vm_driver.rb', line 86

def run_command(command)  
  raise "Command not Implemented"
end

#startObject



50
51
52
# File 'lib/lab/driver/vm_driver.rb', line 50

def start
  raise "Command not Implemented"
end

#stopObject



54
55
56
# File 'lib/lab/driver/vm_driver.rb', line 54

def stop
  raise "Command not Implemented"
end

#suspendObject



58
59
60
# File 'lib/lab/driver/vm_driver.rb', line 58

def suspend
  raise "Command not Implemented"
end

#unregisterObject



46
47
48
# File 'lib/lab/driver/vm_driver.rb', line 46

def unregister
  raise "Command not Implemented"
end