Class: QEMU::Command::Disk

Inherits:
Object
  • Object
show all
Defined in:
lib/qemu/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, options = {}) ⇒ Disk

Returns a new instance of Disk.



31
32
33
34
# File 'lib/qemu/command.rb', line 31

def initialize(file, options = {})
  self.file = file
  self.options = { :media => "disk" }.merge options
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



29
30
31
# File 'lib/qemu/command.rb', line 29

def file
  @file
end

#optionsObject

Returns the value of attribute options.



29
30
31
# File 'lib/qemu/command.rb', line 29

def options
  @options
end

Instance Method Details

#qemu_drive(index) ⇒ Object



36
37
38
39
40
41
# File 'lib/qemu/command.rb', line 36

def qemu_drive(index)
  { 
    :file => File.expand_path(file),
    :index => index,
  }.merge(options).map { |k,v| "#{k}=#{v}" }.join(',')
end