Class: Lab::Drivers::DynagenDriver

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

Instance Attribute Summary

Attributes inherited from VmDriver

#credentials, #location, #os, #tools, #vmid

Instance Method Summary collapse

Methods inherited from VmDriver

#check_file_exists, #copy_from, #copy_to, #create_directory, #create_snapshot, #delete_snapshot, #pause, #register, #reset, #resume, #revert_snapshot, #run_command, #suspend, #unregister

Constructor Details

#initialize(config, dynagen_config) ⇒ DynagenDriver

Returns a new instance of DynagenDriver.



15
16
17
18
19
# File 'lib/lab/driver/dynagen_driver.rb', line 15

def initialize(config,dynagen_config)
  super(config)
  @running = false
  @dynagen_platform = filter_command(dynagen_config['dynagen_platform'])
end

Instance Method Details

#cleanupObject



36
37
38
39
40
# File 'lib/lab/driver/dynagen_driver.rb', line 36

def cleanup
  `killall dynagen`
  `killall dynamips`
  @running = false
end

#running?Boolean

Returns:

  • (Boolean)


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

def running?
  return @running
end

#startObject



21
22
23
24
25
26
27
28
29
# File 'lib/lab/driver/dynagen_driver.rb', line 21

def start
  # TODO - write the location-file to a temp-file 
  #        and set the autostart property 

  ## start background dynamips process
  system_command("dynamips -H #{@dynagen_platform} &")
  system_command("dynagen  #{@location}")
  @running = true
end

#stopObject



31
32
33
34
# File 'lib/lab/driver/dynagen_driver.rb', line 31

def stop
  system_command("killall dynagen")
  @running = false
end