[pve-devel] [PATCH v2 pve-manager 1/1] qemu: processor : set x86-64-v2-AES as default cputype for create wizard

Fiona Ebner f.ebner at proxmox.com
Tue Jun 6 14:47:49 CEST 2023


Am 02.06.23 um 12:05 schrieb Alexandre Derumier:
> ---

Missing your Signed-off-by

>  www/manager6/qemu/OSDefaults.js    |  1 +
>  www/manager6/qemu/ProcessorEdit.js | 13 +++++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
> index 5e588a58..58bc76ff 100644
> --- a/www/manager6/qemu/OSDefaults.js
> +++ b/www/manager6/qemu/OSDefaults.js
> @@ -43,6 +43,7 @@ Ext.define('PVE.qemu.OSDefaults', {
>  		    virtio: 1,
>  	    },
>  	    scsihw: 'virtio-scsi-single',
> +	    cputype: 'x86-64-v2-AES',
>  	};
>  
>         // virtio-net is in kernel since 2.6.25
> diff --git a/www/manager6/qemu/ProcessorEdit.js b/www/manager6/qemu/ProcessorEdit.js
> index b845ff66..727d1679 100644
> --- a/www/manager6/qemu/ProcessorEdit.js
> +++ b/www/manager6/qemu/ProcessorEdit.js
> @@ -29,6 +29,19 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
>  
>  	    viewModel.set('userIsRoot', Proxmox.UserName === 'root at pam');
>  	},
> +	control: {
> +	    '#': {
> +		afterrender: 'setCputype',
> +	    },
> +	},
> +	setCputype: function() {
> +	    let me = this;
> +	    let view = me.getView();
> +	    let cputype = view.down('CPUModelSelector[name=cputype]');
> +	    if (view.insideWizard) {
> +		cputype.setValue(PVE.qemu.OSDefaults.generic.cputype);

You always use the generic one, but if we ever override cputype for a
more specific OSDefaults definition, it'll be wrong.

To avoid that, you can use getDefaults() like
www/manager6/qemu/NetworkEdit.js does:

>                     let ostype = me.vmconfig.ostype;
>                     let defaults = PVE.qemu.OSDefaults.getDefaults(ostype);
>                     let data = {
>                         model: defaults.networkCard,
>                     };
> 
>                     ipanel.setNetwork(me.confid, data);





More information about the pve-devel mailing list