On Mon, Sep 25, 2023 at 04:15 PM +0100, Daniel P. Berrangé <berrange@xxxxxxxxxx> wrote: > On Mon, Sep 25, 2023 at 03:39:09PM +0200, Marc Hartmayer wrote: >> When starting a guest via libvirt (`virsh start --console`), early >> console output was missed because the guest was started first and then >> the console was attached. This patch changes this to the following >> sequence: >> >> 1. create a paused guest >> 2. attach the console >> 3. resume the guest >> >> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> >> Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> >> --- >> tools/virsh-domain.c | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c >> index 5c3c6d18aebf..3581161c6f53 100644 >> --- a/tools/virsh-domain.c >> +++ b/tools/virsh-domain.c >> @@ -4065,6 +4065,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) >> g_autoptr(virshDomain) dom = NULL; >> #ifndef WIN32 >> bool console = vshCommandOptBool(cmd, "console"); >> + bool resume_domain = false; >> #endif >> unsigned int flags = VIR_DOMAIN_NONE; >> int rc; >> @@ -4083,8 +4084,14 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) >> if (virshFetchPassFdsList(ctl, cmd, &nfds, &fds) < 0) >> return false; >> >> - if (vshCommandOptBool(cmd, "paused")) >> + if (vshCommandOptBool(cmd, "paused")) { >> flags |= VIR_DOMAIN_START_PAUSED; >> +#ifndef WIN32 >> + } else if (console) { >> + flags |= VIR_DOMAIN_START_PAUSED; >> + resume_domain = true; >> +#endif > > Hypervisor drivers are not required to support VIR_DOMAIN_START_PAUSED. > > So we need to detect the error code, and retry without that flag > set as a fallback. Same in next patch. Yep, makes sense - will change. Thanks for the feedback. […snip] -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294