[elbe-devel] [PATCH] Refine the 'initvm create' hint on existing domain

bage at linutronix.de bage at linutronix.de
Thu Feb 21 15:45:59 CET 2019


From: Bastian Germann <bage at linutronix.de>

If the libvirt domain is in use, `elbe initvm create` fails with a message
describing how to reuse the existing domain or how to delete it.
Elbe has means to use a different domain by setting an environment variable.
Refine the message to present this information to the user.

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

diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index c189abaf..96a9f268 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -411,11 +411,13 @@ class CreateAction(InitVMAction):
         # pylint: disable=too-many-statements
 
         if self.initvm is not None:
-            print("Initvm already defined.\n")
+            print("Initvm is already defined for the libvirt domain '%s'.\n" % cfg['initvm_domain'])
             print("If you want to build in your old initvm, "
                   "use `elbe initvm submit <xml>`.")
             print("If you want to remove your old initvm from libvirt "
                     "run `virsh --connect qemu:///system undefine %s`.\n" % cfg['initvm_domain'])
+            print("You can specify another libvirt domain by setting the "
+                  "ELBE_INITVM_DOMAIN environment variable to an unused domain name.\n")
             print("Note:")
             print("\t1) You can reimport your old initvm via "
                     "`virsh --connect qemu:///system define <file>`")
-- 
2.11.0




More information about the elbe-devel mailing list