Since we started in PVE 4.3 to autoselect SCSI for new Linux VMs, it was not clear that this controller actually uses a pv virtio driver, which is confusing for users.
See for example: https://forum.proxmox.com/threads/proxmox-hypervisor-scsi-or-virtio.36506/#post-179056 The vm configuration is only available to components of an InputPanel after the components has been by the input panel, so we rebuild the backing store when we get the vmconfig. Note that we don't extend KVComboBox anymore because we need to set the store ourselves and not via ComboItems. We were never using KVComboBox functionality anyway since this combobox was never empty nor invalid. --- www/manager6/form/BusTypeSelector.js | 58 +++++++++++++++++++++++++++------ www/manager6/form/ControllerSelector.js | 8 ++--- www/manager6/qemu/HDEdit.js | 3 ++ 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/www/manager6/form/BusTypeSelector.js b/www/manager6/form/BusTypeSelector.js index ae7c327e..afcbb1eb 100644 --- a/www/manager6/form/BusTypeSelector.js +++ b/www/manager6/form/BusTypeSelector.js @@ -1,20 +1,58 @@ Ext.define('PVE.form.BusTypeSelector', { - extend: 'PVE.form.KVComboBox', + extend: 'Ext.form.field.ComboBox', alias: 'widget.pveBusSelector', - - noVirtIO: false, + allowBlank: false, + editable: false, - initComponent: function() { - var me = this; + // ordering matters + busList: [ + ['ide', 'IDE'], + ['virtio', 'VirtIO'], + ['scsi', 'SCSI'], + ['sata', 'SATA'] + ], + + getBusTypes: function() { + return this.busList.map(function (el) { + return el[0]; + }); + }, - me.comboItems = [['ide', 'IDE'], ['sata', 'SATA']]; + describeBus: function(bus, scsihw) { + var desc; + var i; - if (!me.noVirtIO) { - me.comboItems.push(['virtio', 'VirtIO']); + if (bus === 'scsi') { + desc = this.busList[2][1] + ' - ' + PVE.Utils.render_scsihw(scsihw); + return desc; } - me.comboItems.push(['scsi', 'SCSI']); + for (i = 0; i < this.busList.length; i++) { + if (bus === this.busList[i][0]) { + desc = this.busList[i][1]; + return desc; + } + } + }, - me.callParent(); + // once we know the vmconfig, rebuild the store with scsihw full description + buildStore: function(busses, scsihw) { + var me = this; + var store = []; + Ext.Array.forEach(busses, function(bus) { + store.push([bus, me.describeBus(bus, scsihw)]); + }); + me.setStore(store); + return me; + }, + + buildDefaultStore: function(scsihw) { + var me = this; + this.buildStore(me.getBusTypes(), scsihw); + return me; + }, + + initComponent: function() { + this.buildDefaultStore().callParent(); } }); diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js index 489b97de..a2298fd8 100644 --- a/www/manager6/form/ControllerSelector.js +++ b/www/manager6/form/ControllerSelector.js @@ -57,12 +57,13 @@ Ext.define('PVE.form.ControllerSelector', { me.vmconfig = Ext.apply({}, vmconfig); - var clist = ['ide', 'virtio', 'scsi', 'sata']; var bussel = me.down('field[name=controller]'); var deviceid = me.down('field[name=deviceid]'); + var clist = bussel.getBusTypes(); if (me.noVirtIO) { - clist = ['ide', 'scsi', 'sata']; + clist.splice(1, 1); // remove virtio blk + bussel.buildStore(clist, me.vmconfig.scsihw); if (autoSelect === 'cdrom' && !Ext.isDefined(me.vmconfig.ide2)) { bussel.setValue('ide'); deviceid.setValue(2); @@ -72,6 +73,7 @@ Ext.define('PVE.form.ControllerSelector', { // in most cases we want to add a disk to the same controller // we previously used clist = me.sortByPreviousUsage(me.vmconfig, clist); + bussel.buildStore(clist, me.vmconfig.scsihw); } Ext.Array.each(clist, function(controller) { @@ -102,8 +104,6 @@ Ext.define('PVE.form.ControllerSelector', { xtype: 'pveBusSelector', name: 'controller', value: PVE.qemu.OSDefaults.generic.busType, - noVirtIO: me.noVirtIO, - allowBlank: false, flex: 2, listeners: { change: function(t, value) { diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js index 2874bfa8..9fbbc763 100644 --- a/www/manager6/qemu/HDEdit.js +++ b/www/manager6/qemu/HDEdit.js @@ -17,6 +17,9 @@ Ext.define('PVE.qemu.HDInputPanel', { onControllerChange: function(field) { var value = field.getValue(); + if (!value) { + return; + } var allowIOthread = value.match(/^(virtio|scsi)/); this.lookup('iothread').setDisabled(!allowIOthread); -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel