public inbox for pve-devel@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>,
	Stefan Reiter <s.reiter@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 qemu-server 4/7] fix #3010: add 'bootorder' parameter for better control of boot devices
Date: Fri, 16 Oct 2020 16:53:24 +0200	[thread overview]
Message-ID: <9e9dff0a-bb1c-0a4c-94af-7536fd11b168@proxmox.com> (raw)
In-Reply-To: <20201006133218.25403-5-s.reiter@proxmox.com>

On 06.10.20 15:32, Stefan Reiter wrote:
> @@ -3213,17 +3210,30 @@ sub config_to_command {
>  	push @$devices, '-device', $kbd if defined($kbd);
>      }
>  
> +    my $bootorder = {};
> +    my $boot = parse_property_string($boot_fmt, $conf->{boot}) if $conf->{boot};

Seeing just now, never declare a variable conditionally, this is dangerous in perl,
like a lot! If the check above fails, the variable will operate with the value it was
last set too, and not be undef.

You added this pattern also when doing the RNG stuff, so it's clearly something
you're not aware off but like to use. Please stop doing so, as this led us already
once to a long bug hunt, which I'd like to avoid again.


> +    if (!defined($boot) || $boot->{legacy}) {
> +	$bootorder = bootorder_from_legacy($conf, $boot);
> +    } elsif ($boot->{order}) {
> +	# start at 100 to allow user to insert devices before us with -args
> +	my $i = 100;
> +	for my $dev (PVE::Tools::split_list($boot->{order})) {
> +	    $bootorder->{$dev} = $i++;
> +	}
> +    }
> +





  reply	other threads:[~2020-10-16 14:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 13:32 [pve-devel] [PATCH v2 0/7] Improve boot device/order configuration Stefan Reiter
2020-10-06 13:32 ` [pve-devel] [PATCH v2 qemu-server 1/7] fix indentation Stefan Reiter
2020-10-06 13:32 ` [pve-devel] [PATCH v2 qemu-server 2/7] cfg2cmd: add test for legacy-style bootorder Stefan Reiter
2020-10-06 13:32 ` [pve-devel] [PATCH v2 qemu-server 3/7] add new 'boot' property format and introduce legacy conversion helpers Stefan Reiter
2020-10-06 13:32 ` [pve-devel] [PATCH v2 qemu-server 4/7] fix #3010: add 'bootorder' parameter for better control of boot devices Stefan Reiter
2020-10-16 14:53   ` Thomas Lamprecht [this message]
2020-10-06 13:32 ` [pve-devel] [PATCH v2 qemu-server 5/7] api: add handling for new boot order format Stefan Reiter
2020-10-06 13:32 ` [pve-devel] [PATCH v2 qemu-server 6/7] cfg2cmd: add tests for new boot order property Stefan Reiter
2020-10-06 13:32 ` [pve-devel] [PATCH v2 manager 7/7] ui: improve boot order editor Stefan Reiter
2020-10-16 12:50 ` [pve-devel] applied-series: [PATCH v2 0/7] Improve boot device/order configuration Thomas Lamprecht

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=9e9dff0a-bb1c-0a4c-94af-7536fd11b168@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.reiter@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