[libvirt] [jenkins-ci PATCH] guests: optionally wait for installation completion

Daniel P. Berrangé berrange at redhat.com
Tue Jan 7 14:17:29 UTC 2020


The install command is hardcoded to put the virt-install command into
the background. It is useful to be able to wait for completion, so you
know when you can go onto the package update step of setup, without
having to check back to see if the guest has finished installing.

Using --noautoconsole is preferred syntax for virt-install, avoiding
a warning about use of "--wait 0".

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 guests/lcitool | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/guests/lcitool b/guests/lcitool
index d24ac0d..8a681e4 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -394,11 +394,20 @@ class Application:
                 help="target architecture for cross compiler",
             )
 
+        def add_wait_arg(parser):
+            parser.add_argument(
+                "-w", "--wait",
+                help="wait for installation to complete",
+                default=False,
+                action="store_true",
+            )
+
         installparser = subparsers.add_parser(
             "install", help="perform unattended host installation")
         installparser.set_defaults(func=self._action_install)
 
         add_hosts_arg(installparser)
+        add_wait_arg(installparser)
 
         updateparser = subparsers.add_parser(
             "update", help="prepare hosts and keep them updated")
@@ -597,9 +606,11 @@ class Application:
                 "--rng", "device=/dev/urandom,model=virtio",
                 "--initrd-inject", initrd_inject,
                 "--extra-args", extra_arg,
-                "--wait", "0",
             ]
 
+            if not args.wait:
+                cmd.append("--noautoconsole")
+
             # Only configure autostart for the guest for the jenkins flavor
             if flavor == "jenkins":
                 cmd += ["--autostart"]
-- 
2.23.0




More information about the libvir-list mailing list