[pve-devel] [PATCH manager 4/4] add a 'create storage' button for ceph pools

Dominik Csapak d.csapak at proxmox.com
Fri Aug 25 14:18:19 CEST 2017


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

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 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..e79c59ae 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 + '/storage',
+	    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