import virt-v2v-1.42.0-21.module+el8.7.0+16689+53d59bc2

This commit is contained in:
CentOS Sources 2022-11-08 01:39:02 -05:00 committed by Stepan Oksanichenko
parent f70f19359e
commit 4309fddf67
53 changed files with 459 additions and 54 deletions

View File

@ -37,5 +37,5 @@ index 7df17b29..4d0b8639 100644
let get_domain conn name = let get_domain conn name =
let dom = let dom =
-- --
2.27.0 2.31.1

View File

@ -210,5 +210,5 @@ index 120a52f7..3cbca9d7 100644
-val input_libvirt_xen_ssh : Libvirt.rw Libvirt.Connect.t Lazy.t -> string option -> Xml.uri -> string -> string -> Types.input -val input_libvirt_xen_ssh : Libvirt.rw Libvirt.Connect.t Lazy.t -> string option -> Xml.uri -> string -> string -> Types.input
+val input_libvirt_xen_ssh : Libvirt.rw Libvirt.Connect.t Lazy.t -> string -> string option -> Xml.uri -> string -> string -> Types.input +val input_libvirt_xen_ssh : Libvirt.rw Libvirt.Connect.t Lazy.t -> string -> string option -> Xml.uri -> string -> string -> Types.input
-- --
2.27.0 2.31.1

View File

