From 1419346886073ca8b5be4b2a2324bf01a44f7c2b Mon Sep 17 00:00:00 2001 From: Patrick Nawracay Date: Fri, 1 Feb 2019 11:58:22 +0100 Subject: [PATCH] mgr/dashboard: Implement OSD purge Removes the `remove` functionality from the UI. Fixes: http://tracker.ceph.com/issues/35811 Signed-off-by: Patrick Nawracay --- qa/tasks/mgr/dashboard/test_osd.py | 4 ++-- src/pybind/mgr/dashboard/controllers/osd.py | 5 +++-- .../cluster/osd/osd-list/osd-list.component.spec.ts | 4 ++-- .../ceph/cluster/osd/osd-list/osd-list.component.ts | 12 ++++++------ .../frontend/src/app/shared/api/osd.service.spec.ts | 6 +++--- .../frontend/src/app/shared/api/osd.service.ts | 4 ++-- .../mgr/dashboard/frontend/src/locale/messages.xlf | 8 ++++---- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/qa/tasks/mgr/dashboard/test_osd.py b/qa/tasks/mgr/dashboard/test_osd.py index 453c77485d2eb..c6c7c5aadd687 100644 --- a/qa/tasks/mgr/dashboard/test_osd.py +++ b/qa/tasks/mgr/dashboard/test_osd.py @@ -93,8 +93,8 @@ class OsdTest(DashboardTestCase): # Destroy self._post('/api/osd/5/destroy') self.assertStatus(200) - # Remove - self._post('/api/osd/5/remove') + # Purge + self._post('/api/osd/5/purge') self.assertStatus(200) def test_safe_to_destroy(self): diff --git a/src/pybind/mgr/dashboard/controllers/osd.py b/src/pybind/mgr/dashboard/controllers/osd.py index 54c6c5560230b..24de3b4193d53 100644 --- a/src/pybind/mgr/dashboard/controllers/osd.py +++ b/src/pybind/mgr/dashboard/controllers/osd.py @@ -141,11 +141,12 @@ class Osd(RESTController): } @RESTController.Resource('POST') - def remove(self, svc_id): + def purge(self, svc_id): """ Note: osd must be marked `down` before removal. """ - CephService.send_command('mon', 'osd rm', ids=[svc_id]) + CephService.send_command('mon', 'osd purge-actual', id=int(svc_id), + yes_i_really_mean_it=True) @RESTController.Resource('POST') def destroy(self, svc_id): diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts index 7288cee3e26ef..b7e0fca6bf511 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts @@ -181,7 +181,7 @@ describe('OsdListComponent', () => { const modalClass = CriticalConfirmationModalComponent; mockSafeToDestroy(); expectOpensModal('Mark Lost', modalClass); - expectOpensModal('Remove', modalClass); + expectOpensModal('Purge', modalClass); expectOpensModal('Destroy', modalClass); }); }); @@ -216,7 +216,7 @@ describe('OsdListComponent', () => { it('calls the corresponding service methods in critical confirmation modals', () => { mockSafeToDestroy(); expectOsdServiceMethodCalled('Mark Lost', 'markLost'); - expectOsdServiceMethodCalled('Remove', 'remove'); + expectOsdServiceMethodCalled('Purge', 'purge'); expectOsdServiceMethodCalled('Destroy', 'destroy'); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts index 261d8e5e13ef9..f3ecc673bc022 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts @@ -118,17 +118,17 @@ export class OsdListComponent implements OnInit { icon: 'fa-unlink' }, { - name: this.i18n('Remove'), + name: this.i18n('Purge'), permission: 'delete', click: () => this.showCriticalConfirmationModal( - this.i18n('Remove'), + this.i18n('Purge'), this.i18n('OSD'), - this.i18n('removed'), - this.osdService.remove + this.i18n('purged'), + this.osdService.purge ), disable: () => this.isNotSelectedOrInState('up'), - icon: 'fa-remove' + icon: 'fa-eraser' }, { name: this.i18n('Destroy'), @@ -141,7 +141,7 @@ export class OsdListComponent implements OnInit { this.osdService.destroy ), disable: () => this.isNotSelectedOrInState('up'), - icon: 'fa-eraser' + icon: 'fa-remove' } ]; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts index a442642a06bbb..e9225ef1359ca 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts @@ -94,9 +94,9 @@ describe('OsdService', () => { expect(req.request.method).toBe('POST'); }); - it('should remove an OSD', () => { - service.remove(1).subscribe(); - const req = httpTesting.expectOne('api/osd/1/remove'); + it('should purge an OSD', () => { + service.purge(1).subscribe(); + const req = httpTesting.expectOne('api/osd/1/purge'); expect(req.request.method).toBe('POST'); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts index a98d503ae0f2d..06c63bf8c0bda 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts @@ -98,8 +98,8 @@ export class OsdService { return this.http.post(`${this.path}/${id}/mark_lost`, null); } - remove(id: number) { - return this.http.post(`${this.path}/${id}/remove`, null); + purge(id: number) { + return this.http.post(`${this.path}/${id}/purge`, null); } destroy(id: number) { diff --git a/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf b/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf index a6b883cc654ee..9678d47c7b704 100644 --- a/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf +++ b/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf @@ -5064,8 +5064,8 @@ 1 - - Remove + + Purge src/app/ceph/cluster/osd/osd-list/osd-list.component.ts 1 @@ -5086,8 +5086,8 @@ 1 - - removed + + purged src/app/ceph/cluster/osd/osd-list/osd-list.component.ts 1 -- 2.39.5