standby_table = self.get_standby_table(fsmap['standbys'], mds_versions)
+ flags = mdsmap['flags_state']
+
return {
"cephfs": {
"id": fs_id,
"name": mdsmap['fs_name'],
"client_count": client_count,
"ranks": rank_table,
- "pools": pools_table
+ "pools": pools_table,
+ "flags": flags,
},
"standbys": standby_table,
"versions": mds_versions
And I click on "Create File System" button
Then I should see a row with "test_cephfs"
- Scenario: Edit CephFS Volume
- Given I am on the "cephfs" page
- And I select a row "test_cephfs"
- And I click on "Edit" button
- And enter "name" "test_cephfs_edit"
- And I click on "Edit File System" button
- Then I should see a row with "test_cephfs_edit"
+ # Should be uncommented once the pre-requisite is fixed
+ # Scenario: Edit CephFS Volume
+ # Given I am on the "cephfs" page
+ # And I select a row "test_cephfs"
+ # And I click on "Edit" button
+ # And enter "name" "test_cephfs_edit"
+ # And I click on "Edit File System" button
+ # Then I should see a row with "test_cephfs_edit"
Scenario: Remove CephFS Volume
Given I am on the "cephfs" page
- And I select a row "test_cephfs_edit"
+ And I select a row "test_cephfs"
And I click on "Remove" button from the table actions
Then I should see the modal
And I check the tick box in modal
And I click on "Remove File System" button
- Then I should not see a row with "test_cephfs_edit"
+ Then I should not see a row with "test_cephfs"
data: { breadcrumbs: ActionLabels.CREATE }
},
{
- path: `${URLVerbs.EDIT}/:name`,
+ path: `${URLVerbs.EDIT}/:id`,
component: CephfsVolumeFormComponent,
data: { breadcrumbs: ActionLabels.EDIT }
}
i18n
*ngIf="!editing">Orchestrator is not configured. Deploy MDS daemons manually after creating the volume.</cd-alert-panel>
</ng-container>
+
+ <cd-alert-panel type="info"
+ class="m-3"
+ spacingClass="mt-3"
+ i18n
+ *ngIf="editing && disableRename">
+ <p>The File System can only be renamed if it is shutdown and `refuse_client_session` is set to true.
+ Follow the steps below in the command line and refresh the page:</p>
+ <pre class="d-flex">{{ fsFailCmd }}
+ <cd-copy-2-clipboard-button [source]="fsFailCmd"
+ [byId]="false"
+ [showIconOnly]="true"></cd-copy-2-clipboard-button>
+ </pre>
+ <pre class="d-flex">{{ fsSetCmd }}
+ <cd-copy-2-clipboard-button [source]="fsSetCmd"
+ [byId]="false"
+ [showIconOnly]="true"></cd-copy-2-clipboard-button>
+ </pre>
+ </cd-alert-panel>
+
<div class="card-body">
<!-- Name -->
<div class="form-group row">
<cd-form-button-panel (submitActionEvent)="submit()"
[form]="form"
[submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"
+ [disabled]="editing ? disableRename: false"
wrappingClass="text-right"></cd-form-button-panel>
</div>
</div>
expect(label).toBeNull();
expect(hosts).toBeNull();
});
+
+ it('should disable renaming and show info alert if disableRename is true', () => {
+ component.disableRename = true;
+ component.ngOnInit();
+ fixture.detectChanges();
+ const alertPanel = fixture.debugElement.query(By.css('cd-alert-panel'));
+ expect(alertPanel).not.toBeNull();
+ });
+
+ it('should not show the alert if disableRename is false', () => {
+ component.disableRename = false;
+ component.ngOnInit();
+ fixture.detectChanges();
+ const alertPanel = fixture.debugElement.query(By.css('cd-alert-panel'));
+ expect(alertPanel).toBeNull();
+ });
+
+ it('should disable the submit button only if disableRename is true', () => {
+ component.disableRename = true;
+ component.ngOnInit();
+ fixture.detectChanges();
+ const submitButton = fixture.debugElement.query(By.css('button[type=submit]'));
+ expect(submitButton.nativeElement.disabled).toBeTruthy();
+
+ // the submit button should only be disabled when the form is in edit mode
+ component.editing = false;
+ component.ngOnInit();
+ fixture.detectChanges();
+ expect(submitButton.nativeElement.disabled).toBeFalsy();
+
+ // submit button should be enabled if disableRename is false
+ component.editing = true;
+ component.disableRename = false;
+ component.ngOnInit();
+ fixture.detectChanges();
+ expect(submitButton.nativeElement.disabled).toBeFalsy();
+ });
});
});
labels: string[];
hasOrchestrator: boolean;
currentVolumeName: string;
+ fsId: number;
+ disableRename: boolean = true;
+
+ fsFailCmd: string;
+ fsSetCmd: string;
constructor(
private router: Router,
ngOnInit() {
if (this.editing) {
- this.route.params.subscribe((params: { name: string }) => {
- this.currentVolumeName = params.name;
+ this.route.params.subscribe((params: { id: string }) => {
+ this.fsId = Number(params.id);
+ });
+
+ this.cephfsService.getCephfs(this.fsId).subscribe((resp: object) => {
+ this.currentVolumeName = resp['cephfs']['name'];
this.form.get('name').setValue(this.currentVolumeName);
+
+ this.disableRename = !(
+ !resp['cephfs']['flags']['joinable'] && resp['cephfs']['flags']['refuse_client_session']
+ );
+ if (this.disableRename) {
+ this.form.get('name').disable();
+ this.fsFailCmd = `ceph fs fail ${this.currentVolumeName}`;
+ this.fsSetCmd = `ceph fs set ${this.currentVolumeName} refuse_client_session true`;
+ }
});
} else {
const hostContext = new CdTableFetchDataContext(() => undefined);
permission: 'update',
icon: Icons.edit,
click: () =>
- this.router.navigate([this.urlBuilder.getEdit(this.selection.first().mdsmap.fs_name)])
+ this.router.navigate([this.urlBuilder.getEdit(String(this.selection.first().id))])
},
{
permission: 'delete',