18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/multidisk-boxgrinder-plugin.rb', line 18
def execute
@log.info "Converting RAW to multiple disk formats"
@log.info "Converting to VMDK Sparse using qemu-img..."
@exec_helper.execute "qemu-img convert -O vmdk '#{@previous_deliverables.disk}' '#{@deliverables.vmdk_sparse}'"
@log.info "Converting to QCow2 Sparse using qemu-img..."
@exec_helper.execute "qemu-img convert -O qcow2 '#{@previous_deliverables.disk}' '#{@deliverables.qcow_sparse}'"
@log.info "Converting to QCow2 Compressed Sparse using qemu-img..."
@exec_helper.execute "qemu-img convert -c -O qcow2 '#{@previous_deliverables.disk}' '#{@deliverables.qcow_compressed}'"
if `which VBoxManage`.empty?
@log.error "VBoxManage binary not found in your path, skipping VMDK Stream format."
else
@log.info "Using VBoxManage to convert the image..."
@log.info "Converting to VMDK..."
@exec_helper.execute "VBoxManage clonehd --format VMDK --variant Stream '#{@deliverables.vmdk_sparse}' '#{@deliverables.vmdk_stream}'"
@log.info "Converting to VHD..."
@exec_helper.execute "VBoxManage clonehd --format VHD '#{@deliverables.vmdk_sparse}' '#{@deliverables.vhd}'"
end
@log.info "Conversions done."
end
|