[Libguestfs] difficulty using virt-v2v with OVA

solarflow99
Fri, 07 Apr 2017 01:57:30 -0000

I have a Fedora 24 system I can already get this working for most OVA
files, just the BSD and atomic ones weren't recognized.  Assuming my
version of virt-v2v is just old, I installed rawhide on a different system
and tried with virt-v2v-1.37.8-1.fc27.x86_64 and now its having another
problem.  Is there a known version of virt-v2v I should be using?  Here is
the output from the rawhide attempt happens for any OVA file I try:



# virt-v2v -v -x -i ova graylog.ova -o qemu -of qcow2 -os /var/tmp
--qemu-boot
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1e984e0, program = virt-v2v
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1e988d0, program = virt-v2v
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1e993e0, program = virt-v2v
libguestfs: trace: set_trace true
libguestfs: trace: set_trace = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
virt-v2v: libguestfs 1.37.8fedora=27,release=1.fc27,libvirt (x86_64)
libvirt version: 3.2.0
[   0.0] Opening the source -i ova graylog.ova
qemu-img info json:'{ "file": { "driver":
"raw", "offset": 512, "size":
512, "file": { "filename":
"/tmp/v2vqemuimgtstee6f2b.img" } } }' >/dev/null
qemu-img supports "offset" and "size" in json URLs: true
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1e98ee0, program = virt-v2v
libguestfs: trace: set_trace true
libguestfs: trace: set_trace = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "libvirt"
libvirt supports  "raw" driver in json URL: true
tar -tf 'graylog.ova'
tar '-xf' 'graylog.ova' '-C'
'/var/tmp/ova.bRNpvE' 'graylog.ovf'
'graylog.mf'
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1ebe250, program = virt-v2v
libguestfs: trace: set_trace true
libguestfs: trace: set_trace = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "libvirt"
virt-v2v: warning: making OVA directory public readable to work around
libvirt bug https://bugzilla.redhat.com/1045069
chmod '-R' 'go=u,go-w' '/var/tmp/ova.bRNpvE'
'graylog.ova'
processing manifest /var/tmp/ova.bRNpvE/graylog.mf
tar xOf 'graylog.ova' 'graylog.ovf' | sha1sum
tar xOf 'graylog.ova' 'graylog-disk1.vmdk' | sha1sum
tar tRvf 'graylog.ova'
json: json:{ "file": { "driver": "raw",
"offset": 10240, "size":
1146813952, "file": { "driver": "file",
"filename": "/root/graylog.ova" } }
}
    source name: graylog
hypervisor type: vmware
         memory: 2147483648 (bytes)
       nr vCPUs: 1
     CPU vendor:
      CPU model:
   CPU topology: sockets: - cores/socket: - threads/core: -
   CPU features:
       firmware: bios
        display:
          video:
          sound:
disks:
    json:{ "file": { "driver": "raw",
"offset": 10240, "size": 1146813952,
"file": { "driver": "file", "filename":
"/root/graylog.ova" } } } (vmdk)
[scsi]
removable media:

NICs:
    Network "Ethernet 1"

