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 CA75C1FF142 for ; Mon, 02 Mar 2026 14:28:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4239F31FE3; Mon, 2 Mar 2026 14:29:25 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH manager v3 05/18] ui: qemu: add architecture specific defaults and helpers Date: Mon, 2 Mar 2026 14:20:53 +0100 Message-ID: <20260302132913.3169037-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260302132913.3169037-1-d.csapak@proxmox.com> References: <20260302132913.3169037-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.035 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: V7OCCJ76VZEZZEHDH7GGG6PZVU2CVORU X-Message-ID-Hash: V7OCCJ76VZEZZEHDH7GGG6PZVU2CVORU 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 | 106 ++++++++++++++++++++++++++++++ 2 files changed, 107 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..f7de1ebe --- /dev/null +++ b/www/manager6/qemu/Architecture.js @@ -0,0 +1,106 @@ +/* This file defines the helpers, defaults and limits 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; + } + }, + + getNodeArchitecture: function (nodename) { + let hostArch = PVE.data.ResourceStore.getNodeById(nodename)?.data['host-arch']; + return PVE.qemu.Architecture.normalizeArchitecture(hostArch) ?? 'x86_64'; + }, + + normalizeArchitecture: function (architecture) { + if (!architecture?.length || architecture === '__default__') { + return undefined; + } + return architecture; + }, + // returns the resulting architecture from a given arch and + // the nodename, in case the architecture is set to default or empty + getGuestArchitecture: function (architecture, nodename) { + let hostArch = PVE.qemu.Architecture.getNodeArchitecture(nodename); + return PVE.qemu.Architecture.normalizeArchitecture(architecture) ?? hostArch; + }, + + // returns if the given architecture is the native host architecture of the given nodename + isHostArchitecture: function (architecture, nodename) { + architecture = PVE.qemu.Architecture.normalizeArchitecture(architecture); + let hostArch = PVE.qemu.Architecture.getNodeArchitecture(nodename); + return (architecture ?? hostArch) === hostArch; + }, +}); -- 2.47.3