[elbe-devel] [PATCH] initvmaction: improve errormessages, when libvirt.open() fails

Manuel Traut manut at linutronix.de
Wed May 9 10:02:32 CEST 2018


the following exception was seen, if entering the password to access
libvirt is delayed to long:

--------------------
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system reboot
[  325.635523] reboot: Restarting system
mkdir -p .stamps
touch .stamps/stamp-install-initial-image
libvirt: DBus Utils error : error from service: CheckAuthorization: Did not receive a reply. Possible causes include: the remote application did not send a
+reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Traceback (most recent call last):
  File "/usr/bin/elbe", line 55, in <module>
    cmdmod.run_command(sys.argv[2:])
  File "/usr/lib/python2.7/dist-packages/elbepack/commands/initvm.py", line 81, in run_command
    action = InitVMAction(args[0])
  File "/usr/lib/python2.7/dist-packages/elbepack/initvmaction.py", line 116, in __init__
    InitVMAction.__init__(self, node)
  File "/usr/lib/python2.7/dist-packages/elbepack/initvmaction.py", line 77, in __init__
    self.conn = libvirt.open("qemu:///system")
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 255, in open
    if ret is None:raise libvirtError('virConnectOpen() failed')
libvirt.libvirtError: error from service: CheckAuthorization: Did not receive a reply. Possible causes include: the remote application did not send a reply,
+the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Starting the initvm Failed
Giving up
--------------------

give a better message to the user.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/initvmaction.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index df86ca36..e714fc40 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -93,6 +93,15 @@ class InitVMAction(object):
                 print("should fix the problem.", file=sys.stderr)
                 sys.exit(20)
 
+            if verr.args[0].startswith('error from service: CheckAuthorization'):
+                print("", file=sys.stderr)
+                print("Accessing libvirt failed.", file=sys.stderr)
+                print("Probably entering the password for accssing libvirt", file=sys.stderr)
+                print("timed out. If this occured after 'elbe initvm create'", file=sys.stderr)
+                print("it should be safe to use 'elbe initvm start' to", file=sys.stderr)
+                print("continue.", file=sys.stderr)
+                sys.exit(20)
+
             # In case we get here, the exception is unknown, and we want to see it
             raise
 
-- 
2.17.0




More information about the elbe-devel mailing list