[pve-devel] [PATCH manager v2 3/8] gui: add qemu/SystemEdit

Dominik Csapak d.csapak at proxmox.com
Thu Mar 28 16:25:06 CET 2019


contains the inputpanel for the coming system tab in the vm creation
wizard, where the user can configure the vm system hardware like
the scsi controller, display, etc.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* add efi disk creation logic
* fix typo

 www/manager6/Makefile           |   1 +
 www/manager6/Utils.js           |   4 ++
 www/manager6/qemu/SystemEdit.js | 156 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 161 insertions(+)
 create mode 100644 www/manager6/qemu/SystemEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index f1d59c46..962a3f4d 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -151,6 +151,7 @@ JSSRC= 				                 	\
 	qemu/CIDriveEdit.js				\
 	qemu/SSHKey.js					\
 	qemu/IPConfigEdit.js				\
+	qemu/SystemEdit.js				\
 	lxc/Summary.js					\
 	lxc/Network.js					\
 	lxc/Resources.js				\
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 50e8c297..d8e6f275 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -228,6 +228,10 @@ Ext.define('PVE.Utils', { utilities: {
 	return agentstring;
     },
 
+    render_qemu_machine: function(value) {
+	return value || (Proxmox.Utils.defaultText + ' (i440fx)');
+    },
+
     render_qemu_bios: function(value) {
 	if (!value) {
 	    return Proxmox.Utils.defaultText + ' (SeaBIOS)';
diff --git a/www/manager6/qemu/SystemEdit.js b/www/manager6/qemu/SystemEdit.js
new file mode 100644
index 00000000..ce4737bc
--- /dev/null
+++ b/www/manager6/qemu/SystemEdit.js
@@ -0,0 +1,156 @@
+/*jslint confusion: true*/
+Ext.define('PVE.qemu.SystemInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pveQemuSystemPanel',
+
+    onlineHelp: 'qm_virtual_machines_settings',
+
+    viewModel: {
+	data: {
+	    efi: false,
+	    addefi: true
+	},
+
+	formulas: {
+	    efidisk: function(get) {
+		return get('efi') && get('addefi');
+	    }
+	}
+    },
+
+    onGetValues: function(values) {
+	if (values.vga && values.vga.substr(0,6) === 'serial') {
+	    values['serial' + values.vga.substr(6,1)] = 'socket';
+	}
+
+	var efidrive = {};
+	if (values.hdimage) {
+	    efidrive.file = values.hdimage;
+	} else if (values.hdstorage) {
+	    efidrive.file = values.hdstorage + ":1";
+	}
+
+	if (values.diskformat) {
+	    efidrive.format = values.diskformat;
+	}
+
+	delete values.hdimage;
+	delete values.hdstorage;
+	delete values.diskformat;
+
+	if (efidrive.file) {
+	    values.efidisk0 = PVE.Parser.printQemuDrive(efidrive);
+	}
+
+	return values;
+    },
+
+    controller: {
+	xclass: 'Ext.app.ViewController',
+
+	scsihwChange: function(field, value) {
+	    var me = this;
+	    if (me.getView().insideWizard) {
+		me.getViewModel().set('current.scsihw', value);
+	    }
+	},
+
+	biosChange: function(field, value) {
+	    var me = this;
+	    if (me.getView().insideWizard) {
+		me.getViewModel().set('efi', value === 'ovmf');
+	    }
+	},
+
+	control: {
+	    'pveScsiHwSelector': {
+		change: 'scsihwChange'
+	    },
+	    'pveQemuBiosSelector': {
+		change: 'biosChange'
+	    }
+	}
+    },
+
+    column1: [
+	{
+	    xtype: 'proxmoxKVComboBox',
+	    value: '__default__',
+	    deleteEmpty: false,
+	    fieldLabel: gettext('Graphic card'),
+	    name: 'vga',
+	    comboItems: PVE.Utils.kvm_vga_driver_array()
+	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    name: 'agent',
+	    uncheckedValue: 0,
+	    defaultValue: 0,
+	    deleteDefaultValue: true,
+	    fieldLabel: gettext('Qemu Agent')
+	}
+    ],
+
+    column2: [
+	{
+	    xtype: 'pveScsiHwSelector',
+	    name: 'scsihw',
+	    value: '__default__',
+	    bind: {
+		value: '{current.scsihw}'
+	    },
+	    fieldLabel: gettext('SCSI Controller')
+	}
+    ],
+
+    advancedColumn1: [
+	{
+	    xtype: 'pveQemuBiosSelector',
+	    name: 'bios',
+	    value: '__default__',
+	    fieldLabel: 'BIOS'
+	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    name: 'eficb',
+	    reference: 'eficb',
+	    bind: {
+		value: '{addefi}',
+		hidden: '{!efi}',
+		disabled: '{!efi}'
+	    },
+	    hidden: true,
+	    disabled: true,
+	    fieldLabel: gettext('Add EFI Disk')
+	},
+	{
+	    xtype: 'pveDiskStorageSelector',
+	    name: 'efidisk0',
+	    reference: 'efidisk',
+	    storageContent: 'images',
+	    bind: {
+		nodename: '{nodename}',
+		hidden: '{!efi}',
+		disabled: '{!efidisk}'
+	    },
+	    autoSelect: false,
+	    disabled: true,
+	    hidden: true,
+	    hideSize: true
+	}
+    ],
+
+    advancedColumn2: [
+	{
+	    xtype: 'proxmoxKVComboBox',
+	    name: 'machine',
+	    value: '__default__',
+	    fieldLabel: gettext('Machine'),
+	    comboItems: [
+		['__default__', PVE.Utils.render_qemu_machine('')],
+		['q35', 'q35']
+	    ]
+	}
+    ]
+
+});
-- 
2.11.0





More information about the pve-devel mailing list