[pve-devel] [pve-manager 4/4] Set VirtIO drivers as default when using the Qemu Wizard and the OS Type is Linux
Emmanuel Kasper
e.kasper at proxmox.com
Wed Jul 6 10:32:10 CEST 2016
virtio-blk and virtio-net have been in the kernel since 2.6.25 released in 2008, so
it safe to assume distributions using the l26 type will have these drivers.
---
www/manager6/qemu/CreateWizard.js | 3 ++-
www/manager6/qemu/OSTypeEdit.js | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index 91bff38..08b7899 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -97,7 +97,8 @@ Ext.define('PVE.qemu.CreateWizard', {
},
{
title: gettext('OS'),
- xtype: 'pveQemuOSTypePanel'
+ xtype: 'pveQemuOSTypePanel',
+ insideWizard: true,
},
cdpanel,
hdpanel,
diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index 2fc8997..278faef 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -2,6 +2,42 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
extend: 'PVE.panel.InputPanel',
alias: 'widget.pveQemuOSTypePanel',
onlineHelp: 'chapter-qm.html#_os_settings',
+ insideWizard: false,
+
+ controller: {
+ xclass: 'Ext.app.ViewController',
+ control: {
+ 'field[inputValue=l26]': {
+ change: function(field, selected) {
+ var me = this;
+ if (!me.getView().insideWizard) {
+ return;
+ }
+ var busDefault = PVE.qemu.OSDefaults.busType;
+ var busLinux = PVE.qemu.l26Defaults.busType;
+ var nicDefault = PVE.qemu.OSDefaults.networkCard;
+ var nicLinux = PVE.qemu.l26Defaults.networkCard;
+
+ me.setWidget('pveBusSelector', selected, busDefault, busLinux);
+ me.setWidget('pveNetworkCardSelector', selected, nicDefault, nicLinux);
+ }
+ }
+ },
+ setWidget: function(widget, selected, defaultValue, localValue) {
+ // changing a widget is safe only if ComponentQuery.query returns us
+ // a single value array
+ var widgets = Ext.ComponentQuery.query('pveQemuCreateWizard ' + widget);
+ if (widgets.length === 1) {
+ if(selected) {
+ widgets[0].setValue(localValue);
+ } else {
+ widgets[0].setValue(defaultValue);
+ }
+ } else {
+ throw 'non unique widget :' + widget + ' in Wizard';
+ }
+ }
+ },
initComponent : function() {
var me = this;
--
2.1.4
More information about the pve-devel
mailing list