all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-storage] partially-fix #7840: storage: read import output until 'ready'
@ 2026-10-07  9:41 Arthur Bied-Charreton
  2026-10-28 19:33 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Arthur Bied-Charreton @ 2026-10-07  9:41 UTC (permalink / raw)
  To: pve-devel

volume_import_start() spawns `pvesm import`, merges the subprocess'
stdout and stderr into one stream, and took the first line read from it
as the readiness signal. Any unrelated output the child emits first was
therefore mistaken for "ready", and the socket path was returned to the
caller before the child has bound and listened on it.

Read lines until one is exactly "ready", passing the earlier ones
through, and fail explicitly if the child reached EOF first.

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7840
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/Storage.pm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 64ea9da..60b5dcc 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -2214,14 +2214,19 @@ sub volume_import_start {
     my $cpid = open3($input, $info, $info, @$import)
         or die "failed to spawn disk-import child - $!\n";
 
-    my $ready;
+    my ($ready, $output) = (0, '');
     eval {
-        PVE::Tools::run_with_timeout(5, sub { $ready = <$info>; });
+        PVE::Tools::run_with_timeout(5, sub {
+            while (defined(my $line = <$info>)) {
+                return $ready = 1 if $line eq "ready\n";
+                $output .= $line;
+            }
+        });
     };
+    die "failed to read readiness from disk import child: $@\n$output" if $@;
+    die "disk import child exited before signalling readiness\n$output" if !$ready;
 
-    die "failed to read readyness from disk import child: $@\n" if $@;
-
-    print "$ready\n";
+    print "${output}ready\n";
 
     return {
         fh => $info,
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-28 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07  9:41 [PATCH pve-storage] partially-fix #7840: storage: read import output until 'ready' Arthur Bied-Charreton
2026-10-28 19:33 ` applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal