From 10e892c2a2897097aad60db1c32a62251d4eca36 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 27 Mar 2020 23:24:58 +0100 Subject: [PATCH] cephadm: Fix trucated output of `mgr dump` In case the process has terminated, we have to make sure to read till EOF, otherwise we might skip some bytes. Fixes: https://tracker.ceph.com/issues/44642 Co-authored-by: Tim Serong Signed-off-by: Sebastian Wagner (cherry picked from commit 6a6759eef06c32efe1a10190925da6bc7e5ec4b0) --- src/cephadm/cephadm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 50a5b78a2f644..baccd7c050514 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -638,6 +638,12 @@ def call(command, # type: List[str] message = message_b.decode('utf-8') if isinstance(message_b, str): message = message_b + if stop and message: + # process has terminated, but have more to read still, so not stopping yet + # (os.read returns '' when it encounters EOF) + stop = False + if not message: + continue if fd == process.stdout.fileno(): out += message message = out_buffer + message -- 2.47.3