Turn live domain error into a warning
resolves: RHEL-88543
This commit is contained in:
parent
51042a99b1
commit
47ce2daa1e
@ -0,0 +1,57 @@
|
||||
From cd55bd8d160cdcdfe21aaafc15f7a1cefee98b85 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 25 Apr 2025 11:44:15 +0100
|
||||
Subject: [PATCH] lib/libvirt_utils.ml: Turn live domain error into a warning
|
||||
|
||||
As explained in the comment, we cannot easily tell if conversion is
|
||||
being attempted from a snapshot (which is safe, even if the domain is
|
||||
running). Therefore turn the error into a strong warning.
|
||||
|
||||
Reported-by: Martin Necas
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-88543
|
||||
(cherry picked from commit 8c27cb1e525b5e1d380ab27a141de6f026f4b2db)
|
||||
---
|
||||
lib/libvirt_utils.ml | 25 ++++++++++++++++---------
|
||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/lib/libvirt_utils.ml b/lib/libvirt_utils.ml
|
||||
index 4200c7c8..41ee38d2 100644
|
||||
--- a/lib/libvirt_utils.ml
|
||||
+++ b/lib/libvirt_utils.ml
|
||||
@@ -59,20 +59,27 @@ let get_domain conn name =
|
||||
error (f_"cannot find libvirt domain ‘%s’: %s")
|
||||
name (Option.value ~default:"" message)
|
||||
) in
|
||||
- let uri = Libvirt.Connect.get_uri conn in
|
||||
- (* As a side-effect we check that the domain is shut down. Of course
|
||||
- * this is only appropriate for virt-v2v. (RHBZ#1138586)
|
||||
+
|
||||
+ (* As a side-effect we check that the domain is shut down (RHBZ#1138586).
|
||||
+ * In earlier versions of virt-v2v this was a hard error. Now it's
|
||||
+ * a warning, since we can't easily tell if the user is converting
|
||||
+ * from a snapshot - which is safe (RHEL-88543).
|
||||
*)
|
||||
+ let uri = Libvirt.Connect.get_uri conn in
|
||||
if not (String.is_prefix uri "test:") then (
|
||||
(match (Libvirt.Domain.get_info dom).Libvirt.Domain.state with
|
||||
- | InfoRunning | InfoBlocked | InfoPaused ->
|
||||
- error (f_"libvirt domain ‘%s’ is running or paused. It must be \
|
||||
- shut down in order to perform virt-v2v conversion")
|
||||
- (Libvirt.Domain.get_name dom)
|
||||
- | InfoNoState | InfoShutdown | InfoShutoff | InfoCrashed | InfoPMSuspended ->
|
||||
- ()
|
||||
+ | InfoRunning | InfoBlocked | InfoPaused ->
|
||||
+ warning (f_"libvirt domain ‘%s’ is running or paused. Converting \
|
||||
+ a live guest will result in corrupted output. \
|
||||
+ However this is safe if you're converting from a \
|
||||
+ snapshot")
|
||||
+ (Libvirt.Domain.get_name dom)
|
||||
+ | InfoNoState | InfoShutdown | InfoShutoff | InfoCrashed
|
||||
+ | InfoPMSuspended ->
|
||||
+ ()
|
||||
)
|
||||
);
|
||||
+
|
||||
dom
|
||||
|
||||
let get_pool conn name =
|
||||
@ -8,7 +8,7 @@
|
||||
Name: virt-v2v
|
||||
Epoch: 1
|
||||
Version: 2.7.1
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
Summary: Convert a virtual machine to run on KVM
|
||||
|
||||
License: GPL-2.0-or-later AND LGPL-2.0-or-later
|
||||
@ -66,6 +66,7 @@ Patch0035: 0035-build-Remove-with-virt-v2v-nbdkit-python-plugin.patch
|
||||
Patch0036: 0036-build-Use-nbdcopy-and-nbdinfo-from-.-configure.patch
|
||||
Patch0037: 0037-v2v-Use-nbdcopy-blkhash-in-verbose-mode.patch
|
||||
Patch0038: 0038-v2v-Print-nbdcopy-command-in-debug-output.patch
|
||||
Patch0039: 0039-lib-libvirt_utils.ml-Turn-live-domain-error-into-a-w.patch
|
||||
|
||||
%if !0%{?rhel}
|
||||
# libguestfs hasn't been built on i686 for a while since there is no
|
||||
@ -367,13 +368,15 @@ make -C tests TESTS=test-fedora-luks-on-lvm-conversion.sh check
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 04 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-8
|
||||
* Fri Apr 25 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-9
|
||||
- mlcustomize: Remove dnf --verbose option
|
||||
resolves: RHEL-83289
|
||||
- Print blkhash of converted image in virt-v2v debugging output
|
||||
resolves: RHEL-85512
|
||||
- Print nbdcopy command in debug output
|
||||
resolves: RHEL-86022
|
||||
- Turn live domain error into a warning
|
||||
resolves: RHEL-88543
|
||||
|
||||
* Tue Feb 25 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-5
|
||||
- Rebase to upstream development version 2.7.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user