mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
v2v: ova: Further fix test cases.
Updates commit7461a8fab1. Fixes and partly reverts commit8f91d3a9b0.
This commit is contained in:
@@ -54,22 +54,3 @@ do_sha256 ()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Returns 0 if QEMU version is greater or equal to the arguments
|
||||
qemu_is_version() {
|
||||
if [ $# -ne 2 ] ; then
|
||||
echo "Usage: $0 <major_version> <minor_version>" >&2
|
||||
return 3
|
||||
fi
|
||||
|
||||
|
||||
[[ "$(qemu-img --version)" =~ 'qemu-img version '([0-9]+)\.([0-9]+) ]] || return 2
|
||||
QMAJ=${BASH_REMATCH[1]}
|
||||
QMIN=${BASH_REMATCH[2]}
|
||||
|
||||
if [ \( $QMAJ -gt $1 \) -o \( $QMAJ -eq $1 -a $QMIN -ge $2 \) ] ; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ $VG virt-v2v --debug-gc --quiet \
|
||||
--print-source > $d/source
|
||||
|
||||
# Check the parsed source is what we expect.
|
||||
if qemu_is_version 2 8 ; then
|
||||
if grep -sq json: $d/source ; then
|
||||
# Normalize the output.
|
||||
# Remove directory prefix.
|
||||
# Exact offset will vary because of tar.
|
||||
|
||||
@@ -10,7 +10,7 @@ hypervisor type: vmware
|
||||
video:
|
||||
sound:
|
||||
disks:
|
||||
json:{ "file": { "driver": "raw", "offset": 9216, "size": 10240, "file": { "filename": "test-tar.ova" } } } (vmdk) [scsi]
|
||||
json:{ "file": { "driver": "raw", "offset": x, "size": 10240, "file": { "filename": "test-tar.ova" } } } (vmdk) [scsi]
|
||||
removable media:
|
||||
CD-ROM [ide] in slot 0
|
||||
NICs:
|
||||
|
||||
@@ -58,9 +58,12 @@ $VG virt-v2v --debug-gc --quiet \
|
||||
--print-source > $d/source
|
||||
|
||||
# Check the parsed source is what we expect.
|
||||
if qemu_is_version 2 8 ; then
|
||||
# normalize the output
|
||||
sed -i -e "s,\"$d/,\"," $d/source
|
||||
if grep -sq json: $d/source ; then
|
||||
# Normalize the output.
|
||||
# Remove directory prefix.
|
||||
# Exact offset will vary because of tar.
|
||||
sed -i -e "s,\"$d/,\"," \
|
||||
-e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
|
||||
diff -u test-v2v-i-ova-tar.expected2 $d/source
|
||||
else
|
||||
# normalize the output
|
||||
|
||||
@@ -10,8 +10,8 @@ hypervisor type: vmware
|
||||
video:
|
||||
sound:
|
||||
disks:
|
||||
json:{ "file": { "driver": "raw", "offset": 9728, "size": 10240, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
|
||||
json:{ "file": { "driver": "raw", "offset": 21504, "size": 102400, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
|
||||
json:{ "file": { "driver": "raw", "offset": x, "size": 10240, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
|
||||
json:{ "file": { "driver": "raw", "offset": x, "size": 102400, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
|
||||
removable media:
|
||||
CD-ROM [ide] in slot 0
|
||||
NICs:
|
||||
|
||||
@@ -63,9 +63,12 @@ $VG virt-v2v --debug-gc --quiet \
|
||||
--print-source > $d/source
|
||||
|
||||
# Check the parsed source is what we expect.
|
||||
if qemu_is_version 2 8 ; then
|
||||
# normalize the output
|
||||
sed -i -e "s,\"$d/,\"," $d/source
|
||||
if grep -sq json: $d/source ; then
|
||||
# Normalize the output.
|
||||
# Remove directory prefix.
|
||||
# Exact offset will vary because of tar.
|
||||
sed -i -e "s,\"$d/,\"," \
|
||||
-e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
|
||||
diff -u test-v2v-i-ova-two-disks.expected2 $d/source
|
||||
else
|
||||
# normalize the output
|
||||
|
||||
Reference in New Issue
Block a user