* [pve-devel] [PATCH qemu-server] api2: only add ide drives for non-legacy bootorders
@ 2021-08-05 11:53 Dominik Csapak
2021-08-05 12:08 ` [pve-devel] applied: " Fabian Grünbichler
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2021-08-05 11:53 UTC (permalink / raw)
To: pve-devel
@bootorder only contains entries for non-legacy bootorder entries,
but the default one contains all cdroms anyway, and if the user
explicitely disabled cdroms, it is ok to not add them back
for the new cdrom drive.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
view with -w to see the actual change
PVE/API2/Qemu.pm | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 94cc0d2..ef0d877 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1358,12 +1358,15 @@ my $update_vm_api = sub {
&$create_disks($rpcenv, $authuser, $conf->{pending}, $arch, $storecfg, $vmid, undef, {$opt => $param->{$opt}});
- # append new CD drives to bootorder to mark them bootable
- my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
- if (PVE::QemuServer::drive_is_cdrom($drive, 1) && !grep(/^$opt$/, @bootorder)) {
- push @bootorder, $opt;
- $conf->{pending}->{boot} = PVE::QemuServer::print_bootorder(\@bootorder);
- $modified->{boot} = 1;
+ # default legacy boot order implies all cdroms anyway
+ if (@bootorder) {
+ # append new CD drives to bootorder to mark them bootable
+ my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
+ if (PVE::QemuServer::drive_is_cdrom($drive, 1) && !grep(/^$opt$/, @bootorder)) {
+ push @bootorder, $opt;
+ $conf->{pending}->{boot} = PVE::QemuServer::print_bootorder(\@bootorder);
+ $modified->{boot} = 1;
+ }
}
} elsif ($opt =~ m/^serial\d+/) {
if ((!defined($conf->{$opt}) || $conf->{$opt} eq 'socket') && $param->{$opt} eq 'socket') {
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH qemu-server] api2: only add ide drives for non-legacy bootorders
2021-08-05 11:53 [pve-devel] [PATCH qemu-server] api2: only add ide drives for non-legacy bootorders Dominik Csapak
@ 2021-08-05 12:08 ` Fabian Grünbichler
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2021-08-05 12:08 UTC (permalink / raw)
To: Proxmox VE development discussion
thanks!
On August 5, 2021 1:53 pm, Dominik Csapak wrote:
> @bootorder only contains entries for non-legacy bootorder entries,
> but the default one contains all cdroms anyway, and if the user
> explicitely disabled cdroms, it is ok to not add them back
> for the new cdrom drive.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> view with -w to see the actual change
> PVE/API2/Qemu.pm | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 94cc0d2..ef0d877 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -1358,12 +1358,15 @@ my $update_vm_api = sub {
>
> &$create_disks($rpcenv, $authuser, $conf->{pending}, $arch, $storecfg, $vmid, undef, {$opt => $param->{$opt}});
>
> - # append new CD drives to bootorder to mark them bootable
> - my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
> - if (PVE::QemuServer::drive_is_cdrom($drive, 1) && !grep(/^$opt$/, @bootorder)) {
> - push @bootorder, $opt;
> - $conf->{pending}->{boot} = PVE::QemuServer::print_bootorder(\@bootorder);
> - $modified->{boot} = 1;
> + # default legacy boot order implies all cdroms anyway
> + if (@bootorder) {
> + # append new CD drives to bootorder to mark them bootable
> + my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
> + if (PVE::QemuServer::drive_is_cdrom($drive, 1) && !grep(/^$opt$/, @bootorder)) {
> + push @bootorder, $opt;
> + $conf->{pending}->{boot} = PVE::QemuServer::print_bootorder(\@bootorder);
> + $modified->{boot} = 1;
> + }
> }
> } elsif ($opt =~ m/^serial\d+/) {
> if ((!defined($conf->{$opt}) || $conf->{$opt} eq 'socket') && $param->{$opt} eq 'socket') {
> --
> 2.30.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-05 12:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 11:53 [pve-devel] [PATCH qemu-server] api2: only add ide drives for non-legacy bootorders Dominik Csapak
2021-08-05 12:08 ` [pve-devel] applied: " Fabian Grünbichler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox