public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Christoph Heiss <c.heiss@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server] fix #4549: capture and bubble up qemu errors correctly
Date: Mon, 12 Jun 2023 13:22:29 +0200	[thread overview]
Message-ID: <cb3113c8-2d77-bceb-56d5-31db0f3d4b48@proxmox.com> (raw)
In-Reply-To: <20230509084654.666207-1-c.heiss@proxmox.com>

Am 09.05.23 um 10:46 schrieb Christoph Heiss:
> @@ -5922,13 +5916,19 @@ sub vm_start_nolock {
>  		$tpmpid = start_swtpm($storecfg, $vmid, $tpm, $migratedfrom);
>  	    }
>  
> +	    # '\r\n' needs to be used as a line separator here, as that is what run_command() splits
> +	    # lines on. If just a newline is used, all error message lines end up on a single line
> +	    # in the migration tasklog.

So this is essentially a hack to work around the fact that we don't call
print once for each line anymore ;)

> +	    my $err = '';
> +	    $run_params{logfunc} = sub { $err .= "QEMU: $1\r\n"; };

Style nit: please use $run_params->{logfunc}

So you're eating up all the log lines here...

> +
>  	    my $exitcode = run_command($cmd, %run_params);
>  	    if ($exitcode) {
>  		if ($tpmpid) {
>  		    warn "stopping swtpm instance (pid $tpmpid) due to QEMU startup error\n";
>  		    kill 'TERM', $tpmpid;
>  		}
> -		die "QEMU exited with code $exitcode\n";
> +		die "QEMU exited with code $exitcode\r\n$err";

...and only print them in the failure case. This means all non-critical
errors/warnings/info will never see the light of day anymore? To get a
warning for testing you can use e.g.
qm set 100 --args '-no-hpet'
with QEMU >= 8.0.

The current approach also produces a leading space in the task logs for
the follow-up lines:

> TASK ERROR: start failed: QEMU exited with code 1
>  QEMU: kvm: -no-hpet: warning: -no-hpet is deprecated, use '-machine hpet=off' instead
>  QEMU: bridge 'vmbr1' does not exist
>  QEMU: kvm: -netdev type=tap,id=net1,ifname=tap100i1,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on: network script /var/lib/qemu-server/pve-bridge failed with status 512

Instead of getting rid of the "print once per line" handling, can't we
rather adapt the invocation for backup to bubble up the other log lines too?

Always prefixing the messages with "QEMU: " seems fine to me (even
things like the "bridge 'vmbr1' does not exist" message technically come
from the pve-bridge script, it's still part of the QEMU invocation ;)).




  reply	other threads:[~2023-06-12 11:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09  8:46 Christoph Heiss
2023-06-12 11:22 ` Fiona Ebner [this message]
2023-06-12 11:26   ` Fiona Ebner
2023-06-12 14:54   ` Thomas Lamprecht
2023-06-13  7:05     ` Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb3113c8-2d77-bceb-56d5-31db0f3d4b48@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal