]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/ceph/CephInstallWizard.js
1 /*jslint confusion: true*/
2 Ext
. define ( 'PVE.ceph.CephInstallWizard' , {
3 extend
: 'PVE.window.Wizard' ,
4 alias
: 'widget.pveCephInstallWizard' ,
5 mixins
: [ 'Proxmox.Mixin.CBind' ],
17 title
: gettext ( 'Installation' ),
18 navigateNext : function () {
19 var tp
= this . down ( '#wizcontent' );
20 var atab
= tp
. getActiveTab ();
22 var next
= tp
. items
. indexOf ( atab
) + 1 ;
23 var ntab
= tp
. items
. getAt ( next
);
26 tp
. setActiveTab ( ntab
);
31 title
: gettext ( 'Info' ),
35 onlineHelp
: 'chapter_pveceph' ,
36 html
: '<h3>Ceph?</h3>' +
37 '<blockquote cite="https://ceph.com/"><p>"<b>Ceph</b> is a unified, distributed storage system designed for excellent performance, reliability and scalability."</p></blockquote>' +
38 '<p><b>Ceph</b> is currently <b>not installed</b> on this node, click on the next button below to start the installation.' +
39 ' This wizard will guide you through the necessary steps, after the initial installation you will be offered to create a initial configuration.' +
40 ' The configuration step is only needed once per cluster and will be skipped if a config is already present.</p>' +
41 '<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>' ,
43 activate : function () {
44 // notify owning container that it should display a help button
45 if ( this . onlineHelp
) {
46 Ext
. GlobalEvents
. fireEvent ( 'proxmoxShowHelp' , this . onlineHelp
);
48 this . up ( 'pveCephInstallWizard' ). down ( '#back' ). hide ( true );
49 this . up ( 'pveCephInstallWizard' ). down ( '#next' ). setText ( gettext ( 'Start installation' ));
51 deactivate : function () {
52 if ( this . onlineHelp
) {
53 Ext
. GlobalEvents
. fireEvent ( 'proxmoxHideHelp' , this . onlineHelp
);
55 this . up ( 'pveCephInstallWizard' ). down ( '#next' ). setText ( gettext ( 'Next' ));
60 title
: gettext ( 'Installation' ),
64 nodename
: '{nodename}'
67 afterrender : function () {
69 me
. down ( 'pveNoVncConsole' ). fireEvent ( 'activate' );
71 activate : function () {
73 var nodename
= me
. nodename
;
74 me
. updateStore
= Ext
. create ( 'Proxmox.data.UpdateStore' , {
75 storeid
: 'ceph-status-' + nodename
,
79 url
: '/api2/json/nodes/' + nodename
+ '/ceph/status'
82 load : function ( rec
, response
, success
, operation
) {
85 me
. updateStore
. stopUpdate ();
86 me
. down ( 'textfield' ). setValue ( 'success' );
87 } else if ( operation
. error
. statusText
. match ( "not initialized" , "i" )) {
88 me
. updateStore
. stopUpdate ();
89 me
. up ( 'pveCephInstallWizard' ). getViewModel (). set ( 'configuration' , false );
90 me
. down ( 'textfield' ). setValue ( 'success' );
91 } else if ( operation
. error
. statusText
. match ( "rados_connect failed" , "i" )) {
92 me
. updateStore
. stopUpdate ();
93 me
. up ( 'pveCephInstallWizard' ). getViewModel (). set ( 'configuration' , true );
94 me
. down ( 'textfield' ). setValue ( 'success' );
95 } else if (! operation
. error
. statusText
. match ( "not installed" , "i" )) {
96 Proxmox
. Utils
. setErrorMask ( me
, operation
. error
. statusText
);
101 me
. updateStore
. startUpdate ();
103 destroy : function () {
105 if ( me
. updateStore
) {
106 me
. updateStore
. stopUpdate ();
115 xtype
: 'pveNoVncConsole' ,
117 nodename
: '{nodename}'
123 name
: 'installSuccess' ,
133 title
: gettext ( 'Configuration' ),
134 onlineHelp
: 'chapter_pveceph' ,
136 nodename
: '{nodename}'
141 minreplicas
: undefined
145 activate : function () {
146 this . up ( 'pveCephInstallWizard' ). down ( '#submit' ). setText ( gettext ( 'Next' ));
148 beforeshow : function () {
149 if ( this . up ( 'pveCephInstallWizard' ). getViewModel (). get ( 'configuration' )) {
150 this . mask ( "Coniguration already initialized" ,[ 'pve-static-mask' ]);
155 deactivate : function () {
156 this . up ( 'pveCephInstallWizard' ). down ( '#submit' ). setText ( gettext ( 'Finish' ));
162 html
: '<h3>Create initial Ceph config:</h3>'
165 xtype
: 'displayfield' ,
167 fieldLabel
: gettext ( 'Node' ),
175 vtype
: 'IPCIDRAddress' ,
177 fieldLabel
: 'Public Network IP/CIDR' ,
179 allowBlank
: '{configuration}'
181 setAllowBlank : function ( allowBlank
) {
182 this . allowBlank
= allowBlank
;
188 name
: 'cluster-network' ,
189 vtype
: 'IPCIDRAddress' ,
190 fieldLabel
: 'Cluster Network IP/CIDR' ,
192 emptyText
: gettext ( 'Same as Public Network' )
198 html
: '<h3>Choose a monitor node:<br><small>(create additional ones later via monitor tab)</small></h3>'
201 xtype
: 'pveNodeSelector' ,
202 fieldLabel
: gettext ( 'Monitor node' ),
210 xtype
: 'numberfield' ,
212 fieldLabel
: 'Number of replicas' ,
221 xtype
: 'numberfield' ,
223 fieldLabel
: 'Minimum replicas' ,
225 maxValue
: '{replicas}' ,
226 value
: '{minreplicas}'
230 setMaxValue : function ( value
) {
231 this . maxValue
= Ext
. Number
. from ( value
, 2 );
232 // allow enough to avoid split brains with max 'size', but more makes simply no sense
233 if ( this . maxValue
> 4 ) {
236 this . toggleSpinners ();
242 xtype
: 'numberfield' ,
244 fieldLabel
: 'Placement group bits' ,
252 onGetValues : function ( values
) {
253 [ 'cluster-network' , 'size' , 'min_size' , 'pg_bits' ]. forEach ( function ( field
) {
254 if (! values
[ field
]) {
255 delete values
[ field
];
260 onSubmit : function () {
262 if (! this . up ( 'pveCephInstallWizard' ). getViewModel (). get ( 'configuration' )) {
263 var wizard
= me
. up ( 'window' );
264 var kv
= wizard
. getValues ();
266 var monNode
= kv
[ 'mon-node' ];
267 delete kv
[ 'mon-node' ];
268 var nodename
= me
. nodename
;
270 Proxmox
. Utils
. API2Request ({
271 url
: '/nodes/' + nodename
+ '/ceph/init' ,
272 waitMsgTarget
: wizard
,
275 success : function () {
276 Proxmox
. Utils
. API2Request ({
277 url
: '/nodes/' + monNode
+ '/ceph/mon' ,
278 waitMsgTarget
: wizard
,
280 success : function () {
281 me
. up ( 'pveCephInstallWizard' ). navigateNext ();
283 failure : function ( response
, opts
) {
284 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
288 failure : function ( response
, opts
) {
289 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
294 me
. up ( 'pveCephInstallWizard' ). navigateNext ();
299 title
: gettext ( 'Success' ),
303 onlineHelp
: 'pve_ceph_install' ,
304 html
: '<h3>Installation successful!</h3>' +
305 '<p>The basic installation and configuration is completed, depending on your setup some of the following steps are required to start using Ceph:</p>' +
306 '<ol><li>Create additional Ceph Monitors</li><li>Create Ceph OSDs</li><li>Create Ceph Pools</li></ol>' +
307 '<p>To learn more click on the help button below.</p>' ,
309 activate : function () {
310 // notify owning container that it should display a help button
311 if ( this . onlineHelp
) {
312 Ext
. GlobalEvents
. fireEvent ( 'proxmoxShowHelp' , this . onlineHelp
);
315 var tp
= this . up ( '#wizcontent' );
316 var idx
= tp
. items
. indexOf ( this )- 1 ;
317 for (; idx
>= 0 ; idx
--) {
318 var nc
= tp
. items
. getAt ( idx
);
324 deactivate : function () {
325 if ( this . onlineHelp
) {
326 Ext
. GlobalEvents
. fireEvent ( 'proxmoxHideHelp' , this . onlineHelp
);
330 onSubmit : function () {
331 var wizard
= this . up ( 'pveCephInstallWizard' );