From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7707B9B7F5 for ; Tue, 21 Nov 2023 09:35:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5953849AA for ; Tue, 21 Nov 2023 09:35:53 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 21 Nov 2023 09:35:52 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6B7AF40A69 for ; Tue, 21 Nov 2023 09:35:52 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Tue, 21 Nov 2023 09:35:51 +0100 Message-Id: <20231121083551.1016184-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH manager] ui: qemu wizard: use better boot order for second cd drive X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Nov 2023 08:35:53 -0000 in the case we add a second cd drive (for windows), we don't want the backend logic to only include the first one, since we cannot know which is bootable and which is (probably) the virtio iso. so instead, emulate the backend logic for the wizard but include both cd drives in that case, otherwise let the backend decide like before Signed-off-by: Dominik Csapak --- this is a follow up to "ui: vm wizard: allow second iso for windows vms": https://lists.proxmox.com/pipermail/pve-devel/2023-November/060546.html www/manager6/qemu/CreateWizard.js | 49 ++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js index 443e42c6..375f0c66 100644 --- a/www/manager6/qemu/CreateWizard.js +++ b/www/manager6/qemu/CreateWizard.js @@ -26,6 +26,41 @@ Ext.define('PVE.qemu.CreateWizard', { subject: gettext('Virtual Machine'), + // fot the special case that we have 2 cdrom drives + // + // emulates part of the backend bootorder logic, but includes all + // cdrom drives since we don't know which one the user put in a bootable iso + // and hardcodes the known values (ide0/2, net0) + calculateBootOrder: function(values) { + // user selected windows + second cdrom + if (values.ide0 && values.ide0.match(/media=cdrom/)) { + let disk; + PVE.Utils.forEachBus(['ide', 'scsi', 'virtio', 'sata'], (type, id) => { + let confId = type + id; + if (!values[confId]) { + return undefined; + } + if (values[confId].match(/media=cdrom/)) { + return undefined; + } + disk = confId; + return false; // abort loop + }); + + let order = []; + if (disk) { + order.push(disk); + } + order.push('ide0', 'ide2'); + if (values.net0) { + order.push('net0'); + } + + return `order=${order.join(';')}`; + } + return undefined; + }, + items: [ { xtype: 'inputpanel', @@ -228,8 +263,15 @@ Ext.define('PVE.qemu.CreateWizard', { ], listeners: { show: function(panel) { - var kv = this.up('window').getValues(); + let wizard = this.up('window'); + var kv = wizard.getValues(); var data = []; + + let boot = wizard.calculateBootOrder(kv); + if (boot) { + kv.boot = boot; + } + Ext.Object.each(kv, function(key, value) { if (key === 'delete') { // ignore return; @@ -254,6 +296,11 @@ Ext.define('PVE.qemu.CreateWizard', { var nodename = kv.nodename; delete kv.nodename; + let boot = wizard.calculateBootOrder(kv); + if (boot) { + kv.boot = boot; + } + Proxmox.Utils.API2Request({ url: '/nodes/' + nodename + '/qemu', waitMsgTarget: wizard, -- 2.30.2