From: Jason Dillaman Date: Wed, 30 Oct 2019 20:42:16 +0000 (-0400) Subject: mgr/dashboard: fix broken rbd-mirror dashboard API test case X-Git-Tag: v15.1.0~633^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=19272432a24ee3d30142499b0acfcb716e1ddc1e;p=ceph.git mgr/dashboard: fix broken rbd-mirror dashboard API test case Fixes: https://tracker.ceph.com/issues/42512 Signed-off-by: Jason Dillaman --- diff --git a/qa/suites/rados/dashboard/tasks/dashboard.yaml b/qa/suites/rados/dashboard/tasks/dashboard.yaml index 342df3f66be6..9b0e5ca1f919 100644 --- a/qa/suites/rados/dashboard/tasks/dashboard.yaml +++ b/qa/suites/rados/dashboard/tasks/dashboard.yaml @@ -44,6 +44,7 @@ tasks: # - tasks.mgr.dashboard.test_perf_counters - tasks.mgr.dashboard.test_pool - tasks.mgr.dashboard.test_rbd + - tasks.mgr.dashboard.test_rbd_mirroring - tasks.mgr.dashboard.test_requests - tasks.mgr.dashboard.test_rgw - tasks.mgr.dashboard.test_role diff --git a/qa/tasks/mgr/dashboard/test_rbd_mirroring.py b/qa/tasks/mgr/dashboard/test_rbd_mirroring.py index 08d793c2db4f..df719a72601c 100644 --- a/qa/tasks/mgr/dashboard/test_rbd_mirroring.py +++ b/qa/tasks/mgr/dashboard/test_rbd_mirroring.py @@ -140,9 +140,12 @@ class RbdMirroringTest(DashboardTestCase): expected_peer = { 'uuid': uuid, 'cluster_name': 'remote', + 'site_name': 'remote', 'client_id': 'admin', 'mon_host': '', - 'key': '' + 'key': '', + 'direction': 'rx-tx', + 'fsid': '' } peer = self.get_peer('rbd', uuid) self.assertEqual(expected_peer, peer) diff --git a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py index 2fd4c607f5e3..e8f2d84cb331 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py @@ -421,6 +421,14 @@ class RbdMirroringPoolPeer(RESTController): peer['client_id'] = peer['client_name'].split('.', 1)[-1] del peer['client_name'] + # convert direction enum to string + directions = { + rbd.RBD_MIRROR_PEER_DIRECTION_RX: 'rx', + rbd.RBD_MIRROR_PEER_DIRECTION_TX: 'tx', + rbd.RBD_MIRROR_PEER_DIRECTION_RX_TX: 'rx-tx' + } + peer['direction'] = directions[peer.get('direction', rbd.RBD_MIRROR_PEER_DIRECTION_RX)] + try: attributes = rbd.RBD().mirror_peer_get_attributes(ioctx, peer_uuid) except rbd.ImageNotFound: