From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 4B8B51FF137 for ; Tue, 03 Feb 2026 11:22:18 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F3389197DB; Tue, 3 Feb 2026 11:22:02 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH manager v2 05/17] ui: qemu: add architecture specific defaults and helpers Date: Tue, 3 Feb 2026 11:00:10 +0100 Message-ID: <20260203102118.1430545-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260203102118.1430545-1-d.csapak@proxmox.com> References: <20260203102118.1430545-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.032 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 Message-ID-Hash: X6XNZQPQV3XPZ4HHSGOQKUU46FUJFPO5 X-Message-ID-Hash: X6XNZQPQV3XPZ4HHSGOQKUU46FUJFPO5 X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Introduce a new singleton 'PVE.qemu.Architecture', that contains nearly all architecture specific settings such as renderers, defaults and filters. This provides a single place to modify architecture specific behavior, or add new architectures the gui should handle. Signed-off-by: Dominik Csapak --- www/manager6/Makefile | 1 + www/manager6/qemu/Architecture.js | 104 ++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 www/manager6/qemu/Architecture.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 8857045c..8f9c53c4 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -5,6 +5,7 @@ BIOME ?= proxmox-biome JSSRC= \ Parser.js \ StateProvider.js \ + qemu/Architecture.js \ Utils.js \ UIOptions.js \ Toolkit.js \ diff --git a/www/manager6/qemu/Architecture.js b/www/manager6/qemu/Architecture.js new file mode 100644 index 00000000..21aabd26 --- /dev/null +++ b/www/manager6/qemu/Architecture.js @@ -0,0 +1,104 @@ +/* This file defines the helpers, defaults and limtis for various vCPU architectures, such + * as x86_64, and aarch64. + * + * To add a new architecture, add the respective entry in the defaults/renderers and selection. + */ +Ext.define('PVE.qemu.Architecture', { + singleton: true, + + selection: [ + ['__default__', `${Proxmox.Utils.defaultText} (${gettext('Host Architecture')})`], + ['x86_64', gettext('x86 (64-bit)')], + ['aarch64', gettext('ARM (64-bit)')], + ], + + // filter for PVE.Utils.kvm_ostypes + kvmOSTypes: { + x86_64: { + bases: undefined, // include all + ostypes: undefined, // include all + }, + aarch64: { + bases: ['Linux', 'Other'], + ostypes: ['l26', 'other'], + }, + }, + + defaultProcessorModel: { + x86_64: 'x86-64-v2-AES', + aarch64: 'cortex-a57', + }, + + defaultMachines: { + x86_64: 'pc', + aarch64: 'virt', + }, + + defaultCDDrive: { + x86_64: ['ide', 2], + aarch64: ['scsi', 2], + }, + + allowedScsiHw: { + x86_64: [ + '__default__', + 'lsi', + 'lsi53c810', + 'megasas', + 'virtio-scsi-pci', + 'virtio-scsi-single', + 'pvscsi', + ], + aarch64: ['virtio-scsi-pci', 'virtio-scsi-single'], + }, + + allowedMachines: { + x86_64: ['__default__', 'q35'], // __default__ is i440fx + aarch64: ['__default__'], // __default__ is virt + }, + + allowedBusses: { + x86_64: ['ide', 'sata', 'virtio', 'scsi', 'unused'], + aarch64: ['sata', 'virtio', 'scsi', 'unused'], + }, + + allowedFirmware: { + x86_64: ['__default__', 'seabios', 'ovmf'], // default is seabios + aarch64: ['ovmf'], + }, + + render_vcpu_architecture: function (value) { + switch (value ?? '') { + case '': + case 'x86_64': + return gettext('x86 (64-bit)'); + case 'aarch64': + return gettext('ARM (64-bit)'); + default: + return Proxmox.Utils.unknownText; + } + }, + + // returns the resulting architecture from a given arch and + // the nodename, in case the architecture is set to default or empty + getNodeArchitecture: function (architecture, nodename) { + if (architecture === '__default__') { + architecture = undefined; + } + + let hostArchitecture = PVE.data.ResourceStore.getNodeById(nodename)?.data.architecture; + + return architecture ?? hostArchitecture ?? 'x86_64'; + }, + + // returns if the given architecture is the native host architecture of the given nodename + isHostArchitecture: function (architecture, nodename) { + if (architecture === '__default__') { + architecture = undefined; + } + + let hostArchitecture = PVE.data.ResourceStore.getNodeById(nodename)?.data.architecture; + + return (architecture ?? 'x86_64') === (hostArchitecture ?? 'x86_64'); + }, +}); -- 2.47.3