[pve-devel] [PATCH manager v2 2/4] Add PVE.qemu.OSDefaults class to hold OS-dependant wizard defaults

Emmanuel Kasper e.kasper at proxmox.com
Thu Jul 21 11:10:44 CEST 2016


---
 www/manager6/Makefile           |  1 +
 www/manager6/qemu/OSDefaults.js | 58 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 www/manager6/qemu/OSDefaults.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 92969b3..e5b3667 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -123,6 +123,7 @@ JSSRC= 				                 	\
 	qemu/Monitor.js					\
 	qemu/Summary.js					\
 	qemu/OSTypeEdit.js				\
+	qemu/OSDefaults.js				\
 	qemu/ProcessorEdit.js				\
 	qemu/BootOrderEdit.js				\
 	qemu/MemoryEdit.js				\
diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
new file mode 100644
index 0000000..3a834fa
--- /dev/null
+++ b/www/manager6/qemu/OSDefaults.js
@@ -0,0 +1,58 @@
+/*
+ * This class holds performance *recommended* settings for the PVE Qemu wizards
+ * the *mandatory* settings are set in the PVE::QemuServer
+ * config_to_command sub
+ * We store this here until we get the data from the API server
+*/
+
+// this is how you would add an hypothetic FreeBSD > 10 entry
+//
+//virtio-blk is stable but virtIO net still
+//   problematic as of 10.3
+// see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165059
+//	addOS({
+//	    parent: 'generic', // inherits defaults
+//	    pveOS: 'freebsd10', // must match a radiofield in OSTypeEdit.js
+//	    busType: 'virtio' // must match a pveBusController value
+//			    // networkCard muss match a pveNetworkCardSelector
+
+
+Ext.define('PVE.qemu.OSDefaults', {
+    singleton: true, // will also force creation when loaded
+
+    constructor: function() {
+	var me = this;
+
+	var addOS = function(settings) {
+		if (me.hasOwnProperty(settings.parent)) {
+		    var child = Ext.clone(me[settings.parent]);
+		    me[settings.pveOS] = Ext.apply(child, settings);
+
+		} else {
+		    throw("Could not find your genitor");
+		}
+	    };
+
+	// default values
+	me.generic = {
+	    busType: 'ide',
+	    networkCard: 'e1000'
+	};
+
+	// both of them are in kernel since 2.6.25
+	addOS({
+	    pveOS: 'l26',
+	    parent : 'generic',
+	    busType: 'virtio',
+	    networkCard: 'virtio'
+	});
+
+	// recommandation from http://wiki.qemu.org/Windows2000
+	addOS({
+	    pveOS: 'w2k',
+	    parent : 'generic',
+	    networkCard: 'rtl8139'
+	});
+
+    }
+});
-- 
2.1.4





More information about the pve-devel mailing list