Sha256: 05b4e50474e970895b24fa46e2c7efb2547139b17cdd4cae2094af527b5f736c

Contents?: true

Size: 1.21 KB

Versions: 27

Compression:

Stored size: 1.21 KB

Contents

require 'manageiq-gems-pending'
require 'openssl' # Required for 'Digest' in camcorder (< Ruby 2.1)
require 'camcorder'
require 'MiqVm/MiqVm'

require 'logger'
$log = Logger.new(STDERR)
$log.level = Logger::DEBUG

#
# Path to RAW disk image.
#
VIRTUAL_DISK_FILE = "path to raw disk image file"

commit = true

begin
  recorder = Camcorder::Recorder.new("#{File.dirname(__FILE__)}/foo.yml")
  Camcorder.default_recorder = recorder
  Camcorder.intercept_constructor(MiqLargeFile::MiqLargeFileOther) do
    methods_with_side_effects :seek, :read, :write
  end
  Camcorder.intercept_constructor(MiqLargeFile::MiqLargeFileStat)

  recorder.start

  hardware  = "scsi0:0.present = \"TRUE\"\n"
  hardware += "scsi0:0.filename = \"#{VIRTUAL_DISK_FILE}\"\n"

  ost = OpenStruct.new
  ost.rawDisk = true

  miqVm = MiqVm.new(hardware, ost)

  %w(accounts services software system).each do |cat|
    xml = miqVm.extract(cat)
    xml.write($stdout, 4)
  end
rescue => err
  puts err.to_s
  puts err.backtrace.join("\n")
  commit = false # don't commit recording on error
ensure
  miqVm.unmount if miqVm
  puts "...done"
  if recorder && commit
    puts
    puts "camcorder: committing recording..."
    recorder.commit
    puts "done."
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
manageiq-smartstate-0.2.18.2 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.3.1 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.3.0 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.24 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.18.1 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.23 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.22 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.21 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.20 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.19 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.18 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.17 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.16 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.15 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.14 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.13 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.12 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.11 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.10 lib/MiqVm/test/camcorder_fleece_test.rb
manageiq-smartstate-0.2.9 lib/MiqVm/test/camcorder_fleece_test.rb