]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/ceph/CephInstallWizard.js
bcb44815940670aec013190d5acfd18b31c2caef
1 /*jslint confusion: true*/
2 Ext
. define ( 'PVE.ceph.CephInstallWizard' , {
3 extend
: 'PVE.window.Wizard' ,
4 alias
: 'widget.pveCephInstallWizard' ,
5 mixins
: [ 'Proxmox.Mixin.CBind' ],
18 title
: gettext ( 'Setup' ),
19 navigateNext : function () {
20 var tp
= this . down ( '#wizcontent' );
21 var atab
= tp
. getActiveTab ();
23 var next
= tp
. items
. indexOf ( atab
) + 1 ;
24 var ntab
= tp
. items
. getAt ( next
);
27 tp
. setActiveTab ( ntab
);
30 setInitialTab : function ( index
) {
31 var tp
= this . down ( '#wizcontent' );
32 var initialTab
= tp
. items
. getAt ( index
);
34 tp
. setActiveTab ( initialTab
);
37 this . callParent ( arguments
);
38 var isInstalled
= this . getViewModel (). get ( 'isInstalled' );
40 this . getViewModel (). set ( 'configuration' , false );
41 this . setInitialTab ( 2 );
46 title
: gettext ( 'Info' ),
50 onlineHelp
: 'chapter_pveceph' ,
51 html
: '<h3>Ceph?</h3>' +
52 '<blockquote cite="https://ceph.com/"><p>"<b>Ceph</b> is a unified, distributed storage system designed for excellent performance, reliability and scalability."</p></blockquote>' +
53 '<p><b>Ceph</b> is currently <b>not installed</b> on this node, click on the next button below to start the installation.' +
54 ' This wizard will guide you through the necessary steps, after the initial installation you will be offered to create an initial configuration.' +
55 ' The configuration step is only needed once per cluster and will be skipped if a config is already present.</p>' +
56 '<p>Please take a look at our documentation, by clicking the help button below, before starting the installation, ' +
57 'if you want to gain deeper knowledge about Ceph visit <a target="_blank" href="http://docs.ceph.com/docs/master/">ceph.com</a>.</p>' ,
59 activate : function () {
60 // notify owning container that it should display a help button
61 if ( this . onlineHelp
) {
62 Ext
. GlobalEvents
. fireEvent ( 'proxmoxShowHelp' , this . onlineHelp
);
64 this . up ( 'pveCephInstallWizard' ). down ( '#back' ). hide ( true );
65 this . up ( 'pveCephInstallWizard' ). down ( '#next' ). setText ( gettext ( 'Start installation' ));
67 deactivate : function () {
68 if ( this . onlineHelp
) {
69 Ext
. GlobalEvents
. fireEvent ( 'proxmoxHideHelp' , this . onlineHelp
);
71 this . up ( 'pveCephInstallWizard' ). down ( '#next' ). setText ( gettext ( 'Next' ));
76 title
: gettext ( 'Installation' ),
80 nodename
: '{nodename}'
82 viewModel
: {}, // needed to inherit parent viewModel data
84 afterrender : function () {
86 if ( this . getViewModel (). get ( 'isInstalled' )) {
87 this . mask ( "Ceph is already installed, click next to create your configuration." ,[ 'pve-static-mask' ]);
89 me
. down ( 'pveNoVncConsole' ). fireEvent ( 'activate' );
92 activate : function () {
94 var nodename
= me
. nodename
;
95 me
. updateStore
= Ext
. create ( 'Proxmox.data.UpdateStore' , {
96 storeid
: 'ceph-status-' + nodename
,
100 url
: '/api2/json/nodes/' + nodename
+ '/ceph/status'
103 load : function ( rec
, response
, success
, operation
) {
106 me
. updateStore
. stopUpdate ();
107 me
. down ( 'textfield' ). setValue ( 'success' );
108 } else if ( operation
. error
. statusText
. match ( "not initialized" , "i" )) {
109 me
. updateStore
. stopUpdate ();
110 me
. up ( 'pveCephInstallWizard' ). getViewModel (). set ( 'configuration' , false );
111 me
. down ( 'textfield' ). setValue ( 'success' );
112 } else if ( operation
. error
. statusText
. match ( "rados_connect failed" , "i" )) {
113 me
. updateStore
. stopUpdate ();
114 me
. up ( 'pveCephInstallWizard' ). getViewModel (). set ( 'configuration' , true );
115 me
. down ( 'textfield' ). setValue ( 'success' );
116 } else if (! operation
. error
. statusText
. match ( "not installed" , "i" )) {
117 Proxmox
. Utils
. setErrorMask ( me
, operation
. error
. statusText
);
122 me
. updateStore
. startUpdate ();
124 destroy : function () {
126 if ( me
. updateStore
) {
127 me
. updateStore
. stopUpdate ();
136 xtype
: 'pveNoVncConsole' ,
138 nodename
: '{nodename}'
144 name
: 'installSuccess' ,
154 title
: gettext ( 'Configuration' ),
155 onlineHelp
: 'chapter_pveceph' ,
157 nodename
: '{nodename}'
162 minreplicas
: undefined
166 activate : function () {
167 this . up ( 'pveCephInstallWizard' ). down ( '#submit' ). setText ( gettext ( 'Next' ));
169 beforeshow : function () {
170 if ( this . up ( 'pveCephInstallWizard' ). getViewModel (). get ( 'configuration' )) {
171 this . mask ( "Configuration already initialized" ,[ 'pve-static-mask' ]);
176 deactivate : function () {
177 this . up ( 'pveCephInstallWizard' ). down ( '#submit' ). setText ( gettext ( 'Finish' ));
182 xtype
: 'displayfield' ,
183 value
: gettext ( 'Ceph cluster configuration' ) + ':'
186 xtype
: 'proxmoxNetworkSelector' ,
189 fieldLabel
: 'Public Network IP/CIDR' ,
191 allowBlank
: '{configuration}'
194 nodename
: '{nodename}'
198 xtype
: 'proxmoxNetworkSelector' ,
199 name
: 'cluster-network' ,
200 fieldLabel
: 'Cluster Network IP/CIDR' ,
203 emptyText
: gettext ( 'Same as Public Network' ),
205 nodename
: '{nodename}'
208 // FIXME: add hint about cluster network and/or reference user to docs??
212 xtype
: 'displayfield' ,
213 value
: gettext ( 'First Ceph monitor' ) + ':'
216 xtype
: 'pveNodeSelector' ,
217 fieldLabel
: gettext ( 'Monitor node' ),
223 xtype
: 'displayfield' ,
224 value
: gettext ( 'Additional monitors are recommended. They can be created at any time in the Monitor tab.' ),
230 xtype
: 'numberfield' ,
232 fieldLabel
: 'Number of replicas' ,
241 xtype
: 'numberfield' ,
243 fieldLabel
: 'Minimum replicas' ,
245 maxValue
: '{replicas}' ,
246 value
: '{minreplicas}'
250 setMaxValue : function ( value
) {
251 this . maxValue
= Ext
. Number
. from ( value
, 2 );
252 // allow enough to avoid split brains with max 'size', but more makes simply no sense
253 if ( this . maxValue
> 4 ) {
256 this . toggleSpinners ();
262 onGetValues : function ( values
) {
263 [ 'cluster-network' , 'size' , 'min_size' ]. forEach ( function ( field
) {
264 if (! values
[ field
]) {
265 delete values
[ field
];
270 onSubmit : function () {
272 if (! this . up ( 'pveCephInstallWizard' ). getViewModel (). get ( 'configuration' )) {
273 var wizard
= me
. up ( 'window' );
274 var kv
= wizard
. getValues ();
276 var monNode
= kv
[ 'mon-node' ];
277 delete kv
[ 'mon-node' ];
278 var nodename
= me
. nodename
;
280 Proxmox
. Utils
. API2Request ({
281 url
: '/nodes/' + nodename
+ '/ceph/init' ,
282 waitMsgTarget
: wizard
,
285 success : function () {
286 Proxmox
. Utils
. API2Request ({
287 url
: '/nodes/' + monNode
+ '/ceph/mon/' + monNode
,
288 waitMsgTarget
: wizard
,
290 success : function () {
291 me
. up ( 'pveCephInstallWizard' ). navigateNext ();
293 failure : function ( response
, opts
) {
294 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
298 failure : function ( response
, opts
) {
299 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
304 me
. up ( 'pveCephInstallWizard' ). navigateNext ();
309 title
: gettext ( 'Success' ),
313 onlineHelp
: 'pve_ceph_install' ,
314 html
: '<h3>Installation successful!</h3>' +
315 '<p>The basic installation and configuration is completed, depending on your setup some of the following steps are required to start using Ceph:</p>' +
316 '<ol><li>Install Ceph on other nodes</li>' +
317 '<li>Create additional Ceph Monitors</li>' +
318 '<li>Create Ceph OSDs</li>' +
319 '<li>Create Ceph Pools</li></ol>' +
320 '<p>To learn more click on the help button below.</p>' ,
322 activate : function () {
323 // notify owning container that it should display a help button
324 if ( this . onlineHelp
) {
325 Ext
. GlobalEvents
. fireEvent ( 'proxmoxShowHelp' , this . onlineHelp
);
328 var tp
= this . up ( '#wizcontent' );
329 var idx
= tp
. items
. indexOf ( this )- 1 ;
330 for (; idx
>= 0 ; idx
--) {
331 var nc
= tp
. items
. getAt ( idx
);
337 deactivate : function () {
338 if ( this . onlineHelp
) {
339 Ext
. GlobalEvents
. fireEvent ( 'proxmoxHideHelp' , this . onlineHelp
);
343 onSubmit : function () {
344 var wizard
= this . up ( 'pveCephInstallWizard' );