This enables us to have different default for different architectures, e.g. using 'ovmf' for 'aarch64' for everything.
The external interface should be compatible, so there is nothing to do for current callers. Signed-off-by: Dominik Csapak <[email protected]> --- www/manager6/qemu/OSDefaults.js | 76 ++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js index bcebd0b3..d921ab53 100644 --- a/www/manager6/qemu/OSDefaults.js +++ b/www/manager6/qemu/OSDefaults.js @@ -24,8 +24,17 @@ Ext.define('PVE.qemu.OSDefaults', { let addOS = function (settings) { if (Object.hasOwn(settings, 'parent')) { - let child = Ext.clone(me[settings.parent]); - me[settings.pveOS] = Ext.apply(child, settings); + let architectures = settings.architectures; + delete settings.architectures; + + let child = { + x86_64: Ext.apply({}, settings, me[settings.parent].x86_64), + }; + + for (const arch of Object.keys(architectures ?? {})) { + child[arch] = Ext.apply({}, architectures[arch], me[settings.parent][arch]); + } + me[settings.pveOS] = child; } else { throw 'Could not find your genitor'; } @@ -33,16 +42,33 @@ Ext.define('PVE.qemu.OSDefaults', { // default values me.generic = { - busType: 'ide', - networkCard: 'e1000', - busPriority: { - ide: 4, - sata: 3, - scsi: 2, - virtio: 1, + x86_64: { + busType: 'ide', + networkCard: 'e1000', + busPriority: { + ide: 4, + sata: 3, + scsi: 2, + virtio: 1, + }, + scsihw: 'virtio-scsi-single', + cputype: 'x86-64-v2-AES', + }, + + aarch64: { + // aarch64 has no ide, and ovmf can't boot from sata + busType: 'scsi', + networkCard: 'e1000', + busPriority: { + scsi: 4, + sata: 3, + virtio: 2, + ide: 1, + }, + scsihw: 'virtio-scsi-single', + cputype: 'neoverse-n2', + bios: 'ovmf', }, - scsihw: 'virtio-scsi-single', - cputype: 'x86-64-v2-AES', }; // virtio-net is in kernel since 2.6.25 @@ -58,6 +84,18 @@ Ext.define('PVE.qemu.OSDefaults', { ide: 1, }, networkCard: 'virtio', + + architectures: { + aarch64: { + busPriority: { + scsi: 4, + virtio: 2, + sata: 2, + ide: 1, + }, + networkCard: 'virtio', + }, + }, }); // recommendation from http://wiki.qemu.org/Windows2000 @@ -73,12 +111,18 @@ Ext.define('PVE.qemu.OSDefaults', { parent: 'w2k', }); - me.getDefaults = function (ostype) { - if (PVE.qemu.OSDefaults[ostype]) { - return PVE.qemu.OSDefaults[ostype]; - } else { - return PVE.qemu.OSDefaults.generic; + me.getDefaults = function (ostype, arch = 'x86_64') { + if (!PVE.qemu.OSDefaults[ostype]) { + ostype = 'generic'; } + + let os = PVE.qemu.OSDefaults[ostype]; + if (os[arch]) { + return os[arch]; + } + + // default + return os.x86_64; }; }, }); -- 2.47.3
