[pve-devel] [PATCH v4 manager 5/5] added basic ability to install ceph via gui

Tim Marx t.marx at proxmox.com
Mon Jan 28 14:55:53 CET 2019


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
changes since v3:
* added general error check

 www/manager6/Makefile              |  1 +
 www/manager6/ceph/Status.js        | 35 ++++++++++++++++++++++++++++++-
 www/manager6/window/CephInstall.js | 42 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 www/manager6/window/CephInstall.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e75f0de6..c4dcb786 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -83,6 +83,7 @@ JSSRC= 				                 	\
 	window/BackupConfig.js				\
 	window/Settings.js				\
 	window/StartupEdit.js				\
+	window/CephInstall.js				\
 	panel/NotesView.js				\
 	grid/ResourceGrid.js				\
 	grid/PoolMembers.js				\
diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index 78fa1cf8..cf2e16ee 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -308,7 +308,40 @@ Ext.define('PVE.node.CephStatus', {
 	me.version = me.sp.get('ceph-version');
 	me.change_version(me.version);
 
-	Proxmox.Utils.monStoreErrors(me,me.store);
+	me.mon(me.store.proxy, 'afterload', function (proxy, request, success) {
+
+	    if (success) {
+		Proxmox.Utils.setErrorMask(me, false);
+		return;
+	    }
+	    var msg;
+	    var operation = request._operation;
+	    var error = operation.getError();
+
+	    if (error.statusText) {
+		if (error.statusText.match(/not installed/i)) {
+		    if (Proxmox.UserName === 'root at pam') {
+			me.store.stopUpdate();
+			me.el.mask(gettext("Ceph not installed"), ['pve-static-mask']);
+
+			var win = Ext.create('PVE.ceph.Install', {
+			    nodename: nodename
+			});
+			win.show();
+		    } else {
+			me.store.stopUpdate();
+			me.el.mask(gettext("Ceph not installed. Log in as root to install."), ['pve-static-mask']);
+		    }
+		    return;
+		} else {
+		    msg = error.statusText + ' (' + error.status + ')';
+		}
+	    } else {
+		msg = gettext('Connection error');
+	    }
+	    Proxmox.Utils.setErrorMask(me, msg);
+	});
+
 	me.mon(me.store, 'load', me.updateAll, me);
 	me.on('destroy', me.store.stopUpdate);
 	me.store.startUpdate();
diff --git a/www/manager6/window/CephInstall.js b/www/manager6/window/CephInstall.js
new file mode 100644
index 00000000..9152c44f
--- /dev/null
+++ b/www/manager6/window/CephInstall.js
@@ -0,0 +1,42 @@
+Ext.define('PVE.ceph.Install', {
+    extend: 'Ext.window.Window',
+
+    width: 300,
+    title: gettext('Install Ceph'),
+
+    nodename: undefined,
+    cephVersion: 'luminous',
+
+    initComponent: function () {
+	var me = this;
+	if (!me.nodename) {
+	    throw "no node name specified";
+	}
+
+	me.items = [
+	    {
+		html: '<p>' + gettext('Ceph is not installed on this node. ') +
+		gettext('Would you like to install it now?')+'</p>',
+		border: false,
+		padding: 5
+	    }
+	];
+
+	me.buttons = [
+	    {
+		xtype: 'pveConsoleButton',
+		disabled: Proxmox.UserName !== 'root at pam',
+		text: gettext('Install Ceph-') + me.cephVersion,
+		consoleType: 'cmd',
+		cmd: "ceph_install",
+		nodename: me.nodename
+	    }
+	];
+
+	Ext.applyIf(me, {
+		modal: true,
+		border: false
+	});
+	me.callParent();
+    }
+});
-- 
2.11.0




More information about the pve-devel mailing list