summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.html
blob: b4b9cd1939099adbfe97fd12e83c28ce47790057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<cd-modal [modalRef]="activeModal">
  <ng-container i18n="form title"
                class="modal-title">{{ action | titlecase }} {{ resource | upperFirst }}</ng-container>

  <ng-container class="modal-content">
    <form #frm="ngForm"
          [formGroup]="form"
          novalidate>
      <div class="modal-body">
        <div class="form-group row">
          <label class="cd-col-form-label"
                 for="name"
                 i18n>Name</label>
          <div class="cd-col-form-input">
            <input type="text"
                   id="name"
                   name="name"
                   class="form-control"
                   placeholder="Name..."
                   formControlName="name"
                   autofocus>
            <span class="invalid-feedback"
                  *ngIf="form.showError('name', frm, 'required')"
                  i18n>This field is required!</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('name', frm, 'pattern')"
                  i18n>The name can only consist of alphanumeric characters, dashes and underscores.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('name', frm, 'uniqueName')"
                  i18n>The chosen erasure code profile name is already in use.</span>
          </div>
        </div>

        <div class="form-group row">
          <label for="plugin"
                 class="cd-col-form-label">
            <span class="required"
                  i18n>Plugin</span>
            <cd-helper [html]="tooltips.plugins[plugin].description">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="plugin"
                    name="plugin"
                    formControlName="plugin">
              <option *ngIf="!plugins"
                      ngValue=""
                      i18n>Loading...</option>
              <option *ngFor="let plugin of plugins"
                      [ngValue]="plugin">
                {{ plugin }}
              </option>
            </select>
            <span class="invalid-feedback"
                  *ngIf="form.showError('name', frm, 'required')"
                  i18n>This field is required!</span>
          </div>
        </div>

        <div class="form-group row">
          <label for="k"
                 class="cd-col-form-label">
            <span class="required"
                  i18n>Data chunks (k)</span>
            <cd-helper [html]="tooltips.k">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <input type="number"
                   id="k"
                   name="k"
                   class="form-control"
                   ng-model="$ctrl.erasureCodeProfile.k"
                   placeholder="Data chunks..."
                   formControlName="k"
                   min="2">
            <span class="invalid-feedback"
                  *ngIf="form.showError('k', frm, 'required')"
                  i18n>This field is required!</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('k', frm, 'min')"
                  i18n>Must be equal to or greater than 2.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('k', frm, 'max')"
                  i18n>Chunks (k+m) have exceeded the available OSDs of {{deviceCount}}.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('k', frm, 'unequal')"
                  i18n>For an equal distribution k has to be a multiple of (k+m)/l.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('k', frm, 'kLowerM')"
                  i18n>K has to be equal to or greater than m in order to recover data correctly through c.</span>
            <span *ngIf="plugin === 'lrc'"
                  class="form-text text-muted"
                  i18n>Distribution factor: {{lrcMultiK}}</span>
          </div>
        </div>

        <div class="form-group row">
          <label for="m"
                 class="cd-col-form-label">
            <span class="required"
                  i18n>Coding chunks (m)</span>
            <cd-helper [html]="tooltips.m">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <input type="number"
                   id="m"
                   name="m"
                   class="form-control"
                   placeholder="Coding chunks..."
                   formControlName="m"
                   min="1">
            <span class="invalid-feedback"
                  *ngIf="form.showError('m', frm, 'required')"
                  i18n>This field is required!</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('m', frm, 'min')"
                  i18n>Must be equal to or greater than 1.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('m', frm, 'max')"
                  i18n>Chunks (k+m) have exceeded the available OSDs of {{deviceCount}}.</span>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="plugin === 'shec'">
          <label for="c"
                 class="cd-col-form-label">
            <span class="required"
                  i18n>Durability estimator (c)</span>
            <cd-helper [html]="tooltips.plugins.shec.c">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <input type="number"
                   id="c"
                   name="c"
                   class="form-control"
                   placeholder="Coding chunks..."
                   formControlName="c"
                   min="1">
            <span class="invalid-feedback"
                  *ngIf="form.showError('c', frm, 'min')"
                  i18n>Must be equal to or greater than 1.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('c', frm, 'cGreaterM')"
                  i18n>C has to be equal to or lower than m as m defines the amount of chunks that can be used.</span>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="plugin === 'clay'">
          <label for="d"
                 class="cd-col-form-label">
            <span class="required"
                  i18n>Helper chunks (d)</span>
            <cd-helper [html]="tooltips.plugins.clay.d">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <div class="input-group">
              <input type="number"
                     id="d"
                     name="d"
                     class="form-control"
                     placeholder="Helper chunks..."
                     formControlName="d">
              <span class="input-group-append">
                <button class="btn btn-light"
                        id="d-calc-btn"
                        ngbTooltip="Set d manually or use the plugin's default calculation that maximizes d."
                        i18n-ngbTooltip
                        type="button"
                        (click)="toggleDCalc()">
                  <i [ngClass]="dCalc ? icons.unlock : icons.lock"
                     aria-hidden="true"></i>
                </button>
              </span>
            </div>
            <span class="form-text text-muted"
                  *ngIf="dCalc"
                  i18n>D is automatically updated on k and m changes</span>
            <ng-container
              *ngIf="!dCalc">
              <span class="form-text text-muted"
                    *ngIf="getDMin() < getDMax()"
                    i18n>D can be set from {{getDMin()}} to {{getDMax()}}</span>
              <span class="form-text text-muted"
                    *ngIf="getDMin() === getDMax()"
                    i18n>D can only be set to {{getDMax()}}</span>
            </ng-container>
            <span class="invalid-feedback"
                  *ngIf="form.showError('d', frm, 'dMin')"
                  i18n>D has to be greater than k ({{getDMin()}}).</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('d', frm, 'dMax')"
                  i18n>D has to be lower than k + m ({{getDMax()}}).</span>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="plugin === PLUGIN.LRC">
          <label class="cd-col-form-label"
                 for="l">
            <span class="required"
                  i18n>Locality (l)</span>
            <cd-helper [html]="tooltips.plugins.lrc.l">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <input type="number"
                   id="l"
                   name="l"
                   class="form-control"
                   placeholder="Coding chunks..."
                   formControlName="l"
                   min="1">
            <span class="invalid-feedback"
                  *ngIf="form.showError('l', frm, 'required')"
                  i18n>This field is required!</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('l', frm, 'min')"
                  i18n>Must be equal to or greater than 1.</span>
            <span class="invalid-feedback"
                  *ngIf="form.showError('l', frm, 'unequal')"
                  i18n>Can't split up chunks (k+m) correctly with the current locality.</span>
            <span class="form-text text-muted"
                  i18n>Locality groups: {{lrcGroups}}</span>
          </div>
        </div>

        <div class="form-group row">
          <label for="crushFailureDomain"
                 class="cd-col-form-label">
            <ng-container i18n>Crush failure domain</ng-container>
            <cd-helper [html]="tooltips.crushFailureDomain">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="crushFailureDomain"
                    name="crushFailureDomain"
                    formControlName="crushFailureDomain">
              <option *ngIf="!failureDomains"
                      ngValue=""
                      i18n>Loading...</option>
              <option *ngFor="let domain of failureDomainKeys"
                      [ngValue]="domain">
                {{ domain }} ( {{failureDomains[domain].length}} )
              </option>
            </select>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="plugin === PLUGIN.LRC">
          <label for="crushLocality"
                 class="cd-col-form-label">
            <ng-container i18n>Crush Locality</ng-container>
            <cd-helper [html]="tooltips.plugins.lrc.crushLocality">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="crushLocality"
                    name="crushLocality"
                    formControlName="crushLocality">
              <option *ngIf="!failureDomains"
                      ngValue=""
                      i18n>Loading...</option>
              <option *ngIf="failureDomainKeys.length > 0"
                      ngValue=""
                      i18n>None</option>
              <option *ngFor="let domain of failureDomainKeys"
                      [ngValue]="domain">
                {{ domain }} ( {{failureDomains[domain].length}} )
              </option>
            </select>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="PLUGIN.CLAY === plugin">
          <label for="scalar_mds"
                 class="cd-col-form-label">
            <ng-container i18n>Scalar mds</ng-container>
            <cd-helper [html]="tooltips.plugins.clay.scalar_mds">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="scalar_mds"
                    name="scalar_mds"
                    formControlName="scalar_mds">
              <option *ngFor="let plugin of [PLUGIN.JERASURE, PLUGIN.ISA, PLUGIN.SHEC]"
                      [ngValue]="plugin">
                {{ plugin }}
              </option>
            </select>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="[PLUGIN.JERASURE, PLUGIN.ISA, PLUGIN.CLAY].includes(plugin)">
          <label for="technique"
                 class="cd-col-form-label">
            <ng-container i18n>Technique</ng-container>
            <cd-helper [html]="tooltips.plugins[plugin].technique">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="technique"
                    name="technique"
                    formControlName="technique">
              <option *ngFor="let technique of techniques"
                      [ngValue]="technique">
                {{ technique }}
              </option>
            </select>
          </div>
        </div>

        <div class="form-group row"
             *ngIf="plugin === PLUGIN.JERASURE">
          <label for="packetSize"
                 class="cd-col-form-label">
            <ng-container i18n>Packetsize</ng-container>
            <cd-helper [html]="tooltips.plugins.jerasure.packetSize">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <input type="number"
                   id="packetSize"
                   name="packetSize"
                   class="form-control"
                   placeholder="Packetsize..."
                   formControlName="packetSize"
                   min="1">
            <span class="invalid-feedback"
                  *ngIf="form.showError('packetSize', frm, 'min')"
                  i18n>Must be equal to or greater than 1.</span>
          </div>
        </div>

        <div class="form-group row">
          <label for="crushRoot"
                 class="cd-col-form-label">
            <ng-container i18n>Crush root</ng-container>
            <cd-helper [html]="tooltips.crushRoot">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="crushRoot"
                    name="crushRoot"
                    formControlName="crushRoot">
              <option *ngIf="!buckets"
                      ngValue=""
                      i18n>Loading...</option>
              <option *ngFor="let bucket of buckets"
                      [ngValue]="bucket">
                {{ bucket.name }}
              </option>
            </select>
          </div>
        </div>

        <div class="form-group row">
          <label for="crushDeviceClass"
                 class="cd-col-form-label">
            <ng-container i18n>Crush device class</ng-container>
            <cd-helper [html]="tooltips.crushDeviceClass">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <select class="form-control"
                    id="crushDeviceClass"
                    name="crushDeviceClass"
                    formControlName="crushDeviceClass">
              <option ngValue=""
                      i18n>Let Ceph decide</option>
              <option *ngFor="let deviceClass of devices"
                      [ngValue]="deviceClass">
                {{ deviceClass }}
              </option>
            </select>
            <span class="form-text text-muted"
                  i18n>Available OSDs: {{deviceCount}}</span>
          </div>
        </div>

        <div class="form-group row">
          <label for="directory"
                 class="cd-col-form-label">
            <ng-container i18n>Directory</ng-container>
            <cd-helper [html]="tooltips.directory">
            </cd-helper>
          </label>
          <div class="cd-col-form-input">
            <input type="text"
                   id="directory"
                   name="directory"
                   class="form-control"
                   placeholder="Path..."
                   formControlName="directory">
          </div>
        </div>
      </div>

      <div class="modal-footer">
        <cd-form-button-panel (submitActionEvent)="onSubmit()"
                              [form]="form"
                              [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"></cd-form-button-panel>
      </div>
    </form>
  </ng-container>
</cd-modal>