check_host_free_space: overlay_dir=/var/tmp free_space=42292809728
[   3.1] Creating an overlay to protect the source from being modified
qemu-img 'create' '-q' '-f' 'qcow2' '-b'
'json:{ "file": { "driver": "raw",
"offset": 10240, "size": 1146813952, "file": {
"driver": "file",
"filename": "/root/graylog.ova" } } }' '-o'
'compat=1.1,backing_fmt=vmdk'
'/var/tmp/v2vovle91365.qcow2'
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1effb80, program = virt-v2v
libguestfs: trace: set_trace true
libguestfs: trace: set_trace = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: disk_has_backing_file "/var/tmp/v2vovle91365.qcow2"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ info
libguestfs: command: run: \ --output json
libguestfs: command: run: \ /dev/fd/3
libguestfs: parse_json: qemu-img info JSON output:\n{\n
"backing-filename-format": "vmdk",\n
"virtual-size": 21474836480,\n
"filename": "/dev/fd/3",\n    "cluster-size":
65536,\n    "format":
"qcow2",\n    "actual-size": 200704,\n
"format-specific": {\n
"type": "qcow2",\n        "data": {\n
"compat":
"1.1",\n            "lazy-refcounts": false,\n
"refcount-bits":
16,\n            "corrupt": false\n        }\n    },\n
"full-backing-filename": "json:{ \"file\": {
\"driver\": \"raw\",
\"offset\": 10240, \"size\": 1146813952, \"file\":
{ \"driver\": \"file\",
\"filename\": \"/root/graylog.ova\" } } }",\n
"backing-filename":
"json:{ \"file\": { \"driver\": \"raw\",
\"offset\": 10240, \"size\":
1146813952, \"file\": { \"driver\": \"file\",
\"filename\":
\"/root/graylog.ova\" } } }",\n    "dirty-flag":
false\n}\n\n
libguestfs: trace: disk_has_backing_file = 1
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1effed0, program = virt-v2v
libguestfs: trace: set_trace true
libguestfs: trace: set_trace = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: disk_virtual_size "/var/tmp/v2vovle91365.qcow2"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ info
libguestfs: command: run: \ --output json
libguestfs: command: run: \ /dev/fd/3
libguestfs: parse_json: qemu-img info JSON output:\n{\n
"backing-filename-format": "vmdk",\n
"virtual-size": 21474836480,\n
"filename": "/dev/fd/3",\n    "cluster-size":
65536,\n    "format":
"qcow2",\n    "actual-size": 200704,\n
"format-specific": {\n
"type": "qcow2",\n        "data": {\n
"compat":
"1.1",\n            "lazy-refcounts": false,\n
"refcount-bits":
16,\n            "corrupt": false\n        }\n    },\n
"full-backing-filename": "json:{ \"file\": {
\"driver\": \"raw\",
\"offset\": 10240, \"size\": 1146813952, \"file\":
{ \"driver\": \"file\",
\"filename\": \"/root/graylog.ova\" } } }",\n
"backing-filename":
"json:{ \"file\": { \"driver\": \"raw\",
\"offset\": 10240, \"size\":
1146813952, \"file\": { \"driver\": \"file\",
\"filename\":
\"/root/graylog.ova\" } } }",\n    "dirty-flag":
false\n}\n\n
libguestfs: trace: disk_virtual_size = 21474836480
[   3.2] Initializing the target -o qemu -os /var/tmp --qemu-boot
[   3.2] Opening the overlay
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x1f00280, program = virt-v2v
libguestfs: trace: set_trace true
libguestfs: trace: set_trace = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_identifier "v2v"
libguestfs: trace: v2v: set_identifier = 0
libguestfs: trace: v2v: get_memsize
libguestfs: trace: v2v: get_memsize = 500
libguestfs: trace: v2v: set_memsize 2000
libguestfs: trace: v2v: set_memsize = 0
libguestfs: trace: v2v: set_network true
libguestfs: trace: v2v: set_network = 0
libguestfs: trace: v2v: add_drive "/var/tmp/v2vovle91365.qcow2"
"format:qcow2" "cachemode:unsafe"
"discard:besteffort" "copyonread:true"
libguestfs: trace: v2v: add_drive = 0
libguestfs: trace: v2v: launch
libguestfs: trace: v2v: get_tmpdir
libguestfs: trace: v2v: get_tmpdir = "/tmp"
libguestfs: trace: v2v: version
libguestfs: trace: v2v: version = <struct guestfs_version = major: 1,
minor: 37, release: 8, extra: fedora=27,release=1.fc27,libvirt, >
libguestfs: trace: v2v: get_backend
libguestfs: trace: v2v: get_backend = "libvirt"
libguestfs: launch: program=virt-v2v
libguestfs: launch: identifier=v2v
libguestfs: launch: version=1.37.8fedora=27,release=1.fc27,libvirt
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=libvirt
libguestfs: launch: tmpdir=/tmp/libguestfsu6lY8x
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: libvirt version = 3002000 (3.2.0)
libguestfs: guest random name = guestfs-jf27nn19mslze1id
libguestfs: connect to libvirt
libguestfs: opening libvirt handle: URI = qemu:///system, auth default+wrapper,
flags = 0
libguestfs: successfully opened libvirt handle: conn = 0x1f00900
libguestfs: qemu version (reported by libvirt) = 2008093 (2.8.93)
libguestfs: get libvirt capabilities
libguestfs: parsing capabilities XML
libguestfs: trace: v2v: get_backend_setting "force_tcg"
libguestfs: trace: v2v: get_backend_setting = NULL (error)
libguestfs: trace: v2v: get_backend_setting "internal_libvirt_label"
libguestfs: trace: v2v: get_backend_setting = NULL (error)
libguestfs: trace: v2v: get_backend_setting
"internal_libvirt_imagelabel"
libguestfs: trace: v2v: get_backend_setting = NULL (error)
libguestfs: trace: v2v: get_backend_setting
"internal_libvirt_norelabel_disks"
libguestfs: trace: v2v: get_backend_setting = NULL (error)
libguestfs: trace: v2v: get_backend_setting "network_bridge"
libguestfs: trace: v2v: get_backend_setting = NULL (error)
libguestfs: build appliance
libguestfs: trace: v2v: get_cachedir
libguestfs: trace: v2v: get_cachedir = "/var/tmp"
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-0/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-0/appliance.d
supermin: version: 5.1.17
supermin: rpm: detected RPM version 4.13
supermin: package handler: fedora/rpm
supermin: acquiring lock on /var/tmp/.guestfs-0/lock
supermin: if-newer: output does not need rebuilding
libguestfs: finished building supermin appliance
libguestfs: trace: v2v: disk_create "/tmp/libguestfsu6lY8x/overlay1"
"qcow2" -1
"backingfile:/var/tmp/.guestfs-0/appliance.d/root"
"backingformat:raw"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -o
backing_file=/var/tmp/.guestfs-0/appliance.d/root,backing_fmt=raw
libguestfs: command: run: \ /tmp/libguestfsu6lY8x/overlay1
Formatting '/tmp/libguestfsu6lY8x/overlay1', fmt=qcow2 size=4294967296
backing_file=/var/tmp/.guestfs-0/appliance.d/root backing_fmt=raw
encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
libguestfs: trace: v2v: disk_create = 0
libguestfs: trace: v2v: get_sockdir
libguestfs: trace: v2v: get_sockdir = "/tmp"
libguestfs: set_socket_create_context: getcon failed: (none): Invalid
argument [you can ignore this message if you are not using SELinux + sVirt]
libguestfs: clear_socket_create_context: setsockcreatecon failed: NULL:
Invalid argument [you can ignore this message if you are not using SELinux
+ sVirt]
libguestfs: create libvirt XML
libguestfs: trace: v2v: get_cachedir
libguestfs: trace: v2v: get_cachedir = "/var/tmp"
libguestfs: libvirt XML:\n<?xml version="1.0"?>\n<domain
type="kvm"
xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">\n
<name>guestfs-jf27nn19mslze1id</name>\n  <memory
unit="MiB">2000</memory>\n  <currentMemory
unit="MiB">2000</currentMemory>\n  <cpu
mode="host-passthrough">\n
<model fallback="allow"/>\n  </cpu>\n
<vcpu>1</vcpu>\n  <clock
offset="utc">\n    <timer name="rtc"
tickpolicy="catchup"/>\n    <timer
name="pit" tickpolicy="delay"/>\n    <timer
name="hpet" present="no"/>\n
</clock>\n  <os>\n    <type>hvm</type>\n
<kernel>/var/tmp/.guestfs-0/appliance.d/kernel</kernel>\n
<initrd>/var/tmp/.guestfs-0/appliance.d/initrd</initrd>\n
<cmdline>panic=1 console=ttyS0 edd=off udevtimeout=6000
udev.event-timeout=6000 no_timer_check printk.time=1 cgroup_disable=memory
usbcore.nousb cryptomgr.notests tsc=reliable 8250.nr_uarts=1 root=/dev/sdb
selinux=0 guestfs_verbose=1 guestfs_network=1 TERM=xterm
guestfs_identifier=v2v</cmdline>\n    <bios
useserial="yes"/>\n  </os>\n
<on_reboot>destroy</on_reboot>\n  <devices>\n    <rng
model="virtio">\n      <backend
model="random">/dev/urandom</backend>\n
</rng>\n    <controller type="scsi" index="0"
model="virtio-scsi"/>\n
<disk device="disk" type="file">\n      <source
file="/var/tmp/v2vovle91365.qcow2"/>\n      <target
dev="sda"
bus="scsi"/>\n      <driver name="qemu"
type="qcow2" cache="unsafe"
discard="unmap"/>\n      <address type="drive"
controller="0" bus="0"
target="0" unit="0"/>\n    </disk>\n    <disk
type="file"
device="disk">\n      <source
file="/tmp/libguestfsu6lY8x/overlay1"/>\n      <target
dev="sdb"
bus="scsi"/>\n      <driver name="qemu"
type="qcow2"
cache="unsafe"/>\n      <address type="drive"
controller="0" bus="0"
target="1" unit="0"/>\n      <shareable/>\n
</disk>\n    <serial
type="unix">\n      <source mode="connect"
path="/tmp/libguestfs7bRh8r/console.sock"/>\n      <target
port="0"/>\n
</serial>\n    <channel type="unix">\n      <source
mode="connect"
path="/tmp/libguestfs7bRh8r/guestfsd.sock"/>\n      <target
type="virtio"
name="org.libguestfs.channel.0"/>\n    </channel>\n
<interface
type="bridge">\n \n
<model
type="virtio"/>\n    </interface>\n    <controller
type="usb"
model="none"/>\n    <memballoon model="none"/>\n
</devices>\n
<qemu:commandline>\n    <qemu:env name="TMPDIR"
value="/var/tmp"/>\n
</qemu:commandline>\n</domain>\n
libguestfs: trace: v2v: get_cachedir
libguestfs: trace: v2v: get_cachedir = "/var/tmp"
libguestfs: command: run: ls
libguestfs: command: run: \ -a
libguestfs: command: run: \ -l
libguestfs: command: run: \ -R
libguestfs: command: run: \ -Z /var/tmp/.guestfs-0
libguestfs: /var/tmp/.guestfs-0:
libguestfs: total 52
libguestfs: drwxr-xr-x  3 root root ?                           4096 Apr  6
21:50 .
libguestfs: drwxrwxrwt. 8 root root system_u:object_r:tmp_t:s0  4096 Apr  6
21:50 ..
libguestfs: drwxr-xr-x  2 root root ?                           4096 Apr  6
21:47 appliance.d
libguestfs: -rw-r--r--  1 root root ?                              0 Apr  6
21:32 lock
libguestfs: -rw-r--r--  1 root root ?                          10116 Apr  6
21:33 qemu.devices
libguestfs: -rw-r--r--  1 root root ?                          24500 Apr  6
21:33 qemu.help
libguestfs: -rw-r--r--  1 root root ?                             35 Apr  6
21:33 qemu.stat
libguestfs:
libguestfs: /var/tmp/.guestfs-0/appliance.d:
libguestfs: total 263516
libguestfs: drwxr-xr-x 2 root root ?       4096 Apr  6 21:47 .
libguestfs: drwxr-xr-x 3 root root ?       4096 Apr  6 21:50 ..
libguestfs: -rw-r--r-- 1 root root ?     567296 Apr  6 21:50 initrd
libguestfs: -rwxr-xr-x 1 root root ?    8024664 Apr  6 21:50 kernel
libguestfs: -rw-r--r-- 1 root root ? 4294967296 Apr  6 21:50 root
libguestfs: command: run: ls
libguestfs: command: run: \ -a
libguestfs: command: run: \ -l
libguestfs: command: run: \ -Z /tmp/libguestfs7bRh8r
libguestfs: total 0
libguestfs: drwxr-xr-x  2 root root ?  80 Apr  6 21:50 .
libguestfs: drwxrwxrwt 11 root root ? 260 Apr  6 21:50 ..
libguestfs: srw-rw----  1 root qemu ?   0 Apr  6 21:50 console.sock
libguestfs: srw-rw----  1 root qemu ?   0 Apr  6 21:50 guestfsd.sock
libguestfs: launch libvirt guest
libguestfs: clear_socket_create_context: setsockcreatecon failed: NULL:
Invalid argument [you can ignore this message if you are not using SELinux
+ sVirt]
libguestfs: trace: v2v: launch = -1 (error)
virt-v2v: error: libguestfs error: could not create appliance through
libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: Cannot access backing file
'/root/graylog.ova'
of storage file '/var/tmp/v2vovle91365.qcow2' (as uid:107, gid:107):
Permission denied [code=38 int1=13]
rm -rf '/var/tmp/ova.bRNpvE'
rm -rf '/var/tmp/null.ESbL2T'
libguestfs: trace: v2v: close
libguestfs: closing guestfs handle 0x1f00280 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsu6lY8x
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfs7bRh8r
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1effed0 (state 0)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1effb80 (state 0)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1ebe250 (state 0)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1e98ee0 (state 0)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1e993e0 (state 0)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1e988d0 (state 0)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1e984e0 (state 0)