[elbe-devel] [PATCH] initvmaction: Let 'ensure' show the control error

Bastian Germann bage at linutronix.de
Wed Feb 15 15:46:24 CET 2023


'elbe control list_projects' is used in 'elbe ensure' when the initvm is
running to determine if the SOAP connection can be established.

Its output is suppressed which leads to users not knowing the cause of
not being able to connect, e.g. when the client was updated while the
server/initvm was not.

Make 'elbe ensure' show the stderr of the underlying command.

Signed-off-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/initvmaction.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index 70d9d3315c..497385bb89 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -196,14 +196,15 @@ class EnsureAction(InitVMAction):
             system(f'{sys.executable} {elbe_exe} initvm start')
         elif self.initvm_state() == libvirt.VIR_DOMAIN_RUNNING:
             stop = time.time() + 300
-            while time.time() < stop:
-                if command_out(f'{sys.executable} {elbe_exe} control list_projects')[0] == 0:
+            while True:
+                cmd = command_out_stderr(f'{sys.executable} {elbe_exe} control list_projects')
+                if cmd[0] == 0:
                     break
+                if time.time() > stop:
+                    print(f"Waited for 5 minutes and the daemon is still not active: {cmd[2]}",
+                          file=sys.stderr)
+                    sys.exit(20)
                 time.sleep(10)
-            if time.time() > stop:
-                print("Waited for 5 minutes and the daemon is still not active."
-                      " Exit.")
-                sys.exit(20)
         else:
             print("Elbe initvm in bad state.")
             sys.exit(20)
-- 
2.30.2



More information about the elbe-devel mailing list