]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Fix failing QA test: test_safe_to_destroy
authorPatrick Nawracay <pnawracay@suse.com>
Sat, 17 Nov 2018 21:03:22 +0000 (22:03 +0100)
committerPatrick Nawracay <pnawracay@suse.com>
Mon, 19 Nov 2018 13:02:14 +0000 (14:02 +0100)
The behavior of `safe-to-destroy` has changed in
432f19435523d455ecd4f386e58ee1f033cf97e2 (PR#24799) and the backend
needs to be adapted accordingly.

Fixes: http://tracker.ceph.com/issues/37290
Signed-off-by: Patrick Nawracay <pnawracay@suse.com>
qa/tasks/mgr/dashboard/test_osd.py
src/pybind/mgr/dashboard/controllers/osd.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html

index e85a718691c8bafe060a316d652cc762736cd175..46a773060a38e261aa2aa01831038571bad726e2 100644 (file)
@@ -102,12 +102,18 @@ class OsdTest(DashboardTestCase):
         unused_osd_id = max(map(lambda e: e['osd'], osd_dump['osds'])) + 10
         self._get('/api/osd/{}/safe_to_destroy'.format(unused_osd_id))
         self.assertStatus(200)
-        self.assertJsonBody({'safe-to-destroy': True})
+        self.assertJsonBody({
+            'is_safe_to_destroy': True,
+            'active': [],
+            'missing_stats': [],
+            'safe_to_destroy': [unused_osd_id],
+            'stored_pgs': [],
+        })
 
         def get_destroy_status():
             self._get('/api/osd/0/safe_to_destroy')
-            if 'safe-to-destroy' in self.jsonBody():
-                return self.jsonBody()['safe-to-destroy']
+            if 'is_safe_to_destroy' in self.jsonBody():
+                return self.jsonBody()['is_safe_to_destroy']
             return None
         self.wait_until_equal(get_destroy_status, False, 10)
         self.assertStatus(200)
index a5f5e2f613bdb3572f641f2ba64ca44cb7400336..08c141c8842c8246042d9d8c5c661c980557dea7 100644 (file)
@@ -168,13 +168,15 @@ class Osd(RESTController):
             svc_id = [svc_id]
         svc_id = list(map(str, svc_id))
         try:
-            CephService.send_command(
+            result = CephService.send_command(
                 'mon', 'osd safe-to-destroy', ids=svc_id, target=('mgr', ''))
-            return {'safe-to-destroy': True}
+            result['is_safe_to_destroy'] = set(result['safe_to_destroy']) == set(map(int, svc_id))
+            return result
+
         except SendCommandError as e:
             return {
                 'message': str(e),
-                'safe-to-destroy': False,
+                'is_safe_to_destroy': False,
             }
 
 
index dffa66292daad4d076c90524f8510fda1531dfd9..96fb807a2e882756ddd2eb8462751d975e17d986 100644 (file)
 <ng-template #criticalConfirmationTpl
              let-safeToDestroyResult="result"
              let-actionDescription="actionDescription">
-  <div *ngIf="!safeToDestroyResult['safe-to-destroy']"
+  <div *ngIf="!safeToDestroyResult['is_safe_to_destroy']"
        class="danger">
-    <cd-warning-panel>
-      {{ safeToDestroyResult.message }}
+    <cd-warning-panel i18n>
+      The OSD is not safe to destroy!
     </cd-warning-panel>
   </div>
   <ng-container i18n><strong>OSD {{ selection.first().id }}</strong> will be