f'Failed to update subvolume group {group_name}: {err}'
)
return f'Subvolume group {group_name} updated successfully'
+
+ def delete(self, vol_name: str, group_name: str):
+ error_code, _, err = mgr.remote(
+ 'volumes', '_cmd_fs_subvolumegroup_rm', None, {
+ 'vol_name': vol_name, 'group_name': group_name})
+ if error_code != 0:
+ raise DashboardException(
+ f'Failed to delete subvolume group {group_name}: {err}'
+ )
+ return f'Subvolume group {group_name} removed successfully'
import { CephfsSubvolumeGroupComponent } from './cephfs-subvolume-group.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { ToastrModule } from 'ngx-toastr';
+import { RouterTestingModule } from '@angular/router/testing';
+import { SharedModule } from '~/app/shared/shared.module';
describe('CephfsSubvolumeGroupComponent', () => {
let component: CephfsSubvolumeGroupComponent;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CephfsSubvolumeGroupComponent],
- imports: [HttpClientTestingModule]
+ imports: [HttpClientTestingModule, SharedModule, ToastrModule.forRoot(), RouterTestingModule]
}).compileComponents();
});
import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
import { ModalService } from '~/app/shared/services/modal.service';
import { Permissions } from '~/app/shared/models/permissions';
+import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { FinishedTask } from '~/app/shared/models/finished-task';
+import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
@Component({
selector: 'cd-cephfs-subvolume-group',
private cephfsSubvolumeGroup: CephfsSubvolumeGroupService,
private actionLabels: ActionLabelsI18n,
private modalService: ModalService,
- private authStorageService: AuthStorageService
+ private authStorageService: AuthStorageService,
+ private taskWrapper: TaskWrapperService
) {
this.permissions = this.authStorageService.getPermissions();
}
permission: 'update',
icon: Icons.edit,
click: () => this.openModal(true)
+ },
+ {
+ name: this.actionLabels.REMOVE,
+ permission: 'delete',
+ icon: Icons.destroy,
+ click: () => this.removeSubVolumeModal()
}
];
{ size: 'lg' }
);
}
+
+ removeSubVolumeModal() {
+ const name = this.selection.first().name;
+ this.modalService.show(CriticalConfirmationModalComponent, {
+ itemDescription: 'subvolume group',
+ itemNames: [name],
+ actionDescription: 'remove',
+ submitActionObservable: () =>
+ this.taskWrapper.wrapTaskAroundCall({
+ task: new FinishedTask('cephfs/subvolume/group/remove', { subvolumegroupName: name }),
+ call: this.cephfsSubvolumeGroup.remove(this.fsName, name)
+ })
+ });
+ }
}
{ size: 'lg' }
)
},
+ {
+ name: this.actionLabels.EDIT,
+ permission: 'update',
+ icon: Icons.edit,
+ click: () => this.openModal(true)
+ },
{
name: this.actionLabels.REMOVE,
permission: 'delete',
size: size
});
}
+
+ remove(volName: string, groupName: string) {
+ return this.http.delete(`${this.baseURL}/${volName}`, {
+ params: {
+ group_name: groupName
+ },
+ observe: 'response'
+ });
+ }
}
),
'cephfs/subvolume/group/edit': this.newTaskMessage(this.commonOperations.update, (metadata) =>
this.subvolumegroup(metadata)
+ ),
+ 'cephfs/subvolume/group/remove': this.newTaskMessage(this.commonOperations.remove, (metadata) =>
+ this.subvolumegroup(metadata)
)
};
tags:
- CephfsSubvolumeGroup
/api/cephfs/subvolume/group/{vol_name}:
+ delete:
+ parameters:
+ - in: path
+ name: vol_name
+ required: true
+ schema:
+ type: string
+ - in: query
+ name: group_name
+ required: true
+ schema:
+ type: string
+ responses:
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '204':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource deleted.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ tags:
+ - CephfsSubvolumeGroup
get:
parameters:
- in: path