[elbe-devel] [PATCH] Fail on 'initvm create' with existing tmux session

bage at linutronix.de bage at linutronix.de
Thu Feb 21 18:27:14 CET 2019


From: Bastian Germann <bage at linutronix.de>

If you create a libvirt machine with elbe and an old elbe version is running you
end up with qemu errors
-netdev user,id=hostnet0: could not set up host forwarding rule 'tcp:7587::7588'
-netdev user,id=hostnet0: Device 'user' could not be initialized

Error with a user message if a elbe tmux session is running on initvm create.
This closes issue #167.

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

diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index c189abaf..3bff8061 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -424,6 +424,16 @@ class CreateAction(InitVMAction):
                   "of your old initvm.")
             sys.exit(20)
 
+        # Upgrade from older versions which used tmux
+        try:
+            system("tmux has-session -t ElbeInitVMSession 2>/dev/null")
+            print ("ElbeInitVMSession exists in tmux. "
+                   "It may belong to an old elbe version. "
+                   "Please stop it to prevent interfering with this version.", file=sys.stderr)
+            sys.exit(20)
+        except CommandError:
+            pass
+
         # Init cdrom to None, if we detect it, we set it
         cdrom = None
 
-- 
2.11.0




More information about the elbe-devel mailing list