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.



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

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

Instance Attribute Details

#fileObject

Returns the value of attribute file.



35
36
37
# File 'lib/qemu/command.rb', line 35

def file
  @file
end

#optionsObject

Returns the value of attribute options.



35
36
37
# File 'lib/qemu/command.rb', line 35

def options
  @options
end

Instance Method Details

#qemu_drive(index) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/qemu/command.rb', line 42

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