]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
implemente migrate UI
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 15 Sep 2011 09:55:24 +0000 (11:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 15 Sep 2011 09:55:24 +0000 (11:55 +0200)
www/manager/Makefile
www/manager/qemu/Migrate.js [new file with mode: 0644]
www/manager/qemu/Summary.js
www/manager/window/TaskViewer.js

index 472f1262d450801487f315ab3272a1d0a573f7eb..a5bb0362c131c76fa91067f61da88d03d893af15 100644 (file)
@@ -63,6 +63,7 @@ JSSRC=                                                        \
        node/Tasks.js                                   \
        node/Config.js                                  \
        qemu/StatusView.js                              \
+       qemu/Migrate.js                                 \
        qemu/Summary.js                                 \
        qemu/OSTypeEdit.js                              \
        qemu/ProcessorEdit.js                           \
diff --git a/www/manager/qemu/Migrate.js b/www/manager/qemu/Migrate.js
new file mode 100644 (file)
index 0000000..bcf7be5
--- /dev/null
@@ -0,0 +1,95 @@
+Ext.define('PVE.qemu.Migrate', {
+    extend: 'Ext.window.Window',
+
+    resizable: false,
+
+    migrate: function(vmid, nodename, target, online) {
+       var me = this;
+       PVE.Utils.API2Request({
+           params: { target: target, online: online },
+           url: '/nodes/' + nodename + '/qemu/' + vmid + "/migrate",
+           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();
+
+               me.workspace.selectById('root');
+           }
+       });
+    },
+
+    initComponent : function() {
+       var me = this;
+
+       var nodename = me.pveSelNode.data.node;
+       if (!nodename) {
+           throw "no node name specified";
+       }
+
+       var vmid = me.pveSelNode.data.vmid;
+       if (!vmid) {
+           throw "no VM ID specified";
+       }
+
+       if (!me.workspace) {
+           throw "no Workspace 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: 'pvecheckbox',
+                   name: 'online',
+                   uncheckedValue: 0,
+                   defaultValue: 0,
+                   fieldLabel: 'Online'
+               }
+           ]
+       });
+
+       var form = me.formPanel.getForm();
+
+       var submitBtn = Ext.create('Ext.Button', {
+           text: 'Migrate',
+           handler: function() {
+               var values = form.getValues();
+               console.log("STARTMIGRATE " + vmid + " " + values.target + " " + values.online);
+               me.migrate(vmid, nodename, values.target, values.online);
+           }
+       });
+
+       Ext.apply(me, {
+           title: "Migrate KVM " + vmid,
+           width: 350,
+           modal: true,
+           layout: 'auto',
+           border: false,
+           items: [ me.formPanel ],
+           buttons: [ submitBtn ],
+       });
+
+       me.callParent();
+    }
+});
index 59b7b062b86d50f1669a01b4d63be2504cd17949..74937dd229d091553cfcbadfffe2e792c728b82a 100644 (file)
@@ -59,6 +59,17 @@ Ext.define('PVE.qemu.Summary', {
                        }); 
                    }
                },
+               { 
+                   itemId: 'migrate',
+                   text: 'Migrate',
+                   handler: function() {
+                       var win = Ext.create('PVE.qemu.Migrate', { 
+                           pveSelNode: me.pveSelNode,
+                           workspace: me.up('pveStdWorkspace')
+                       });
+                       win.show();
+                   }    
+               }, 
                { 
                    text: 'Reset',
                    itemId: 'reset',
index a94da3a37d2b1ff356fc7ceb005e6983c4628c8f..ee45d8fcb8b5deacd0fc01fd9bffa6876bd27033 100644 (file)
@@ -103,15 +103,21 @@ Ext.define('PVE.window.TaskViewer', {
            border: false
        });
 
+       var lastStatus = 'unknown';
+
        me.mon(statstore, 'load', function() {
            var status = statgrid.getObjectValue('status');
+           
            if (status === 'stopped') {
                statstore.stopUpdate();
            }
-           if (status === 'running') {
+
+           if (status === 'running' || lastStatus === 'running') {
                store.load();
            }
 
+           lastStatus = status;
+
            stop_btn1.setDisabled(status !== 'running');
            stop_btn2.setDisabled(status !== 'running');
        });