Fix regression when converting vmx+ssh with snapshots

resolves: RHEL-102938
This commit is contained in:
Richard W.M. Jones 2026-01-13 14:36:42 +00:00
parent 656aeeb9b5
commit ba7f4da2c1
3 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,26 @@
From 439e4547711ab96d2f6948e4a51b6e455057c69b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 13 Jan 2026 14:11:49 +0000
Subject: [PATCH] input/ssh.ml: Add debugging around remote_file_exists
function
It's hard to tell when this function was called and if it returned
success or failure, so add some debugging.
(cherry picked from commit b6d5f9dc47fa57836215a698a1ed9df20f90dabc)
---
input/ssh.ml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/input/ssh.ml b/input/ssh.ml
index 9b93df7b..51276156 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -60,4 +60,6 @@ let remote_file_exists ~server ?port ?user ?password path =
* prove the remote file exists.
*)
let cmd = [ Config.nbdinfo; "--can"; "connect"; uri ] in
- run_command cmd = 0
+ let r = run_command cmd = 0 in
+ debug "ssh: remote_file_exists: testing %s -> %b" path r;
+ r

View File

@ -0,0 +1,48 @@
From f6ab315c4109e055ae8cf739839e40e5a30b3139 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 13 Jan 2026 14:20:18 +0000
Subject: [PATCH] input/ssh.ml: Fix Ssh.remote_file_exists
This function was inadvertently broken in commit 970d7123c2
("input/ssh: Use nbdinfo --can connect (instead of --size)"), since
'nbdinfo --can connect' just says that nbdinfo managed to connect at
all, even if the connection failed to fully negotiate the NBD
handshake. (This is possibly a bug in nbdinfo.)
Using --size means we must have negotiated the NBD handshake.
However this leaves the problem that commit 970d7123c2 was originally
intended to fix, that 'nbdinfo --size' prints the size on stdout. To
fix this, replace use of run_command with shell_command so we can
redirect stdout.
Reported-by: Ming Xie
Thanks: Ming Xie
Updates: commit fb72e059863a60503b6011b8590c25c3a010a58f
Reverts: commit 970d7123c2025bc148870f4bc6fa75fa9e95905f
(cherry picked from commit 986edd3e609cc33e0004e41447b74b93572bd61e)
---
input/ssh.ml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/input/ssh.ml b/input/ssh.ml
index 51276156..2393965c 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -56,10 +56,13 @@ let download_file ~server ?port ?user ?password path output =
let remote_file_exists ~server ?port ?user ?password path =
let uri = start_nbdkit ~server ?port ?user ?password path in
- (* Testing that we can connect to the nbdkit server is enough to
+ (* Testing that the nbdkit server can get the size is enough to
* prove the remote file exists.
*)
- let cmd = [ Config.nbdinfo; "--can"; "connect"; uri ] in
- let r = run_command cmd = 0 in
+ let cmd = sprintf "%s --size %s >/dev/null %s"
+ Config.nbdinfo (quote uri)
+ (* If verbose then allow stderr to go to the log, else hide it *)
+ (if verbose () then "" else "2>&1") in
+ let r = shell_command cmd = 0 in
debug "ssh: remote_file_exists: testing %s -> %b" path r;
r

View File

@ -75,6 +75,8 @@ Patch0007: 0007-RHEL-tests-Remove-btrfs-test.patch
Patch0008: 0008-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0009: 0009-RHEL-output-output.ml-Remove-cache-none.patch
Patch0010: 0010-docs-virt-v2v.pod-Document-Windows-vTPM-and-BitLocke.patch
Patch0011: 0011-input-ssh.ml-Add-debugging-around-remote_file_exists.patch
Patch0012: 0012-input-ssh.ml-Fix-Ssh.remote_file_exists.patch
BuildRequires: autoconf, automake, libtool
BuildRequires: make
@ -411,6 +413,8 @@ done
resolves: RHEL-140894
- Add documentation about BitLocker Recovery
resolves: RHEL-103915
- Fix regression when converting vmx+ssh with snapshots
resolves: RHEL-102938
* Thu Aug 21 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.8.1-9
- Rebase to virt-v2v 2.8.1