]>
Commit | Line | Data |
---|---|---|
4616a55b TM |
1 | Ext.define('PVE.ceph.CephInstallWizard', { |
2 | extend: 'PVE.window.Wizard', | |
3 | alias: 'widget.pveCephInstallWizard', | |
4 | mixins: ['Proxmox.Mixin.CBind'], | |
5 | resizable: false, | |
6 | nodename: undefined, | |
7 | viewModel: { | |
8 | data: { | |
9 | nodename: '' | |
10 | } | |
11 | }, | |
12 | cbindData: { | |
13 | nodename: undefined | |
14 | }, | |
15 | title: gettext('Installation'), | |
16 | items: [ | |
17 | { | |
18 | title: gettext('Info'), | |
19 | xtype: 'panel', | |
20 | border: false, | |
21 | bodyBorder: false, | |
22 | onlineHelp: 'chapter_pveceph', | |
23 | html: '<h3>Ceph?</h3>'+ | |
24 | '<blockquote cite="https://ceph.com/"><p>"<b>Ceph</b> is a unified, distributed storage system designed for excellent performance, reliability and scalability."</p></blockquote>'+ | |
25 | '<p><b>Ceph</b> is currently <b>not installed</b> on this node, click on the next button below to start the installation.'+ | |
26 | ' This wizard will guide you through the necessary steps, after the initial installation you will be offered to create a initial configuration.'+ | |
27 | ' The configuration step is only needed once per cluster and will be skipped if a config is already present.</p>'+ | |
28 | '<p>Please take a look at our documentation, by clicking the help button below, before starting the installation, if you want to gain deeper knowledge about Ceph visit <a href="http://docs.ceph.com/docs/master/">ceph.com</a>.</p>', | |
29 | listeners: { | |
30 | activate: function() { | |
31 | // notify owning container that it should display a help button | |
32 | if (this.onlineHelp) { | |
33 | Ext.GlobalEvents.fireEvent('proxmoxShowHelp', this.onlineHelp); | |
34 | } | |
35 | this.up('pveCephInstallWizard').down('#back').hide(true); | |
fc360d85 | 36 | this.up('pveCephInstallWizard').down('#next').setText(gettext('Start installation')); |
4616a55b TM |
37 | }, |
38 | deactivate: function() { | |
39 | if (this.onlineHelp) { | |
40 | Ext.GlobalEvents.fireEvent('proxmoxHideHelp', this.onlineHelp); | |
41 | } | |
fc360d85 | 42 | this.up('pveCephInstallWizard').down('#next').setText(gettext('Next')); |
4616a55b TM |
43 | } |
44 | } | |
45 | }, | |
46 | { | |
47 | title: gettext('Installation'), | |
48 | xtype: 'panel', | |
49 | layout: 'fit', | |
50 | cbind:{ | |
51 | nodename: '{nodename}' | |
52 | }, | |
53 | listeners: { | |
54 | afterrender: function() { | |
55 | var me = this; | |
56 | me.down('pveNoVncConsole').fireEvent('activate'); | |
57 | }, | |
58 | activate: function() { | |
59 | var me = this; | |
60 | var nodename = me.nodename; | |
61 | me.updateStore = Ext.create('Proxmox.data.UpdateStore', { | |
62 | storeid: 'ceph-status-' + nodename, | |
63 | interval: 1000, | |
64 | proxy: { | |
65 | type: 'proxmox', | |
66 | url: '/api2/json/nodes/' + nodename + '/ceph/status' | |
67 | }, | |
68 | listeners: { | |
69 | load: function(rec, response, success, operation) { | |
70 | var wizard = me.up('#wizcontent'); | |
71 | var tabs = wizard.items; | |
72 | var lastTab = tabs.items[tabs.length-1]; | |
73 | if (success) { | |
74 | me.updateStore.stopUpdate(); | |
75 | lastTab.enable(); | |
76 | wizard.setActiveTab(lastTab); | |
77 | } else if (operation.error.statusText.match("not initialized", "i")) { | |
78 | me.updateStore.stopUpdate(); | |
79 | me.down('textfield').setValue('success'); | |
80 | } else if (operation.error.statusText.match("rados_connect failed", "i")) { | |
81 | me.updateStore.stopUpdate(); | |
82 | lastTab.enable(); | |
83 | wizard.setActiveTab(lastTab); | |
84 | } else if (!operation.error.statusText.match("not installed", "i")) { | |
85 | Proxmox.Utils.setErrorMask(me, operation.error.statusText); | |
86 | } | |
87 | } | |
88 | } | |
89 | }); | |
90 | me.updateStore.startUpdate(); | |
91 | }, | |
92 | destroy: function() { | |
93 | var me = this; | |
94 | if (me.updateStore) { | |
95 | me.updateStore.stopUpdate(); | |
96 | } | |
97 | } | |
98 | }, | |
99 | items: [ | |
100 | { | |
101 | itemId: 'jsconsole', | |
102 | consoleType: 'cmd', | |
103 | xtermjs: true, | |
104 | xtype: 'pveNoVncConsole', | |
105 | cbind:{ | |
106 | nodename: '{nodename}' | |
107 | }, | |
108 | cmd: 'ceph_install' | |
109 | }, | |
110 | { | |
111 | xtype: 'textfield', | |
112 | name: 'installSuccess', | |
113 | value: '', | |
114 | allowBlank: false, | |
115 | submitValue: false, | |
116 | hidden: true | |
117 | } | |
118 | ] | |
119 | }, | |
120 | { | |
121 | xtype: 'inputpanel', | |
122 | title: gettext('Configuration'), | |
123 | onlineHelp: 'chapter_pveceph', | |
124 | cbind: { | |
125 | nodename: '{nodename}' | |
126 | }, | |
127 | listeners: { | |
128 | activate: function() { | |
129 | this.up('pveCephInstallWizard').down('#submit').setText(gettext('Next')); | |
130 | }, | |
131 | deactivate: function() { | |
132 | this.up('pveCephInstallWizard').down('#submit').setText(gettext('Finish')); | |
133 | } | |
134 | }, | |
135 | column1: [ | |
136 | { | |
137 | xtype: 'displayfield', | |
138 | name: 'nodename', | |
139 | fieldLabel: gettext('Node'), | |
140 | cbind: { | |
141 | value: '{nodename}' | |
142 | }, | |
143 | padding: 5 | |
144 | }, | |
145 | { | |
146 | xtype: 'textfield', | |
147 | name: 'network', | |
148 | vtype: 'IPCIDRAddress', | |
149 | value: '', | |
2248c6c8 | 150 | fieldLabel: 'Public Network IP/CIDR', |
4616a55b TM |
151 | allowBlank: false |
152 | }, | |
153 | { | |
154 | xtype: 'textfield', | |
155 | name: 'cluster-network', | |
156 | vtype: 'IPCIDRAddress', | |
2248c6c8 | 157 | fieldLabel: 'Cluster Network IP/CIDR', |
4616a55b | 158 | allowBlank: true, |
2248c6c8 | 159 | emptyText: gettext('Same as Public Network') |
4616a55b TM |
160 | } |
161 | ], | |
162 | advancedColumn1: [ | |
163 | { | |
164 | xtype: 'numberfield', | |
165 | name: 'size', | |
0b985d6f | 166 | fieldLabel: 'Number of replicas', |
4616a55b TM |
167 | value: '', |
168 | maxValue: 7, | |
169 | minValue: 1, | |
170 | allowBlank: true, | |
fc360d85 | 171 | emptyText: '3' |
4616a55b TM |
172 | }, |
173 | { | |
174 | xtype: 'numberfield', | |
175 | name: 'min_size', | |
0b985d6f | 176 | fieldLabel: 'Minimum replicas', |
4616a55b TM |
177 | value: '', |
178 | maxValue: 7, | |
179 | minValue: 1, | |
180 | allowBlank: true, | |
fc360d85 | 181 | emptyText: '2' |
4616a55b TM |
182 | }, |
183 | { | |
184 | xtype: 'numberfield', | |
185 | name: 'pg_bits', | |
186 | fieldLabel: 'Placement group bits', | |
187 | value: '', | |
188 | maxValue: 14, | |
189 | minValue: 6, | |
190 | allowBlank: true, | |
fc360d85 | 191 | emptyText: '6' |
4616a55b TM |
192 | } |
193 | ], | |
194 | onGetValues: function(values) { | |
195 | ['cluster-network', 'size', 'min_size', 'pg_bits'].forEach(function(field) { | |
196 | if (!values[field]) { | |
197 | delete values[field]; | |
198 | } | |
199 | }); | |
200 | return values; | |
201 | }, | |
202 | onSubmit: function() { | |
203 | var me = this; | |
204 | var wizard = me.up('window'); | |
205 | var kv = wizard.getValues(); | |
206 | delete kv['delete']; | |
207 | var nodename = me.nodename; | |
208 | delete kv.nodename; | |
209 | Proxmox.Utils.API2Request({ | |
210 | url: '/nodes/'+nodename+'/ceph/init', | |
211 | waitMsgTarget: wizard, | |
212 | method: 'POST', | |
213 | params: kv, | |
214 | success: function() { | |
215 | var tp = me.up('#wizcontent'); | |
216 | var atab = tp.getActiveTab(); | |
217 | ||
218 | var next = tp.items.indexOf(atab) + 1; | |
219 | var ntab = tp.items.getAt(next); | |
220 | if (ntab) { | |
221 | ntab.enable(); | |
222 | tp.setActiveTab(ntab); | |
223 | } | |
224 | }, | |
225 | failure: function(response, opts) { | |
226 | Ext.Msg.alert(gettext('Error'), response.htmlStatus); | |
227 | } | |
228 | }); | |
229 | } | |
230 | }, | |
231 | { | |
232 | title: gettext('Success'), | |
233 | xtype: 'panel', | |
234 | border: false, | |
235 | bodyBorder: false, | |
236 | onlineHelp: 'pve_ceph_install', | |
237 | html: '<h3>Installation successful!</h3>'+ | |
238 | '<p>The basic installation and configuration is completed, depending on your setup some of the following steps are required to start using Ceph:</p>'+ | |
443cb6d7 | 239 | '<ol><li>Create additional Ceph Monitors</li><li>Create Ceph OSDs</li><li>Create Ceph Pools</li></ol>'+ |
4616a55b TM |
240 | '<p>To learn more click on the help button below.</p>', |
241 | listeners: { | |
242 | activate: function() { | |
243 | // notify owning container that it should display a help button | |
244 | if (this.onlineHelp) { | |
245 | Ext.GlobalEvents.fireEvent('proxmoxShowHelp', this.onlineHelp); | |
246 | } | |
247 | ||
248 | var tp = this.up('#wizcontent'); | |
249 | var idx = tp.items.indexOf(this)-1; | |
250 | for(;idx >= 0;idx--) { | |
251 | var nc = tp.items.getAt(idx); | |
252 | if (nc) { | |
253 | nc.disable(); | |
254 | } | |
255 | } | |
256 | }, | |
257 | deactivate: function() { | |
258 | if (this.onlineHelp) { | |
259 | Ext.GlobalEvents.fireEvent('proxmoxHideHelp', this.onlineHelp); | |
260 | } | |
261 | } | |
262 | }, | |
263 | onSubmit: function() { | |
264 | var wizard = this.up('pveCephInstallWizard'); | |
265 | wizard.close(); | |
266 | } | |
267 | } | |
268 | ] | |
2248c6c8 | 269 | }); |