'Test _enable_replication method.
We want to confirm that if the Ceph backend has globally enabled
\'exclusive_lock\' and \'journaling\'. we don\'t try to enable them
again and we properly indicate with our return value that they were
already enabled.
\'journaling\' depends on \'exclusive_lock\', so if \'exclusive-lock\'
is disabled, \'journaling\' can\'t be enabled so the \'[False. True]\'
case is impossible.
In this test case, there are three test scenarios:
1. \'exclusive_lock\' and \'journaling\' both enabled,
\'image.features()\' will not be called.
2. \'exclusive_lock\' enabled, \'journaling\' disabled,
\'image.features()\' will be only called for \'journaling\'.
3. \'exclusice_lock\' and \'journaling\' are both disabled,
\'image.features()\'will be both called for \'exclusive-lock\' and
\'journaling\' in this order.'

@ddt.data([True, False], [False, False], [True, True])
@ddt.unpack
@common_mocks
def test_enable_replication(self, exclusive_lock_enabled, journaling_enabled):

    journaling_feat = 1
    exclusive_lock_feat = 2
    self.driver.rbd.RBD_FEATURE_JOURNALING = journaling_feat
    self.driver.rbd.RBD_FEATURE_EXCLUSIVE_LOCK = exclusive_lock_feat
    image = self.mock_proxy.return_value.__enter__.return_value
    image.features.return_value = 0
    if exclusive_lock_enabled:
        image.features.return_value += exclusive_lock_feat
    if journaling_enabled:
        image.features.return_value += journaling_feat
    journaling_status = str(journaling_enabled).lower()
    exclusive_lock_status = str(exclusive_lock_enabled).lower()
    expected = {'replication_driver_data': ('{"had_exclusive_lock":%s,"had_journaling":%s}' % (exclusive_lock_status, journaling_status)), 'replication_status': 'enabled'}
    res = self.driver._enable_replication(self.volume_a)
    self.assertEqual(expected, res)
    if (exclusive_lock_enabled and journaling_enabled):
        image.update_features.assert_not_called()
    elif (exclusive_lock_enabled and (not journaling_enabled)):
        image.update_features.assert_called_once_with(journaling_feat, True)
    else:
        calls = [call(exclusive_lock_feat, True), call(journaling_feat, True)]
        image.update_features.assert_has_calls(calls, any_order=False)
    image.mirror_image_enable.assert_called_once_with()
