[pve-devel] [PATCH 4/5] add migrate_all form

Alexandre Derumier aderumier at odiso.com
Mon Feb 9 09:43:58 CET 2015


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/Makefile             |    1 +
 www/manager/window/MigrateAll.js |   84 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 www/manager/window/MigrateAll.js

diff --git a/www/manager/Makefile b/www/manager/Makefile
index 6ff03cb..9ffe3b4 100644
--- a/www/manager/Makefile
+++ b/www/manager/Makefile
@@ -113,6 +113,7 @@ JSSRC= 				                 	\
 	node/Config.js					\
 	qemu/StatusView.js				\
 	window/Migrate.js				\
+	window/MigrateAll.js				\
 	qemu/Monitor.js					\
 	qemu/Summary.js					\
 	qemu/OSTypeEdit.js				\
diff --git a/www/manager/window/MigrateAll.js b/www/manager/window/MigrateAll.js
new file mode 100644
index 0000000..fb677f5
--- /dev/null
+++ b/www/manager/window/MigrateAll.js
@@ -0,0 +1,84 @@
+Ext.define('PVE.window.MigrateAll', {
+    extend: 'Ext.window.Window',
+
+    resizable: false,
+
+    migrate: function(target, maxworkers) {
+	var me = this;
+	PVE.Utils.API2Request({
+	    params: { target: target, maxworkers: maxworkers},
+	    url: '/nodes/' + me.nodename + '/' + "/migrateall",
+	    waitMsgTarget: me,
+	    method: 'POST',
+	    failure: function(response, opts) {
+		Ext.Msg.alert('Error', response.htmlStatus);
+	    },
+	    success: function(response, options) {
+		var upid = response.result.data;
+
+		var win = Ext.create('PVE.window.TaskViewer', {
+		    upid: upid
+		});
+		win.show();
+		me.close();
+	    }
+	});
+    },
+
+    initComponent : function() {
+	var me = this;
+
+	if (!me.nodename) {
+	    throw "no node name specified";
+	}
+
+	me.formPanel = Ext.create('Ext.form.Panel', {
+	    bodyPadding: 10,
+	    border: false,
+	    fieldDefaults: {
+		labelWidth: 100,
+		anchor: '100%'
+	    },
+	    items: [
+		{
+		    xtype: 'PVE.form.NodeSelector',
+		    name: 'target',
+		    fieldLabel: 'Target node',
+		    allowBlank: false,
+		    onlineValidator: true
+		},
+		{
+		    xtype: 'numberfield',
+		    name: 'maxworkers',
+		    minValue: 1,
+		    maxValue: 100,
+		    value: 1,
+		    fieldLabel: 'Parallel jobs',
+		    allowBlank: false
+		},
+	    ]
+	});
+
+	var form = me.formPanel.getForm();
+
+	var submitBtn = Ext.create('Ext.Button', {
+	    text: 'Migrate',
+	    handler: function() {
+		var values = form.getValues();
+		me.migrate(values.target, values.maxworkers);
+	    }
+	});
+
+	Ext.apply(me, {
+	    title: "Migrate All VMs",
+	    width: 350,
+	    modal: true,
+	    layout: 'auto',
+	    border: false,
+	    items: [ me.formPanel ],
+	    buttons: [ submitBtn ]
+	});
+
+	me.callParent();
+    }
+});
-- 
1.7.10.4




More information about the pve-devel mailing list