[pve-devel] [v2 manager 25/27] add a 'create storage' button for ceph pools

Fabian Gr├╝nbichler f.gruenbichler at proxmox.com
Tue Aug 29 13:04:47 CEST 2017


From: Dominik Csapak <d.csapak at proxmox.com>

with this, you can create a pveceph managed storage for a ceph pool

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
Signed-off-by: Fabian Gr├╝nbichler <f.gruenbichler at proxmox.com>
---
changes since Dominik's v1:
- adapted API path for storageS

 www/manager6/ceph/Pool.js | 67 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
index 1f304df2..5cb70814 100644
--- a/www/manager6/ceph/Pool.js
+++ b/www/manager6/ceph/Pool.js
@@ -70,6 +70,50 @@ Ext.define('PVE.CephCreatePool', {
     }
 });
 
+Ext.define('PVE.CephCreatePoolStorage', {
+    extend: 'PVE.window.Edit',
+    alias: 'widget.pveCephCreatePoolStorage',
+
+    subject: 'Ceph Pool Storage',
+    isCreate: true,
+    method: 'POST',
+    items: [
+	{
+	    xtype: 'textfield',
+	    fieldLabel: 'ID',
+	    name: 'storage',
+	    vtype: 'StorageId',
+	    allowBlank: false
+	},
+	{
+	    xtype: 'pvecheckbox',
+	    fieldLabel: 'KRBD',
+	    name: 'krbd'
+	}
+    ],
+    initComponent : function() {
+	 /*jslint confusion: true */
+        var me = this;
+
+	if (!me.nodename) {
+	    throw "no node name specified";
+	}
+
+	if (!me.pool) {
+	    throw "no pool defined";
+	}
+
+        Ext.apply(me, {
+	    url: "/nodes/" + me.nodename + "/ceph/pools/" + me.pool + '/storages',
+	    defaults: {
+		nodename: me.nodename
+	    }
+        });
+
+        me.callParent();
+    }
+});
+
 Ext.define('PVE.node.CephPoolList', {
     extend: 'Ext.grid.GridPanel',
     alias: 'widget.pveNodeCephPoolList',
@@ -202,10 +246,31 @@ Ext.define('PVE.node.CephPoolList', {
 	    }
 	});
 
+	var storages_btn = Ext.create('PVE.button.Button', {
+	    text: gettext('Create Storage'),
+	    selModel: sm,
+	    disabled: true,
+	    handler: function() {
+		var rec = sm.getSelection()[0];
+
+		if (!rec.data.pool_name) {
+		    return;
+		}
+		var win = Ext.create('PVE.CephCreatePoolStorage', {
+                    nodename: nodename,
+		    pool: rec.data.pool_name
+		});
+		win.show();
+		win.on('destroy', function() {
+		    rstore.load();
+		});
+	    }
+	});
+
 	Ext.apply(me, {
 	    store: store,
 	    selModel: sm,
-	    tbar: [ create_btn, remove_btn ],
+	    tbar: [ create_btn, remove_btn, storages_btn ],
 	    listeners: {
 		activate: rstore.startUpdate,
 		destroy: rstore.stopUpdate
-- 
2.11.0




More information about the pve-devel mailing list