class QemuToolkit::Backend::Illumos

Attributes

verbose[RW]

Public Instance Methods

disks(path) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 24
def disks(path)
  output = zfs :list, '-H -o name -t volume', '-r', path
  output.split("\n")
end
dladm(*args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 20
def dladm *args
  run_cmd :dladm, *args
end
exec_with_arg0(command, name, *args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 38
def exec_with_arg0(command, name, *args)
  # exec in this form only wants to be given raw arguments that contain
  # no spaces. This is why we split and flatten args.
  exec [command, name], *args.map { |a| a.split }.flatten
  
  fail "exec failed."
end
iscsiadm(*args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 17
def iscsiadm *args
  run_cmd :iscsiadm, *args
end
itadm(*args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 8
def itadm(*args)
  run_cmd :itadm, *args
end
qemu(name, args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 14
def qemu name, args
  exec_with_arg0 '/usr/bin/qemu-system-x86_64', name, *args
end
run_cmd(*args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 29
def run_cmd(*args)
  cmd = args.join(' ')
  puts cmd if verbose
  ret = %x(#{cmd} 2>&1)

  raise "Execution error: #{cmd}." unless $?.success?

  ret
end
stmfadm(*args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 11
def stmfadm *args
  run_cmd :stmfadm, *args
end
zfs(*args) click to toggle source
# File lib/qemu-toolkit/backend/illumos.rb, line 5
def zfs *args
  run_cmd :zfs, *args
end