all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Fiona Ebner <f.ebner@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 16:54:47 +0200	[thread overview]
Message-ID: <bd26e8d0-9586-34d4-4c62-fbc6cbc29a09@proxmox.com> (raw)
In-Reply-To: <cb3113c8-2d77-bceb-56d5-31db0f3d4b48@proxmox.com>

Am 12/06/2023 um 13:22 schrieb Fiona Ebner:
> 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}

does not work here as this is an actual hash value, not the (for our perl code more common)
hash ref.

my %foo = (a => 1);
$foo{b} = 2;

vs.

my $foo = {a => 1};
$foo->{b} = 2;

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

would it make sense to differ between stderr/stdour and do log_warn and print,
respectively?

> 
> 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 ;)).

not sure if we really need a prefix at all here..




  parent reply	other threads:[~2023-06-12 14:55 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
2023-06-12 11:26   ` Fiona Ebner
2023-06-12 14:54   ` Thomas Lamprecht [this message]
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=bd26e8d0-9586-34d4-4c62-fbc6cbc29a09@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=c.heiss@proxmox.com \
    --cc=f.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal