[pve-devel] [PATCH qemu-server] bootorder: fix double entry on cdrom edit

Dominik Csapak d.csapak at proxmox.com
Fri Jul 30 13:28:39 CEST 2021


We unconditionally added an entry into the bootorder whenever we
edited the drive, even if it was already in there. Instead we only want to do
that if the bootorder list does not contain it already.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Qemu.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 6038b28..94cc0d2 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1360,7 +1360,7 @@ my $update_vm_api  = sub {
 
 		    # 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)) {
+		    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;
-- 
2.30.2






More information about the pve-devel mailing list