]>
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' ],
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 a 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 ( "Coniguration 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}'
195 xtype
: 'proxmoxNetworkSelector' ,
196 name
: 'cluster-network' ,
197 fieldLabel
: 'Cluster Network IP/CIDR' ,
200 emptyText
: gettext ( 'Same as Public Network' )
202 // FIXME: add hint about cluster network and/or reference user to docs??
206 xtype
: 'displayfield' ,
207 value
: gettext ( 'First Ceph monitor' ) + ':'
210 xtype
: 'pveNodeSelector' ,
211 fieldLabel
: gettext ( 'Monitor node' ),
217 xtype
: 'displayfield' ,
218 value
: gettext ( 'Additional monitors are recommended. They can be created at any time in the Monitor tab.' ),
224 xtype
: 'numberfield' ,
226 fieldLabel
: 'Number of replicas' ,
235 xtype
: 'numberfield' ,
237 fieldLabel
: 'Minimum replicas' ,
239 maxValue
: '{replicas}' ,
240 value
: '{minreplicas}'
244 setMaxValue : function ( value
) {
245 this . maxValue
= Ext
. Number
. from ( value
, 2 );
246 // allow enough to avoid split brains with max 'size', but more makes simply no sense
247 if ( this . maxValue
> 4 ) {
250 this . toggleSpinners ();
256 onGetValues : function ( values
) {
257 [ 'cluster-network' , 'size' , 'min_size' ]. forEach ( function ( field
) {
258 if (! values
[ field
]) {
259 delete values
[ field
];
264 onSubmit : function () {
266 if (! this . up ( 'pveCephInstallWizard' ). getViewModel (). get ( 'configuration' )) {
267 var wizard
= me
. up ( 'window' );
268 var kv
= wizard
. getValues ();
270 var monNode
= kv
[ 'mon-node' ];
271 delete kv
[ 'mon-node' ];
272 var nodename
= me
. nodename
;
274 Proxmox
. Utils
. API2Request ({
275 url
: '/nodes/' + nodename
+ '/ceph/init' ,
276 waitMsgTarget
: wizard
,
279 success : function () {
280 Proxmox
. Utils
. API2Request ({
281 url
: '/nodes/' + monNode
+ '/ceph/mon/' + monNode
,
282 waitMsgTarget
: wizard
,
284 success : function () {
285 me
. up ( 'pveCephInstallWizard' ). navigateNext ();
287 failure : function ( response
, opts
) {
288 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
292 failure : function ( response
, opts
) {
293 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
298 me
. up ( 'pveCephInstallWizard' ). navigateNext ();
303 title
: gettext ( 'Success' ),
307 onlineHelp
: 'pve_ceph_install' ,
308 html
: '<h3>Installation successful!</h3>' +
309 '<p>The basic installation and configuration is completed, depending on your setup some of the following steps are required to start using Ceph:</p>' +
310 '<ol><li>Install Ceph on other nodes</li>' +
311 '<li>Create additional Ceph Monitors</li>' +
312 '<li>Create Ceph OSDs</li>' +
313 '<li>Create Ceph Pools</li></ol>' +
314 '<p>To learn more click on the help button below.</p>' ,
316 activate : function () {
317 // notify owning container that it should display a help button
318 if ( this . onlineHelp
) {
319 Ext
. GlobalEvents
. fireEvent ( 'proxmoxShowHelp' , this . onlineHelp
);
322 var tp
= this . up ( '#wizcontent' );
323 var idx
= tp
. items
. indexOf ( this )- 1 ;
324 for (; idx
>= 0 ; idx
--) {
325 var nc
= tp
. items
. getAt ( idx
);
331 deactivate : function () {
332 if ( this . onlineHelp
) {
333 Ext
. GlobalEvents
. fireEvent ( 'proxmoxHideHelp' , this . onlineHelp
);
337 onSubmit : function () {
338 var wizard
= this . up ( 'pveCephInstallWizard' );