[pve-devel] [PATCH manager v2 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
Thu Jul 21 11:10:46 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..cc8cf37 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: {
+	    'radiogroup': {
+		    change: function(field, value) {
+			var me = this;
+			if (!me.getView().insideWizard) {
+			    return;
+			}
+
+			var targetValues;
+
+			if (PVE.qemu.OSDefaults[value.ostype]) {
+			    targetValues = PVE.qemu.OSDefaults[value.ostype];
+			} else {
+			    targetValues = PVE.qemu.OSDefaults.generic;
+			}
+
+			me.setWidget('pveBusSelector', targetValues.busType);
+			me.setWidget('pveNetworkCardSelector', targetValues.networkCard);
+		    }
+	    }
+	},
+	setWidget: function(widget, newValue) {
+	    // 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) {
+		widgets[0].setValue(newValue);
+	    } else {
+		throw 'non unique widget :' + widget + ' in Wizard';
+	    }
+	}
+    },
 
     initComponent : function() {
 	var me = this;
-- 
2.1.4




More information about the pve-devel mailing list