@ -30,5 +30,5 @@ index c28a4ced..4c128b0c 100644
let headers = let headers =
List.map ( List.map (
-- --
2.27.0 2.31.1

View File

@ -93,5 +93,5 @@ index 05553c4f..5a1fba0f 100644
(match pool with (match pool with
| None -> | None ->
-- --
2.27.0 2.31.1

View File

@ -47,5 +47,5 @@ index 979c3773..402dfd0e 100644
) )
else cmd, [] in else cmd, [] in
-- --
2.27.0 2.31.1

View File

@ -45,5 +45,5 @@ index 402dfd0e..bfda91a7 100644
(* Caching extents speeds up qemu-img, especially its consecutive (* Caching extents speeds up qemu-img, especially its consecutive
* block_status requests with req_one=1. * block_status requests with req_one=1.
-- --
2.27.0 2.31.1

View File

@ -112,5 +112,5 @@ index bfda91a7..47832011 100644
let run cmd = let run cmd =
let sock, _ = Nbdkit.run_unix cmd in let sock, _ = Nbdkit.run_unix cmd in
-- --
2.27.0 2.31.1

View File

@ -53,5 +53,5 @@ index 47832011..f5e91911 100644
Nbdkit.add_arg cmd "password" ("+" ^ password_file) in Nbdkit.add_arg cmd "password" ("+" ^ password_file) in
-- --
2.27.0 2.31.1

View File

@ -40,5 +40,5 @@ index 1ab6bb4d..497840c2 100644
typedef OsinfoDb *OsinfoDb_t; typedef OsinfoDb *OsinfoDb_t;
typedef OsinfoOs *OsinfoOs_t; typedef OsinfoOs *OsinfoOs_t;
-- --
2.27.0 2.31.1

View File

@ -56,5 +56,5 @@ index a00fa8af..74934eb4 100644
=item B<--mac> aa:bb:cc:dd:ee:ffB<:network:>out =item B<--mac> aa:bb:cc:dd:ee:ffB<:network:>out
-- --
2.27.0 2.31.1

View File

@ -22,5 +22,5 @@ index 03c5339..8379039 100644
+If there are multiple encrypted devices then you may need to supply +If there are multiple encrypted devices then you may need to supply
+multiple keys on stdin, one per line. +multiple keys on stdin, one per line.
-- --
2.27.0 2.31.1

View File

@ -122,5 +122,5 @@ index 249137ab..3b74f307 100644
let no_trim_warning _ = let no_trim_warning _ =
-- --
2.27.0 2.31.1

View File

@ -29,5 +29,5 @@ index 4d0b8639..1a24b049 100644
function function
| { Libvirt.Connect.typ = Libvirt.Connect.CredentialPassphrase } -> password | { Libvirt.Connect.typ = Libvirt.Connect.CredentialPassphrase } -> password
-- --
2.27.0 2.31.1

View File

@ -29,5 +29,5 @@ index be3a3c5e..85d08265 100644
let flag = Qemuopts.flag cmd let flag = Qemuopts.flag cmd
and arg = Qemuopts.arg cmd and arg = Qemuopts.arg cmd
-- --
2.27.0 2.31.1

View File

@ -101,5 +101,5 @@ index 3b74f307..df69e2e0 100644
output_format, output_alloc output_format, output_alloc
-- --
2.27.0 2.31.1

View File

@ -30,5 +30,5 @@ index ccbb9d68..c2940582 100644
(* Find the UEFI firmware. *) (* Find the UEFI firmware. *)
let find_uefi_firmware guest_arch = let find_uefi_firmware guest_arch =
-- --
2.27.0 2.31.1

View File

@ -75,5 +75,5 @@ index f1da222a..ff94fe39 100755
# We also update the Registry several times, for firstboot, and (ONLY # We also update the Registry several times, for firstboot, and (ONLY
-- --
2.27.0 2.31.1

View File

@ -282,5 +282,5 @@ index df69e2e0..7b79d462 100644
let error_option_cannot_be_used_in_output_mode mode opt = let error_option_cannot_be_used_in_output_mode mode opt =
error (f_"-o %s: %s option cannot be used in this output mode") mode opt error (f_"-o %s: %s option cannot be used in this output mode") mode opt
-- --
2.27.0 2.31.1

View File

@ -22,5 +22,5 @@ index d146e84c..4e403003 100644
s_video = None; s_video = None;
s_sound = None; s_sound = None;
-- --
2.27.0 2.31.1

View File

@ -22,5 +22,5 @@ index 3b3cf0f0..32da2848 100644
=head1 INPUT FROM XEN =head1 INPUT FROM XEN
-- --
2.27.0 2.31.1

View File

@ -85,5 +85,5 @@ index d3e6260e..471102da 100644
types.StorageDomain( types.StorageDomain(
name=params['output_storage'], name=params['output_storage'],
-- --
2.27.0 2.31.1

View File

@ -23,5 +23,5 @@ index 33c5e9a2..b1ea8f9d 100644
type script = { type script = {
tmpdir : string; (* Temporary directory. *) tmpdir : string; (* Temporary directory. *)
-- --
2.27.0 2.31.1

View File

@ -121,5 +121,5 @@ index 8333366b..a5150907 100644
=head2 Guest firmware =head2 Guest firmware
-- --
2.27.0 2.31.1

View File

@ -384,5 +384,5 @@ index 73edff2c..a58ff433 100644
info (f_"Overlay saved as %s [--debug-overlays]") saved_filename info (f_"Overlay saved as %s [--debug-overlays]") saved_filename
) overlays ) overlays
-- --
2.27.0 2.31.1

View File

@ -30,5 +30,5 @@ index 179b0edf..fdc04b02 100644
(* List of Cinder volume IDs. *) (* List of Cinder volume IDs. *)
val mutable volume_ids = [] val mutable volume_ids = []
-- --
2.27.0 2.31.1

View File

@ -40,5 +40,5 @@ index ba26949f..f2f7b95c 100644
(*----------------------------------------------------------------------*) (*----------------------------------------------------------------------*)
(* Perform the conversion of the Windows guest. *) (* Perform the conversion of the Windows guest. *)
-- --
2.27.0 2.31.1

View File

@ -133,5 +133,5 @@ index f2f7b95c..84db742f 100644
(*----------------------------------------------------------------------*) (*----------------------------------------------------------------------*)
(* Perform the conversion of the Windows guest. *) (* Perform the conversion of the Windows guest. *)
-- --
2.27.0 2.31.1

View File

@ -58,5 +58,5 @@ index 84db742f..44cef5ed 100644
(*----------------------------------------------------------------------*) (*----------------------------------------------------------------------*)
(* Perform the conversion of the Windows guest. *) (* Perform the conversion of the Windows guest. *)
-- --
2.27.0 2.31.1

View File

@ -79,5 +79,5 @@ index 471102da..7cd6dea6 100644
except: except:
cancel_transfer(connection, transfer) cancel_transfer(connection, transfer)
-- --
2.27.0 2.31.1

View File

@ -33,5 +33,5 @@ index 44cef5ed..4d844e2d 100644
msi_path msi_path msi_path in msi_path msi_path msi_path in
Firstboot.add_firstboot_script g inspect.i_root Firstboot.add_firstboot_script g inspect.i_root
-- --
2.27.0 2.31.1

View File

@ -28,5 +28,5 @@ index 4d844e2d..33fbd410 100644
(* Install RHEV-APT only if appropriate for the output hypervisor. *) (* Install RHEV-APT only if appropriate for the output hypervisor. *)
if output#install_rhev_apt then ( if output#install_rhev_apt then (
-- --
2.27.0 2.31.1

View File

@ -23,5 +23,5 @@ index a5150907..1ffc0f9d 100644
=item UEFI on oVirt or RHV =item UEFI on oVirt or RHV
-- --
2.27.0 2.31.1

View File

@ -43,5 +43,5 @@ index 78623d97..f5a3abad 100644
Virt-v2v adds metadata for the guest to Glance, describing such things Virt-v2v adds metadata for the guest to Glance, describing such things
as the guest operating system and what drivers it requires. The as the guest operating system and what drivers it requires. The
-- --
2.27.0 2.31.1

View File

@ -148,5 +148,5 @@ index a58ff433..1f8d0138 100644
| TargetURI _ -> | TargetURI _ ->
(* XXX For the moment we assume that qemu URI outputs (* XXX For the moment we assume that qemu URI outputs
-- --
2.27.0 2.31.1

View File

@ -38,5 +38,5 @@ index f5e91911..7c177e35 100644
(* Caching extents speeds up qemu-img, especially its consecutive (* Caching extents speeds up qemu-img, especially its consecutive
* block_status requests with req_one=1. * block_status requests with req_one=1.
-- --
2.27.0 2.31.1

View File

@ -33,5 +33,5 @@ index e4df920e..ae8964dd 100644
L<virt-v2v(1)>. L<virt-v2v(1)>.
-- --
2.27.0 2.31.1

View File

@ -127,5 +127,5 @@ index 1f8d0138..bde51885 100644
if files > 0L && ffree < needed_inodes then if files > 0L && ffree < needed_inodes then
error (f_"not enough available inodes for conversion on filesystem %s. %Ld inodes available < %Ld inodes needed") error (f_"not enough available inodes for conversion on filesystem %s. %Ld inodes available < %Ld inodes needed")
-- --
2.27.0 2.31.1

View File

@ -26,5 +26,5 @@ index 4e00cd61..b8256bad 100644
| Some QXL, false -> | Some QXL, false ->
error (f_"there is no QXL driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver in %s") error (f_"there is no QXL driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver in %s")
-- --
2.27.0 2.31.1

View File

@ -24,5 +24,5 @@ index 1ffc0f9d..a9bfffab 100644
=item UEFI on oVirt or RHV =item UEFI on oVirt or RHV
-- --
2.27.0 2.31.1

View File

@ -56,5 +56,5 @@ index bde51885..8af86687 100644
| _ -> 10 | _ -> 10
in in
-- --
2.27.0 2.31.1

View File

@ -175,5 +175,5 @@ index 7cd6dea6..61ade1a8 100644
def transfer_supports_format(): def transfer_supports_format():
-- --
2.27.0 2.31.1

View File

@ -76,5 +76,5 @@ index 33fbd410..13de10cb 100644
) )
-- --
2.27.0 2.31.1

View File

@ -271,5 +271,5 @@ index 4c128b0c..ead03364 100644
(* Return the struct. *) (* Return the struct. *)
-- --
2.27.0 2.31.1

View File

@ -40,5 +40,5 @@ index 13de10cb..6c7440aa 100644
msi_path msi_path msi_path in msi_path msi_path msi_path in
Firstboot.add_firstboot_script g inspect.i_root Firstboot.add_firstboot_script g inspect.i_root
-- --
2.27.0 2.31.1

View File

@ -207,5 +207,5 @@ index 8af86687..203b93f1 100644
(* What really happens here is that the call to #disk_create (* What really happens here is that the call to #disk_create
* below fails if the format is not raw or qcow2. We would * below fails if the format is not raw or qcow2. We would
-- --
2.27.0 2.31.1

View File

@ -40,5 +40,5 @@ index 27e08135..e65fbf4a 100644
(match xpath_string "/volume/@type" with (match xpath_string "/volume/@type" with
| None | Some "file" -> | None | Some "file" ->
-- --
2.27.0 2.31.1

View File

@ -0,0 +1,182 @@
From 8036ab4bc8f37030fcaceda14678cb14dbbed547 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= <tgolembi@redhat.com>
Date: Wed, 20 Apr 2022 17:14:26 +0200
Subject: [PATCH] -o rhv-upload: wait for VM creation task
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
oVirt API call for VM creation finishes before the VM is actually
created. Entities may be still locked after virt-v2v terminates and if
user tries to perform (scripted) actions after virt-v2v those operations
may fail. To prevent this it is useful to monitor the task and wait for
the completion. This will also help to prevent some corner case
scenarios (that would be difficult to debug) when the VM creation job
fails after virt-v2v already termintates with success.
Thanks: Nir Soffer
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1985827
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Reviewed-by: Arik Hadas <ahadas@redhat.com>
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
(cherry picked from commit 291edb363e841e1c555954a070def671a651cfab)
---
.../ovirtsdk4/__init__.py | 10 +++-
.../ovirtsdk4/types.py | 19 +++++++
v2v/rhv-upload-createvm.py | 57 ++++++++++++++++++-
3 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py b/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py
index abb7050c..ba0649cb 100644
--- a/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py
+++ b/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py
@@ -63,6 +63,9 @@ class SystemService(object):
def disks_service(self):
return DisksService()
+ def jobs_service(self):
+ return JobsService()
+
def image_transfers_service(self):
return ImageTransfersService()
@@ -108,6 +111,11 @@ class DisksService(object):
return DiskService(disk_id)
+class JobsService(object):
+ def list(self, search=None):
+ return [types.Job()]
+
+
class ImageTransferService(object):
def __init__(self):
self._finalized = False
@@ -139,7 +147,7 @@ class StorageDomainsService(object):
class VmsService(object):
- def add(self, vm):
+ def add(self, vm, query=None):
return vm
def list(self, search=None):
diff --git a/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py b/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py
index 732887aa..8e734756 100644
--- a/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py
+++ b/tests/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py
@@ -138,6 +138,25 @@ class Initialization(object):
pass
+class JobStatus(Enum):
+ ABORTED = "aborted"
+ FAILED = "failed"
+ FINISHED = "finished"
+ STARTED = "started"
+ UNKNOWN = "unknown"
+
+ def __init__(self, image):
+ self._image = image
+
+ def __str__(self):
+ return self._image
+
+
+class Job(object):
+ description = "Fake job"
+ status = JobStatus.FINISHED
+
+
class StorageDomain(object):
def __init__(self, name=None):
pass
diff --git a/v2v/rhv-upload-createvm.py b/v2v/rhv-upload-createvm.py
index 50bb7e34..8887c52b 100644
--- a/v2v/rhv-upload-createvm.py
+++ b/v2v/rhv-upload-createvm.py
@@ -19,12 +19,54 @@
import json
import logging
import sys
+import time
+import uuid
from urllib.parse import urlparse
import ovirtsdk4 as sdk
import ovirtsdk4.types as types
+
+def debug(s):
+ if params['verbose']:
+ print(s, file=sys.stderr)
+ sys.stderr.flush()
+
+
+def jobs_completed(system_service, correlation_id):
+ jobs_service = system_service.jobs_service()
+
+ try:
+ jobs = jobs_service.list(
+ search="correlation_id=%s" % correlation_id)
+ except sdk.Error as e:
+ debug(
+ "Error searching for jobs with correlation id %s: %s" %
+ (correlation_id, e))
+ # We don't know, assume that jobs did not complete yet.
+ return False
+
+ # STARTED is the only "in progress" status, anything else means the job
+ # has already terminated.
+ if all(job.status != types.JobStatus.STARTED for job in jobs):
+ failed_jobs = [(job.description, str(job.status))
+ for job in jobs
+ if job.status != types.JobStatus.FINISHED]
+ if failed_jobs:
+ raise RuntimeError(
+ "Failed to create a VM! Failed jobs: %r" % failed_jobs)
+ return True
+ else:
+ running_jobs = [(job.description, str(job.status)) for job in jobs]
+ debug("Some jobs with correlation id %s are running: %s" %
+ (correlation_id, running_jobs))
+ return False
+
+
+# Seconds to wait for the VM import job to complete in oVirt.
+timeout = 3 * 60
+
# Parameters are passed in via a JSON doc from the OCaml code.
# Because this Python code ships embedded inside virt-v2v there
# is no formal API here.
@@ -67,6 +109,7 @@ system_service = connection.system_service()
cluster = system_service.clusters_service().cluster_service(params['rhv_cluster_uuid'])
cluster = cluster.get()
+correlation_id = str(uuid.uuid4())
vms_service = system_service.vms_service()
vm = vms_service.add(
types.Vm(
@@ -77,5 +120,17 @@ vm = vms_service.add(
data=ovf,
)
)
- )
+ ),
+ query={'correlation_id': correlation_id},
)
+
+# Wait for the import job to finish.
+endt = time.monotonic() + timeout
+while True:
+ time.sleep(10)
+ if jobs_completed(system_service, correlation_id):
+ break
+ if time.monotonic() > endt:
+ raise RuntimeError(
+ "Timed out waiting for VM creation!"
+ " Jobs still running for correlation id %s" % correlation_id)
--
2.31.1

View File

@ -0,0 +1,96 @@
From 7748be2af952898c9c38d02e9a539c71cbfbb56b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 25 May 2021 10:13:00 +0100
Subject: [PATCH] tests: Add test of -i ova from a directory.
This was not tested previously.
(cherry picked from commit a00ce662cb33c33706a013ff98ff89244cd14667)
---
tests/Makefile.am | 2 ++
tests/test-v2v-i-ova-directory.sh | 53 +++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
create mode 100755 tests/test-v2v-i-ova-directory.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index eee4e1af..e4b907fe 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -58,6 +58,7 @@ TESTS = \
test-v2v-copy-to-local.sh \
test-v2v-i-ova-bad-sha1.sh \
test-v2v-i-ova-bad-sha256.sh \
+ test-v2v-i-ova-directory.sh \
test-v2v-i-ova-formats.sh \
test-v2v-i-ova-good-checksums.sh \
test-v2v-i-ova-gz.sh \
@@ -185,6 +186,7 @@ EXTRA_DIST += \
test-v2v-i-ova-bad-sha1.sh \
test-v2v-i-ova-bad-sha256.sh \
test-v2v-i-ova-checksums.ovf \
+ test-v2v-i-ova-directory.sh \
test-v2v-i-ova-formats.expected \
test-v2v-i-ova-formats.ovf \
test-v2v-i-ova-formats.sh \
diff --git a/tests/test-v2v-i-ova-directory.sh b/tests/test-v2v-i-ova-directory.sh
new file mode 100755
index 00000000..7c593139
--- /dev/null
+++ b/tests/test-v2v-i-ova-directory.sh
@@ -0,0 +1,53 @@
+#!/bin/bash -
+# libguestfs virt-v2v test script
+# Copyright (C) 2014-2021 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Test -i ova option with a directory.
+
+set -e
+
+$TEST_FUNCTIONS
+skip_if_skipped
+skip_if_backend uml
+skip_unless_phony_guest windows.img
+
+skip_unless_libvirt_minimum_version 3 1 0
+
+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
+
+d=test-v2v-i-ova-directory.d
+rm -rf $d
+mkdir $d
+
+vmdk=test-ova.vmdk
+ovf=test-v2v-i-ova.ovf
+mf=test-ova.mf
+
+qemu-img convert $top_builddir/test-data/phony-guests/windows.img \
+ -O vmdk $d/$vmdk
+cp "$srcdir/$ovf" $d/$ovf
+sha1=`do_sha1 $d/$ovf`
+echo "SHA1($ovf)= $sha1" > $d/$mf
+sha256=`do_sha256 $d/$vmdk`
+echo "SHA256($vmdk)= $sha256" >> $d/$mf
+
+$VG virt-v2v --debug-gc \
+ -i ova $d \
+ -o null
+
+rm -rf $d
--
2.31.1

View File

@ -0,0 +1,66 @@
From 9e52e90cf8d570516d4098584c263c9d8b76c447 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 25 May 2021 10:27:53 +0100
Subject: [PATCH] v2v: -i ova: Fix parsing if OVA directory name has a trailing
"/"
If you use an OVA directory with a trailing "/" in the name, virt-v2v
would fail with:
virt-v2v: error: internal error: assertion failed at parse_ova.ml, line 273, char 15
The fix for this is to knock off the trailing "/" if present.
Reported-by: Xiaodai Wang
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1964324
(cherry picked from commit f8428f5eaaff6dedc54a40138f760298a7a3a965)
---
v2v/parse_ova.ml | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/v2v/parse_ova.ml b/v2v/parse_ova.ml
index 568ac5fa..fc413d2a 100644
--- a/v2v/parse_ova.ml
+++ b/v2v/parse_ova.ml
@@ -57,6 +57,13 @@ and ova_type =
*)
| TarOptimized of string (* tarball *)
+let string_of_t { orig_ova; top_dir; ova_type } =
+ sprintf "orig_ova = %s, top_dir = %s, ova_type = %s"
+ orig_ova top_dir
+ (match ova_type with
+ | Directory -> "Directory"
+ | TarOptimized tarball -> "TarOptimized " ^ tarball)
+
type file_ref =
| LocalFile of string
| TarFile of string * string
@@ -122,6 +129,13 @@ let rec parse_ova ova =
(* Exploded path must be absolute (RHBZ#1155121). *)
let top_dir = absolute_path top_dir in
+ (* top_dir must not end with / except if it == "/" (which is
+ * likely not what you want). (RHBZ#1964324)
+ *)
+ let top_dir =
+ if top_dir = "/" || not (String.is_suffix top_dir "/") then top_dir
+ else String.sub top_dir 0 (String.length top_dir - 1) in
+
(* If virt-v2v is running as root, and the backend is libvirt, then
* we have to chmod the directory to 0755 and files to 0644
* so it is readable by qemu.qemu. This is libvirt bug RHBZ#890291.
@@ -136,7 +150,9 @@ let rec parse_ova ova =
ignore (run_command cmd)
);
- { orig_ova = ova; top_dir; ova_type }
+ let ova = { orig_ova = ova; top_dir; ova_type } in
+ debug "ova: %s" (string_of_t ova);
+ ova
(* Return true if [libvirt] supports ["json:"] pseudo-URLs and accepts the
* ["raw"] driver. Function also returns true if [libvirt] backend is not
--
2.31.1

View File

@ -1,4 +1,4 @@
From 6c1260b543ed5a947481f7b12943494eeea085fb Mon Sep 17 00:00:00 2001 From 87e5404d20ec54d16d22a7bb8f06ea91076c91f7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 25 May 2022 16:47:04 +0100 Date: Wed, 25 May 2022 16:47:04 +0100
Subject: [PATCH] convert: If listing RPM applications fails, rebuild DB and Subject: [PATCH] convert: If listing RPM applications fails, rebuild DB and
@ -23,7 +23,6 @@ Reported-by: Xiaodai Wang
Reported-by: Ming Xie Reported-by: Ming Xie
Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 31bf5db25bcfd8a9f5a48cc0523abae28861de9a) (cherry picked from commit 31bf5db25bcfd8a9f5a48cc0523abae28861de9a)
(cherry picked from commit 87e5404d20ec54d16d22a7bb8f06ea91076c91f7)
--- ---
v2v/inspect_source.ml | 34 ++++++++++++++++++++++++++++++++-- v2v/inspect_source.ml | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-) 1 file changed, 32 insertions(+), 2 deletions(-)

View File

@ -0,0 +1,53 @@
From 5852b85eaa174dfb87ce7a03b9f70e2bffac4ca4 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 29 Jun 2022 15:44:27 +0200
Subject: [PATCH] update common submodule for CVE-2022-2211 fix
$ git shortlog 9e990f3e4530..35467027f657
Laszlo Ersek (1):
options: fix buffer overflow in get_keys() [CVE-2022-2211]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 795d5dfcef77fc54fec4d237bda28571454a6d4e)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common be09523d..1174b443:
diff --git a/common/options/keys.c b/common/options/keys.c
index 798315c..d27a712 100644
--- a/common/options/keys.c
+++ b/common/options/keys.c
@@ -128,17 +128,23 @@ read_first_line_from_file (const char *filename)
char **
get_keys (struct key_store *ks, const char *device, const char *uuid)
{
- size_t i, j, len;
+ size_t i, j, nmemb;
char **r;
char *s;
/* We know the returned list must have at least one element and not
* more than ks->nr_keys.
*/
- len = 1;
- if (ks)
- len = MIN (1, ks->nr_keys);
- r = calloc (len+1, sizeof (char *));
+ nmemb = 1;
+ if (ks && ks->nr_keys > nmemb)
+ nmemb = ks->nr_keys;
+
+ /* make room for the terminating NULL */
+ if (nmemb == (size_t)-1)
+ error (EXIT_FAILURE, 0, _("size_t overflow"));
+ nmemb++;
+
+ r = calloc (nmemb, sizeof (char *));
if (r == NULL)
error (EXIT_FAILURE, errno, "calloc");
--
2.31.1

View File

@ -6,7 +6,7 @@ set -e
# directory. Use it like this: # directory. Use it like this:
# ./copy-patches.sh # ./copy-patches.sh
rhel_version=8.6.0 rhel_version=8.7.0
# Check we're in the right directory. # Check we're in the right directory.
if [ ! -f virt-v2v.spec ]; then if [ ! -f virt-v2v.spec ]; then

View File

@ -10,7 +10,7 @@
Name: virt-v2v Name: virt-v2v
Epoch: 1 Epoch: 1
Version: 1.42.0 Version: 1.42.0
Release: 19%{?dist} Release: 21%{?dist}
Summary: Convert a virtual machine to run on KVM Summary: Convert a virtual machine to run on KVM
License: GPLv2+ License: GPLv2+
@ -83,7 +83,11 @@ Patch0044: 0044-v2v-vcenter-Implement-cookie-scripts.patch
Patch0045: 0045-convert-convert_windows.ml-Handle-date-formats-with-.patch Patch0045: 0045-convert-convert_windows.ml-Handle-date-formats-with-.patch
Patch0046: 0046-v2v-Force-format-of-input-to-be-specified.patch Patch0046: 0046-v2v-Force-format-of-input-to-be-specified.patch
Patch0047: 0047-v2v-Cope-with-libvirt-vpx-esx-driver-which-does-not-.patch Patch0047: 0047-v2v-Cope-with-libvirt-vpx-esx-driver-which-does-not-.patch
Patch0048: 0048-convert-If-listing-RPM-applications-fails-rebuild-DB.patch Patch0048: 0048-o-rhv-upload-wait-for-VM-creation-task.patch
Patch0049: 0049-tests-Add-test-of-i-ova-from-a-directory.patch
Patch0050: 0050-v2v-i-ova-Fix-parsing-if-OVA-directory-name-has-a-tr.patch
Patch0051: 0051-convert-If-listing-RPM-applications-fails-rebuild-DB.patch
Patch0052: 0052-update-common-submodule-for-CVE-2022-2211-fix.patch
# Patches which apply to the common/ submodule. # Patches which apply to the common/ submodule.
# These have to be hand-modified. # These have to be hand-modified.
@ -327,9 +331,14 @@ rm $RPM_BUILD_ROOT%{_mandir}/man1/virt-v2v-test-harness.1*
%changelog %changelog
* Tue Jun 07 2022 Richard W.M. Jones <rjones@redhat.com> - 1:1.42.0-19 * Tue Jul 05 2022 Richard W.M. Jones <rjones@redhat.com> - 1:1.42.0-21
- If listing RPM applications fails, rebuild DB and retry - Fix assertion failure when parsing OVA dir with trailing slash
resolves: rhbz#2093415 resolves: rhbz#2028823
- For -o rhv-upload wait for VM creation task
resolves: rhbz#1985827
- If listing RPM applications fails, rebuild DB and retry (2089623)
- Fix CVE-2022-2211 Denial of Service in --key parameter
resolves: rhbz#2102720
* Wed Nov 24 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.42.0-18 * Wed Nov 24 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.42.0-18
- Additional fix for backing file specified without backing format - Additional fix for backing file specified without backing format