Merge "Use 'False' as default value for "dedupe" common capability"
This commit is contained in:
commit
022c758712
@ -125,6 +125,7 @@ class HostState(object):
|
||||
self.driver_handles_share_servers = False
|
||||
self.snapshot_support = True
|
||||
self.consistency_group_support = False
|
||||
self.dedupe = False
|
||||
|
||||
# PoolState for all pools
|
||||
self.pools = {}
|
||||
@ -284,6 +285,9 @@ class HostState(object):
|
||||
pool_cap['consistency_group_support'] = \
|
||||
self.consistency_group_support
|
||||
|
||||
if not pool_cap.get('dedupe'):
|
||||
pool_cap['dedupe'] = False
|
||||
|
||||
def update_backend(self, capability):
|
||||
self.share_backend_name = capability.get('share_backend_name')
|
||||
self.vendor_name = capability.get('vendor_name')
|
||||
@ -353,6 +357,8 @@ class PoolState(HostState):
|
||||
CONF.max_over_subscription_ratio)
|
||||
self.thin_provisioning = capability.get(
|
||||
'thin_provisioning', False)
|
||||
self.dedupe = capability.get(
|
||||
'dedupe', False)
|
||||
|
||||
def update_pools(self, capability):
|
||||
# Do nothing, since we don't have pools within pool, yet
|
||||
|
@ -161,6 +161,48 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
self.assertEqual('host5#_pool0', weighed_host.obj.host)
|
||||
self.assertTrue(_mock_service_get_all_by_topic.called)
|
||||
|
||||
def _setup_dedupe_fakes(self, extra_specs):
|
||||
sched = fakes.FakeFilterScheduler()
|
||||
sched.host_manager = fakes.FakeHostManager()
|
||||
fake_context = context.RequestContext('user', 'project', is_admin=True)
|
||||
|
||||
share_type = {'name': 'foo', 'extra_specs': extra_specs}
|
||||
request_spec = {
|
||||
'share_type': share_type,
|
||||
'share_properties': {'project_id': 1, 'size': 1},
|
||||
'share_instance_properties': {'project_id': 1, 'size': 1},
|
||||
}
|
||||
|
||||
return sched, fake_context, request_spec
|
||||
|
||||
@mock.patch('manila.db.service_get_all_by_topic')
|
||||
def test__schedule_share_with_default_dedupe_value(
|
||||
self, _mock_service_get_all_by_topic):
|
||||
sched, fake_context, request_spec = self._setup_dedupe_fakes(
|
||||
{'capabilities:dedupe': '<is> False'})
|
||||
fakes.mock_host_manager_db_calls(_mock_service_get_all_by_topic)
|
||||
|
||||
weighed_host = sched._schedule_share(fake_context, request_spec, {})
|
||||
|
||||
self.assertIsNotNone(weighed_host)
|
||||
self.assertIsNotNone(weighed_host.obj)
|
||||
self.assertTrue(hasattr(weighed_host.obj, 'dedupe'))
|
||||
self.assertFalse(weighed_host.obj.dedupe)
|
||||
self.assertTrue(_mock_service_get_all_by_topic.called)
|
||||
|
||||
@ddt.data('True', '<is> True')
|
||||
@mock.patch('manila.db.service_get_all_by_topic')
|
||||
def test__schedule_share_with_default_dedupe_value_fail(
|
||||
self, capability, _mock_service_get_all_by_topic):
|
||||
sched, fake_context, request_spec = self._setup_dedupe_fakes(
|
||||
{'capabilities:dedupe': capability})
|
||||
fakes.mock_host_manager_db_calls(_mock_service_get_all_by_topic)
|
||||
|
||||
weighed_host = sched._schedule_share(fake_context, request_spec, {})
|
||||
|
||||
self.assertIsNone(weighed_host)
|
||||
self.assertTrue(_mock_service_get_all_by_topic.called)
|
||||
|
||||
def test_schedule_share_type_is_none(self):
|
||||
sched = fakes.FakeFilterScheduler()
|
||||
request_spec = {
|
||||
|
@ -196,6 +196,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host2@back1#BBB',
|
||||
@ -217,6 +218,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host2@back2#CCC',
|
||||
@ -238,6 +240,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
},
|
||||
]
|
||||
@ -281,6 +284,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host2@BBB#pool2',
|
||||
@ -303,6 +307,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host3@CCC#pool3',
|
||||
@ -325,6 +330,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': 'pool',
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host4@DDD#pool4a',
|
||||
@ -347,6 +353,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': 'host',
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host4@DDD#pool4b',
|
||||
@ -369,6 +376,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'driver_handles_share_servers': False,
|
||||
'snapshot_support': True,
|
||||
'consistency_group_support': 'host',
|
||||
'dedupe': False,
|
||||
},
|
||||
},
|
||||
]
|
||||
@ -424,6 +432,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'max_over_subscription_ratio': 1.0,
|
||||
'thin_provisioning': False,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
}, {
|
||||
'name': 'host2@back1#BBB',
|
||||
@ -445,6 +454,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'max_over_subscription_ratio': 2.0,
|
||||
'thin_provisioning': True,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
},
|
||||
]
|
||||
@ -492,6 +502,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
'vendor_name': None,
|
||||
'storage_protocol': None,
|
||||
'consistency_group_support': False,
|
||||
'dedupe': False,
|
||||
},
|
||||
},
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user