[pve-devel] [PATCH 09/10] add copy vm option in qemu vm right click menu

Alexandre Derumier aderumier at odiso.com
Tue Jan 22 10:14:11 CET 2013


fixme: add a new icon

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/qemu/CmdMenu.js |   46 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/www/manager/qemu/CmdMenu.js b/www/manager/qemu/CmdMenu.js
index c61d1c0..338195d 100644
--- a/www/manager/qemu/CmdMenu.js
+++ b/www/manager/qemu/CmdMenu.js
@@ -78,6 +78,52 @@ Ext.define('PVE.qemu.CmdMenu', {
 		}
 	    },
 	    {
+		text: gettext('Clone'),
+		icon: '/pve2/images/forward.png',
+		handler: function() {
+                        var clonefeature;
+                        var istemplate;
+                        //check if it's a template
+
+                        PVE.Utils.API2Request({
+                            url: '/nodes/' + nodename + '/qemu/' + vmid + '/snapshot',
+                            method: 'GET',
+                            success: function(response, opts) {
+                                Ext.Array.each(response.result.data, function(item) {
+                                    if(item.name === 'current' && item.template){
+                                        istemplate = 1;
+                                    }
+                                });
+
+                                //check if linked clone feature is available
+                                var params = { feature: 'clone' };
+
+                                PVE.Utils.API2Request({
+                                    waitMsgTarget: me,
+                                    url: '/nodes/' + nodename + '/qemu/' + vmid + '/feature',
+                                    params: params,
+                                    method: 'GET',
+                                    success: function(response, options) {
+                                        var res = response.result.data;
+                                        if (res === 1 && istemplate) {
+                                             clonefeature = 1;
+                                        }
+					var win = Ext.create('PVE.window.Clone', {
+					    snapname: 'current',
+					    nodename: nodename,
+					    vmid: vmid,
+					    clonefeature: clonefeature
+					});
+					win.show();
+                                    }
+                                });
+
+                            }
+                        });
+
+		}
+	    },
+	    {
 		text: gettext('Console'),
 		icon: '/pve2/images/display.png',
 		handler: function() {
-- 
1.7.10.4




More information about the pve-devel mailing list