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

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@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

On Tue, Jan 07, 2020 at 02:17:29PM +0000, Daniel P. Berrangé wrote:
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@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") +
I've been missing something like this, even though not necessarily with an open console, especially since we're using well known kickstarts/preseeds. If you just want to wait for the installation to complete, we can just simply combine --noautoconsole with --wait. I'm fine with your suggestion, but I wanted to put an alternative out there. Conceptually: Reviewed-by: Erik Skultety <eskultet@redhat.com> Also: Tested-by: Erik Skultety <eskultet@redhat.com>

On Tue, Jan 07, 2020 at 04:22:07PM +0100, Erik Skultety wrote:
On Tue, Jan 07, 2020 at 02:17:29PM +0000, Daniel P. Berrangé wrote:
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@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") +
I've been missing something like this, even though not necessarily with an open console, especially since we're using well known kickstarts/preseeds. If you just want to wait for the installation to complete, we can just simply combine --noautoconsole with --wait. I'm fine with your suggestion, but I wanted to put an alternative out there.
I wanted to actually see the output too since things fail sometimes, especially for the rawhide-esque distros.
Conceptually: Reviewed-by: Erik Skultety <eskultet@redhat.com>
Also: Tested-by: Erik Skultety <eskultet@redhat.com>
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé
-
Erik Skultety