Replace thin/thick capabilities with thin_provisioning
According to new common capabilities documentation Manila has common capability thin_provisioning with boolean value. That's why instances of thin_provisioning_support and thick_provisioning_support capabilities should be replaced with thin_provisioning=True/False. Depends-On: I2c5bdf5ef9bfd6c8e7e06dac1fde08ad56cc6af1 Change-Id: If366fb242e4903f0b2693132d312b9318f4d89a4 Partial-Bug: #1487467
This commit is contained in:
parent
e46502a8a4
commit
6c63dee78f
@ -78,13 +78,13 @@ class CapacityFilter(filters.BaseHostFilter):
|
|||||||
"%(requested)s/%(available)s", msg_args)
|
"%(requested)s/%(available)s", msg_args)
|
||||||
|
|
||||||
# NOTE(xyang): Only evaluate using max_over_subscription_ratio
|
# NOTE(xyang): Only evaluate using max_over_subscription_ratio
|
||||||
# if thin_provisioning_support is True. Check if the ratio of
|
# if thin_provisioning is True. Check if the ratio of
|
||||||
# provisioned capacity over total capacity would exceed
|
# provisioned capacity over total capacity would exceed
|
||||||
# subscription ratio.
|
# subscription ratio.
|
||||||
# If max_over_subscription_ratio = 1, the provisioned_ratio
|
# If max_over_subscription_ratio = 1, the provisioned_ratio
|
||||||
# should still be limited by the max_over_subscription_ratio;
|
# should still be limited by the max_over_subscription_ratio;
|
||||||
# otherwise, it could result in infinite provisioning.
|
# otherwise, it could result in infinite provisioning.
|
||||||
if (host_state.thin_provisioning_support and
|
if (host_state.thin_provisioning and
|
||||||
host_state.max_over_subscription_ratio >= 1):
|
host_state.max_over_subscription_ratio >= 1):
|
||||||
provisioned_ratio = ((host_state.provisioned_capacity_gb +
|
provisioned_ratio = ((host_state.provisioned_capacity_gb +
|
||||||
share_size) / total)
|
share_size) / total)
|
||||||
@ -105,7 +105,7 @@ class CapacityFilter(filters.BaseHostFilter):
|
|||||||
adjusted_free_virtual = (
|
adjusted_free_virtual = (
|
||||||
free * host_state.max_over_subscription_ratio)
|
free * host_state.max_over_subscription_ratio)
|
||||||
return adjusted_free_virtual >= share_size
|
return adjusted_free_virtual >= share_size
|
||||||
elif host_state.thin_provisioning_support:
|
elif host_state.thin_provisioning:
|
||||||
LOG.error(_LE("Invalid max_over_subscription_ratio: %(ratio)s. "
|
LOG.error(_LE("Invalid max_over_subscription_ratio: %(ratio)s. "
|
||||||
"Valid value should be >= 1."),
|
"Valid value should be >= 1."),
|
||||||
{"ratio": host_state.max_over_subscription_ratio})
|
{"ratio": host_state.max_over_subscription_ratio})
|
||||||
|
@ -120,8 +120,7 @@ class HostState(object):
|
|||||||
# equal to the allocated_capacity_gb.
|
# equal to the allocated_capacity_gb.
|
||||||
self.provisioned_capacity_gb = 0
|
self.provisioned_capacity_gb = 0
|
||||||
self.max_over_subscription_ratio = 1.0
|
self.max_over_subscription_ratio = 1.0
|
||||||
self.thin_provisioning_support = False
|
self.thin_provisioning = False
|
||||||
self.thick_provisioning_support = False
|
|
||||||
self.driver_handles_share_servers = False
|
self.driver_handles_share_servers = False
|
||||||
self.snapshot_support = True
|
self.snapshot_support = True
|
||||||
|
|
||||||
@ -343,10 +342,8 @@ class PoolState(HostState):
|
|||||||
self.max_over_subscription_ratio = capability.get(
|
self.max_over_subscription_ratio = capability.get(
|
||||||
'max_over_subscription_ratio',
|
'max_over_subscription_ratio',
|
||||||
CONF.max_over_subscription_ratio)
|
CONF.max_over_subscription_ratio)
|
||||||
self.thin_provisioning_support = capability.get(
|
self.thin_provisioning = capability.get(
|
||||||
'thin_provisioning_support', False)
|
'thin_provisioning', False)
|
||||||
self.thick_provisioning_support = capability.get(
|
|
||||||
'thick_provisioning_support', False)
|
|
||||||
|
|
||||||
def update_pools(self, capability):
|
def update_pools(self, capability):
|
||||||
# Do nothing, since we don't have pools within pool, yet
|
# Do nothing, since we don't have pools within pool, yet
|
||||||
|
@ -61,7 +61,7 @@ class CapacityWeigher(weights.BaseHostWeigher):
|
|||||||
free = float('inf')
|
free = float('inf')
|
||||||
else:
|
else:
|
||||||
total = float(total_space)
|
total = float(total_space)
|
||||||
if host_state.thin_provisioning_support:
|
if host_state.thin_provisioning:
|
||||||
# NOTE(xyang): Calculate virtual free capacity for thin
|
# NOTE(xyang): Calculate virtual free capacity for thin
|
||||||
# provisioning.
|
# provisioning.
|
||||||
free = math.floor(
|
free = math.floor(
|
||||||
|
@ -37,24 +37,21 @@ SERVICE_STATES_NO_POOLS = {
|
|||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
provisioned_capacity_gb=312,
|
provisioned_capacity_gb=312,
|
||||||
max_over_subscription_ratio=1.0,
|
max_over_subscription_ratio=1.0,
|
||||||
thin_provisioning_support=False,
|
thin_provisioning=False,
|
||||||
thick_provisioning_support=True,
|
|
||||||
driver_handles_share_servers=False),
|
driver_handles_share_servers=False),
|
||||||
'host2@back1': dict(share_backend_name='BBB',
|
'host2@back1': dict(share_backend_name='BBB',
|
||||||
total_capacity_gb=256, free_capacity_gb=100,
|
total_capacity_gb=256, free_capacity_gb=100,
|
||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
provisioned_capacity_gb=400,
|
provisioned_capacity_gb=400,
|
||||||
max_over_subscription_ratio=2.0,
|
max_over_subscription_ratio=2.0,
|
||||||
thin_provisioning_support=True,
|
thin_provisioning=True,
|
||||||
thick_provisioning_support=False,
|
|
||||||
driver_handles_share_servers=False),
|
driver_handles_share_servers=False),
|
||||||
'host2@back2': dict(share_backend_name='CCC',
|
'host2@back2': dict(share_backend_name='CCC',
|
||||||
total_capacity_gb=10000, free_capacity_gb=700,
|
total_capacity_gb=10000, free_capacity_gb=700,
|
||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
provisioned_capacity_gb=50000,
|
provisioned_capacity_gb=50000,
|
||||||
max_over_subscription_ratio=20.0,
|
max_over_subscription_ratio=20.0,
|
||||||
thin_provisioning_support=True,
|
thin_provisioning=True,
|
||||||
thick_provisioning_support=True,
|
|
||||||
driver_handles_share_servers=False),
|
driver_handles_share_servers=False),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +80,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
|
|||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=10,
|
provisioned_capacity_gb=10,
|
||||||
max_over_subscription_ratio=1.0,
|
max_over_subscription_ratio=1.0,
|
||||||
thin_provisioning_support=False,
|
thin_provisioning=False)]),
|
||||||
thick_provisioning_support=True)]),
|
|
||||||
'host2@BBB': dict(share_backend_name='BBB',
|
'host2@BBB': dict(share_backend_name='BBB',
|
||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
driver_handles_share_servers=False,
|
driver_handles_share_servers=False,
|
||||||
@ -95,8 +91,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
|
|||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=60,
|
provisioned_capacity_gb=60,
|
||||||
max_over_subscription_ratio=2.0,
|
max_over_subscription_ratio=2.0,
|
||||||
thin_provisioning_support=True,
|
thin_provisioning=True)]),
|
||||||
thick_provisioning_support=False)]),
|
|
||||||
'host3@CCC': dict(share_backend_name='CCC',
|
'host3@CCC': dict(share_backend_name='CCC',
|
||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
driver_handles_share_servers=False,
|
driver_handles_share_servers=False,
|
||||||
@ -107,8 +102,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
|
|||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=100,
|
provisioned_capacity_gb=100,
|
||||||
max_over_subscription_ratio=20.0,
|
max_over_subscription_ratio=20.0,
|
||||||
thin_provisioning_support=True,
|
thin_provisioning=True)]),
|
||||||
thick_provisioning_support=True)]),
|
|
||||||
'host4@DDD': dict(share_backend_name='DDD',
|
'host4@DDD': dict(share_backend_name='DDD',
|
||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
driver_handles_share_servers=False,
|
driver_handles_share_servers=False,
|
||||||
@ -119,16 +113,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
|
|||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=800,
|
provisioned_capacity_gb=800,
|
||||||
max_over_subscription_ratio=2.0,
|
max_over_subscription_ratio=2.0,
|
||||||
thin_provisioning_support=True,
|
thin_provisioning=True),
|
||||||
thick_provisioning_support=False),
|
|
||||||
dict(pool_name='pool4b',
|
dict(pool_name='pool4b',
|
||||||
total_capacity_gb=542,
|
total_capacity_gb=542,
|
||||||
free_capacity_gb=442,
|
free_capacity_gb=442,
|
||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=2000,
|
provisioned_capacity_gb=2000,
|
||||||
max_over_subscription_ratio=10.0,
|
max_over_subscription_ratio=10.0,
|
||||||
thin_provisioning_support=True,
|
thin_provisioning=True)]),
|
||||||
thick_provisioning_support=False)]),
|
|
||||||
'host5@EEE': dict(share_backend_name='EEE',
|
'host5@EEE': dict(share_backend_name='EEE',
|
||||||
timestamp=None, reserved_percentage=0,
|
timestamp=None, reserved_percentage=0,
|
||||||
driver_handles_share_servers=False,
|
driver_handles_share_servers=False,
|
||||||
@ -139,16 +131,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
|
|||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=100,
|
provisioned_capacity_gb=100,
|
||||||
max_over_subscription_ratio=1.0,
|
max_over_subscription_ratio=1.0,
|
||||||
thin_provisioning_support=False,
|
thin_provisioning=False),
|
||||||
thick_provisioning_support=True),
|
|
||||||
dict(pool_name='pool5b',
|
dict(pool_name='pool5b',
|
||||||
total_capacity_gb=552,
|
total_capacity_gb=552,
|
||||||
free_capacity_gb=452,
|
free_capacity_gb=452,
|
||||||
reserved_percentage=0,
|
reserved_percentage=0,
|
||||||
provisioned_capacity_gb=100,
|
provisioned_capacity_gb=100,
|
||||||
max_over_subscription_ratio=1.0,
|
max_over_subscription_ratio=1.0,
|
||||||
thin_provisioning_support=False,
|
thin_provisioning=False)]),
|
||||||
thick_provisioning_support=True)]),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,8 +158,7 @@ class FakeHostManager(host_manager.HostManager):
|
|||||||
'allocated_capacity_gb': 0,
|
'allocated_capacity_gb': 0,
|
||||||
'provisioned_capacity_gb': 0,
|
'provisioned_capacity_gb': 0,
|
||||||
'max_over_subscription_ratio': 1.0,
|
'max_over_subscription_ratio': 1.0,
|
||||||
'thin_provisioning_support': False,
|
'thin_provisioning': False,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'reserved_percentage': 10,
|
'reserved_percentage': 10,
|
||||||
'timestamp': None},
|
'timestamp': None},
|
||||||
'host2': {'total_capacity_gb': 2048,
|
'host2': {'total_capacity_gb': 2048,
|
||||||
@ -177,8 +166,7 @@ class FakeHostManager(host_manager.HostManager):
|
|||||||
'allocated_capacity_gb': 1748,
|
'allocated_capacity_gb': 1748,
|
||||||
'provisioned_capacity_gb': 1748,
|
'provisioned_capacity_gb': 1748,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'reserved_percentage': 10,
|
'reserved_percentage': 10,
|
||||||
'timestamp': None},
|
'timestamp': None},
|
||||||
'host3': {'total_capacity_gb': 512,
|
'host3': {'total_capacity_gb': 512,
|
||||||
@ -186,8 +174,7 @@ class FakeHostManager(host_manager.HostManager):
|
|||||||
'allocated_capacity_gb': 256,
|
'allocated_capacity_gb': 256,
|
||||||
'provisioned_capacity_gb': 256,
|
'provisioned_capacity_gb': 256,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': False,
|
'thin_provisioning': False,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'timestamp': None},
|
'timestamp': None},
|
||||||
'host4': {'total_capacity_gb': 2048,
|
'host4': {'total_capacity_gb': 2048,
|
||||||
@ -195,8 +182,7 @@ class FakeHostManager(host_manager.HostManager):
|
|||||||
'allocated_capacity_gb': 1848,
|
'allocated_capacity_gb': 1848,
|
||||||
'provisioned_capacity_gb': 1848,
|
'provisioned_capacity_gb': 1848,
|
||||||
'max_over_subscription_ratio': 1.0,
|
'max_over_subscription_ratio': 1.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'reserved_percentage': 5,
|
'reserved_percentage': 5,
|
||||||
'timestamp': None},
|
'timestamp': None},
|
||||||
'host5': {'total_capacity_gb': 2048,
|
'host5': {'total_capacity_gb': 2048,
|
||||||
@ -204,8 +190,7 @@ class FakeHostManager(host_manager.HostManager):
|
|||||||
'allocated_capacity_gb': 1548,
|
'allocated_capacity_gb': 1548,
|
||||||
'provisioned_capacity_gb': 1548,
|
'provisioned_capacity_gb': 1548,
|
||||||
'max_over_subscription_ratio': 1.5,
|
'max_over_subscription_ratio': 1.5,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'reserved_percentage': 5,
|
'reserved_percentage': 5,
|
||||||
'timestamp': None},
|
'timestamp': None},
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class CapacityWeigherTestCase(test.TestCase):
|
|||||||
ctxt, CONF.share_topic)
|
ctxt, CONF.share_topic)
|
||||||
return host_states
|
return host_states
|
||||||
|
|
||||||
# NOTE(xyang): If thin_provisioning_support = True and
|
# NOTE(xyang): If thin_provisioning = True and
|
||||||
# max_over_subscription_ratio >= 1, use the following formula:
|
# max_over_subscription_ratio >= 1, use the following formula:
|
||||||
# free = math.floor(total * host_state.max_over_subscription_ratio
|
# free = math.floor(total * host_state.max_over_subscription_ratio
|
||||||
# - host_state.provisioned_capacity_gb
|
# - host_state.provisioned_capacity_gb
|
||||||
@ -64,25 +64,25 @@ class CapacityWeigherTestCase(test.TestCase):
|
|||||||
def test_default_of_spreading_first(self):
|
def test_default_of_spreading_first(self):
|
||||||
hostinfo_list = self._get_all_hosts()
|
hostinfo_list = self._get_all_hosts()
|
||||||
|
|
||||||
# host1: thin_provisioning_support = False
|
# host1: thin_provisioning = False
|
||||||
# free_capacity_gb = 1024
|
# free_capacity_gb = 1024
|
||||||
# free = math.floor(1024 - 1024 * 0.1) = 921.0
|
# free = math.floor(1024 - 1024 * 0.1) = 921.0
|
||||||
# weight = 0.40
|
# weight = 0.40
|
||||||
# host2: thin_provisioning_support = True
|
# host2: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 2.0
|
# max_over_subscription_ratio = 2.0
|
||||||
# free_capacity_gb = 300
|
# free_capacity_gb = 300
|
||||||
# free = math.floor(2048 * 2.0 - 1748 - 2048 * 0.1)=2143.0
|
# free = math.floor(2048 * 2.0 - 1748 - 2048 * 0.1)=2143.0
|
||||||
# weight = 1.0
|
# weight = 1.0
|
||||||
# host3: thin_provisioning_support = False
|
# host3: thin_provisioning = False
|
||||||
# free_capacity_gb = 512
|
# free_capacity_gb = 512
|
||||||
# free = math.floor(256 - 512 * 0)=256.0
|
# free = math.floor(256 - 512 * 0)=256.0
|
||||||
# weight = 0.08
|
# weight = 0.08
|
||||||
# host4: thin_provisioning_support = True
|
# host4: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 1.0
|
# max_over_subscription_ratio = 1.0
|
||||||
# free_capacity_gb = 200
|
# free_capacity_gb = 200
|
||||||
# free = math.floor(2048 * 1.0 - 1848 - 2048 * 0.05) = 97.0
|
# free = math.floor(2048 * 1.0 - 1848 - 2048 * 0.05) = 97.0
|
||||||
# weight = 0.0
|
# weight = 0.0
|
||||||
# host5: thin_provisioning_support = True
|
# host5: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 1.5
|
# max_over_subscription_ratio = 1.5
|
||||||
# free_capacity_gb = 500
|
# free_capacity_gb = 500
|
||||||
# free = math.floor(2048 * 1.5 - 1548 - 2048 * 0.05) = 1421.0
|
# free = math.floor(2048 * 1.5 - 1548 - 2048 * 0.05) = 1421.0
|
||||||
@ -98,29 +98,29 @@ class CapacityWeigherTestCase(test.TestCase):
|
|||||||
self.flags(capacity_weight_multiplier=-1.0)
|
self.flags(capacity_weight_multiplier=-1.0)
|
||||||
hostinfo_list = self._get_all_hosts()
|
hostinfo_list = self._get_all_hosts()
|
||||||
|
|
||||||
# host1: thin_provisioning_support = False
|
# host1: thin_provisioning = False
|
||||||
# free_capacity_gb = 1024
|
# free_capacity_gb = 1024
|
||||||
# free = math.floor(1024 - 1024 * 0.1) = 921.0
|
# free = math.floor(1024 - 1024 * 0.1) = 921.0
|
||||||
# free * (-1) = -921.0
|
# free * (-1) = -921.0
|
||||||
# weight = -0.40
|
# weight = -0.40
|
||||||
# host2: thin_provisioning_support = True
|
# host2: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 2.0
|
# max_over_subscription_ratio = 2.0
|
||||||
# free_capacity_gb = 300
|
# free_capacity_gb = 300
|
||||||
# free = math.floor(2048 * 2.0-1748-2048 * 0.1) = 2143.0
|
# free = math.floor(2048 * 2.0-1748-2048 * 0.1) = 2143.0
|
||||||
# free * (-1) = -2143.0
|
# free * (-1) = -2143.0
|
||||||
# weight = -1.0
|
# weight = -1.0
|
||||||
# host3: thin_provisioning_support = False
|
# host3: thin_provisioning = False
|
||||||
# free_capacity_gb = 512
|
# free_capacity_gb = 512
|
||||||
# free = math.floor(256 - 512 * 0) = 256.0
|
# free = math.floor(256 - 512 * 0) = 256.0
|
||||||
# free * (-1) = -256.0
|
# free * (-1) = -256.0
|
||||||
# weight = -0.08
|
# weight = -0.08
|
||||||
# host4: thin_provisioning_support = True
|
# host4: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 1.0
|
# max_over_subscription_ratio = 1.0
|
||||||
# free_capacity_gb = 200
|
# free_capacity_gb = 200
|
||||||
# free = math.floor(2048 * 1.0 - 1848 - 2048 * 0.05) = 97.0
|
# free = math.floor(2048 * 1.0 - 1848 - 2048 * 0.05) = 97.0
|
||||||
# free * (-1) = -97.0
|
# free * (-1) = -97.0
|
||||||
# weight = 0.0
|
# weight = 0.0
|
||||||
# host5: thin_provisioning_support = True
|
# host5: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 1.5
|
# max_over_subscription_ratio = 1.5
|
||||||
# free_capacity_gb = 500
|
# free_capacity_gb = 500
|
||||||
# free = math.floor(2048 * 1.5 - 1548 - 2048 * 0.05) = 1421.0
|
# free = math.floor(2048 * 1.5 - 1548 - 2048 * 0.05) = 1421.0
|
||||||
@ -137,29 +137,29 @@ class CapacityWeigherTestCase(test.TestCase):
|
|||||||
self.flags(capacity_weight_multiplier=2.0)
|
self.flags(capacity_weight_multiplier=2.0)
|
||||||
hostinfo_list = self._get_all_hosts()
|
hostinfo_list = self._get_all_hosts()
|
||||||
|
|
||||||
# host1: thin_provisioning_support = False
|
# host1: thin_provisioning = False
|
||||||
# free_capacity_gb = 1024
|
# free_capacity_gb = 1024
|
||||||
# free = math.floor(1024-1024*0.1) = 921.0
|
# free = math.floor(1024-1024*0.1) = 921.0
|
||||||
# free * 2 = 1842.0
|
# free * 2 = 1842.0
|
||||||
# weight = 0.81
|
# weight = 0.81
|
||||||
# host2: thin_provisioning_support = True
|
# host2: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 2.0
|
# max_over_subscription_ratio = 2.0
|
||||||
# free_capacity_gb = 300
|
# free_capacity_gb = 300
|
||||||
# free = math.floor(2048 * 2.0 - 1748 - 2048 * 0.1) = 2143.0
|
# free = math.floor(2048 * 2.0 - 1748 - 2048 * 0.1) = 2143.0
|
||||||
# free * 2 = 4286.0
|
# free * 2 = 4286.0
|
||||||
# weight = 2.0
|
# weight = 2.0
|
||||||
# host3: thin_provisioning_support = False
|
# host3: thin_provisioning = False
|
||||||
# free_capacity_gb = 512
|
# free_capacity_gb = 512
|
||||||
# free = math.floor(256 - 512 * 0) = 256.0
|
# free = math.floor(256 - 512 * 0) = 256.0
|
||||||
# free * 2 = 512.0
|
# free * 2 = 512.0
|
||||||
# weight = 0.16
|
# weight = 0.16
|
||||||
# host4: thin_provisioning_support = True
|
# host4: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 1.0
|
# max_over_subscription_ratio = 1.0
|
||||||
# free_capacity_gb = 200
|
# free_capacity_gb = 200
|
||||||
# free = math.floor(2048 * 1.0 - 1848 - 2048 * 0.05) = 97.0
|
# free = math.floor(2048 * 1.0 - 1848 - 2048 * 0.05) = 97.0
|
||||||
# free * 2 = 194.0
|
# free * 2 = 194.0
|
||||||
# weight = 0.0
|
# weight = 0.0
|
||||||
# host5: thin_provisioning_support = True
|
# host5: thin_provisioning = True
|
||||||
# max_over_subscription_ratio = 1.5
|
# max_over_subscription_ratio = 1.5
|
||||||
# free_capacity_gb = 500
|
# free_capacity_gb = 500
|
||||||
# free = math.floor(2048 * 1.5 - 1548 - 2048 * 0.05) = 1421.0
|
# free = math.floor(2048 * 1.5 - 1548 - 2048 * 0.05) = 1421.0
|
||||||
|
@ -129,45 +129,34 @@ class HostFiltersTestCase(test.TestCase):
|
|||||||
self.assertFalse(filt_cls.host_passes(host, filter_properties))
|
self.assertFalse(filt_cls.host_passes(host, filter_properties))
|
||||||
|
|
||||||
@ddt.data(
|
@ddt.data(
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
'total': 500, 'free': 200, 'provisioned': 500,
|
'total': 500, 'free': 200, 'provisioned': 500,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 3000, 'cap_thin': '<is> True',
|
||||||
{'size': 3000, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 200, 'provisioned': 7000,
|
'total': 500, 'free': 200, 'provisioned': 7000,
|
||||||
'max_ratio': 20, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 20, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 100, 'cap_thin': '<is> False',
|
||||||
{'size': 100, 'cap_thin': '<is> False', 'cap_thick': '<is> True',
|
|
||||||
'total': 500, 'free': 200, 'provisioned': 300,
|
'total': 500, 'free': 200, 'provisioned': 300,
|
||||||
'max_ratio': 1.0, 'reserved': 5, 'thin_prov': False,
|
'max_ratio': 1.0, 'reserved': 5, 'thin_prov': False},
|
||||||
'thick_prov': True},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 200, 'provisioned': 400,
|
'total': 500, 'free': 200, 'provisioned': 400,
|
||||||
'max_ratio': 1.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 1.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> True',
|
|
||||||
'total': 500, 'free': 125, 'provisioned': 400,
|
'total': 500, 'free': 125, 'provisioned': 400,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': True},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 80, 'provisioned': 600,
|
'total': 500, 'free': 80, 'provisioned': 600,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> True',
|
|
||||||
'total': 500, 'free': 100, 'provisioned': 400,
|
'total': 500, 'free': 100, 'provisioned': 400,
|
||||||
'max_ratio': 2.0, 'reserved': 0, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 0, 'thin_prov': True})
|
||||||
'thick_prov': True})
|
|
||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
def test_filter_thin_thick_passes(self, size, cap_thin, cap_thick,
|
def test_filter_thin_passes(self, size, cap_thin, total, free, provisioned,
|
||||||
total, free, provisioned, max_ratio,
|
max_ratio, reserved, thin_prov):
|
||||||
reserved, thin_prov, thick_prov):
|
|
||||||
self._stub_service_is_up(True)
|
self._stub_service_is_up(True)
|
||||||
filt_cls = self.class_map['CapacityFilter']()
|
filt_cls = self.class_map['CapacityFilter']()
|
||||||
filter_properties = {'size': size,
|
filter_properties = {'size': size,
|
||||||
'capabilities:thin_provisioning_support':
|
'capabilities:thin_provisioning': cap_thin}
|
||||||
cap_thin,
|
|
||||||
'capabilities:thick_provisioning_support':
|
|
||||||
cap_thick}
|
|
||||||
service = {'disabled': False}
|
service = {'disabled': False}
|
||||||
host = fakes.FakeHostState('host1',
|
host = fakes.FakeHostState('host1',
|
||||||
{'total_capacity_gb': total,
|
{'total_capacity_gb': total,
|
||||||
@ -175,56 +164,43 @@ class HostFiltersTestCase(test.TestCase):
|
|||||||
'provisioned_capacity_gb': provisioned,
|
'provisioned_capacity_gb': provisioned,
|
||||||
'max_over_subscription_ratio': max_ratio,
|
'max_over_subscription_ratio': max_ratio,
|
||||||
'reserved_percentage': reserved,
|
'reserved_percentage': reserved,
|
||||||
'thin_provisioning_support': thin_prov,
|
'thin_provisioning': thin_prov,
|
||||||
'thick_provisioning_support': thick_prov,
|
|
||||||
'updated_at': None,
|
'updated_at': None,
|
||||||
'service': service})
|
'service': service})
|
||||||
self.assertTrue(filt_cls.host_passes(host, filter_properties))
|
self.assertTrue(filt_cls.host_passes(host, filter_properties))
|
||||||
|
|
||||||
@ddt.data(
|
@ddt.data(
|
||||||
{'size': 200, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
{'size': 200, 'cap_thin': '<is> True',
|
||||||
'total': 500, 'free': 100, 'provisioned': 400,
|
'total': 500, 'free': 100, 'provisioned': 400,
|
||||||
'max_ratio': 0.8, 'reserved': 0, 'thin_prov': True,
|
'max_ratio': 0.8, 'reserved': 0, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 200, 'provisioned': 700,
|
'total': 500, 'free': 200, 'provisioned': 700,
|
||||||
'max_ratio': 1.5, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 1.5, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 2000, 'cap_thin': '<is> True',
|
||||||
{'size': 2000, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 30, 'provisioned': 9000,
|
'total': 500, 'free': 30, 'provisioned': 9000,
|
||||||
'max_ratio': 20.0, 'reserved': 0, 'thin_prov': True,
|
'max_ratio': 20.0, 'reserved': 0, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 100, 'provisioned': 1000,
|
'total': 500, 'free': 100, 'provisioned': 1000,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': False},
|
{'size': 100, 'cap_thin': '<is> False',
|
||||||
{'size': 100, 'cap_thin': '<is> False', 'cap_thick': '<is> True',
|
|
||||||
'total': 500, 'free': 100, 'provisioned': 400,
|
'total': 500, 'free': 100, 'provisioned': 400,
|
||||||
'max_ratio': 1.0, 'reserved': 5, 'thin_prov': False,
|
'max_ratio': 1.0, 'reserved': 5, 'thin_prov': False},
|
||||||
'thick_prov': True},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> True',
|
|
||||||
'total': 500, 'free': 0, 'provisioned': 800,
|
'total': 500, 'free': 0, 'provisioned': 800,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': True},
|
{'size': 100, 'cap_thin': '<is> True',
|
||||||
{'size': 100, 'cap_thin': '<is> True', 'cap_thick': '<is> True',
|
|
||||||
'total': 500, 'free': 99, 'provisioned': 1000,
|
'total': 500, 'free': 99, 'provisioned': 1000,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True},
|
||||||
'thick_prov': True},
|
{'size': 400, 'cap_thin': '<is> True',
|
||||||
{'size': 400, 'cap_thin': '<is> True', 'cap_thick': '<is> False',
|
|
||||||
'total': 500, 'free': 200, 'provisioned': 600,
|
'total': 500, 'free': 200, 'provisioned': 600,
|
||||||
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True,
|
'max_ratio': 2.0, 'reserved': 5, 'thin_prov': True})
|
||||||
'thick_prov': False})
|
|
||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
def test_filter_thin_thick_fails(self, size, cap_thin, cap_thick,
|
def test_filter_thin_fails(self, size, cap_thin, total, free, provisioned,
|
||||||
total, free, provisioned, max_ratio,
|
max_ratio, reserved, thin_prov):
|
||||||
reserved, thin_prov, thick_prov):
|
|
||||||
self._stub_service_is_up(True)
|
self._stub_service_is_up(True)
|
||||||
filt_cls = self.class_map['CapacityFilter']()
|
filt_cls = self.class_map['CapacityFilter']()
|
||||||
filter_properties = {'size': size,
|
filter_properties = {'size': size,
|
||||||
'capabilities:thin_provisioning_support':
|
'capabilities:thin_provisioning': cap_thin}
|
||||||
cap_thin,
|
|
||||||
'capabilities:thick_provisioning_support':
|
|
||||||
cap_thick}
|
|
||||||
service = {'disabled': False}
|
service = {'disabled': False}
|
||||||
host = fakes.FakeHostState('host1',
|
host = fakes.FakeHostState('host1',
|
||||||
{'total_capacity_gb': total,
|
{'total_capacity_gb': total,
|
||||||
@ -232,8 +208,7 @@ class HostFiltersTestCase(test.TestCase):
|
|||||||
'provisioned_capacity_gb': provisioned,
|
'provisioned_capacity_gb': provisioned,
|
||||||
'max_over_subscription_ratio': max_ratio,
|
'max_over_subscription_ratio': max_ratio,
|
||||||
'reserved_percentage': reserved,
|
'reserved_percentage': reserved,
|
||||||
'thin_provisioning_support': thin_prov,
|
'thin_provisioning': thin_prov,
|
||||||
'thick_provisioning_support': thick_prov,
|
|
||||||
'updated_at': None,
|
'updated_at': None,
|
||||||
'service': service})
|
'service': service})
|
||||||
self.assertFalse(filt_cls.host_passes(host, filter_properties))
|
self.assertFalse(filt_cls.host_passes(host, filter_properties))
|
||||||
|
@ -190,8 +190,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 312,
|
'provisioned_capacity_gb': 312,
|
||||||
'max_over_subscription_ratio': 1.0,
|
'max_over_subscription_ratio': 1.0,
|
||||||
'thin_provisioning_support': False,
|
'thin_provisioning': False,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -211,8 +210,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 400,
|
'provisioned_capacity_gb': 400,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -232,8 +230,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 50000,
|
'provisioned_capacity_gb': 50000,
|
||||||
'max_over_subscription_ratio': 20.0,
|
'max_over_subscription_ratio': 20.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -275,8 +272,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 10,
|
'provisioned_capacity_gb': 10,
|
||||||
'max_over_subscription_ratio': 1.0,
|
'max_over_subscription_ratio': 1.0,
|
||||||
'thin_provisioning_support': False,
|
'thin_provisioning': False,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -297,8 +293,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 60,
|
'provisioned_capacity_gb': 60,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -319,8 +314,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 100,
|
'provisioned_capacity_gb': 100,
|
||||||
'max_over_subscription_ratio': 20.0,
|
'max_over_subscription_ratio': 20.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -341,8 +335,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 800,
|
'provisioned_capacity_gb': 800,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -363,8 +356,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 2000,
|
'provisioned_capacity_gb': 2000,
|
||||||
'max_over_subscription_ratio': 10.0,
|
'max_over_subscription_ratio': 10.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'driver_handles_share_servers': False,
|
'driver_handles_share_servers': False,
|
||||||
@ -422,8 +414,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'provisioned_capacity_gb': 312,
|
'provisioned_capacity_gb': 312,
|
||||||
'max_over_subscription_ratio': 1.0,
|
'max_over_subscription_ratio': 1.0,
|
||||||
'thin_provisioning_support': False,
|
'thin_provisioning': False,
|
||||||
'thick_provisioning_support': True,
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'name': 'host2@back1#BBB',
|
'name': 'host2@back1#BBB',
|
||||||
@ -443,8 +434,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'storage_protocol': None,
|
'storage_protocol': None,
|
||||||
'provisioned_capacity_gb': 400,
|
'provisioned_capacity_gb': 400,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -488,8 +478,7 @@ class HostManagerTestCase(test.TestCase):
|
|||||||
'reserved_percentage': 0,
|
'reserved_percentage': 0,
|
||||||
'provisioned_capacity_gb': 60,
|
'provisioned_capacity_gb': 60,
|
||||||
'max_over_subscription_ratio': 2.0,
|
'max_over_subscription_ratio': 2.0,
|
||||||
'thin_provisioning_support': True,
|
'thin_provisioning': True,
|
||||||
'thick_provisioning_support': False,
|
|
||||||
'vendor_name': None,
|
'vendor_name': None,
|
||||||
'storage_protocol': None
|
'storage_protocol': None
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user