Add config option reserved_share_extend_percentage

'reserved_share_extend_percentage' backend config option allows Manila
to consider different reservation percentage for share extend
operation. With this option, under existing limit of
'reserved_share_percentage', we do not want user to create new share if
limit is hit, but allow user to extend existing share.

DocImpact

Closes-Bug: #1961087
Change-Id: I000a7f530569ff80495b1df62a91981dc5865023
This commit is contained in:
Manish Honap 2022-03-09 01:32:25 +05:30
parent 5df22b3320
commit 6431b86f19
69 changed files with 338 additions and 12 deletions

View File

@ -360,6 +360,9 @@ class FilterScheduler(base.Scheduler):
filter_properties['user_id'] = shr.get('user_id')
filter_properties['metadata'] = shr.get('metadata')
filter_properties['snapshot_id'] = shr.get('snapshot_id')
filter_properties['is_share_extend'] = (
request_spec.get('is_share_extend')
)
self.populate_filter_properties_scheduler_hints(context, request_spec,
filter_properties)

View File

@ -44,6 +44,8 @@ class CapacityFilter(base_host.BaseHostFilter):
total_space = host_state.total_capacity_gb
if filter_properties.get('snapshot_id'):
reserved = float(host_state.reserved_snapshot_percentage) / 100
elif filter_properties.get('is_share_extend'):
reserved = float(host_state.reserved_share_extend_percentage) / 100
else:
reserved = float(host_state.reserved_percentage) / 100

View File

@ -131,6 +131,7 @@ class HostState(object):
self.free_capacity_gb = None
self.reserved_percentage = 0
self.reserved_snapshot_percentage = 0
self.reserved_share_extend_percentage = 0
self.allocated_capacity_gb = 0
# NOTE(xyang): The apparent allocated space indicating how much
# capacity has been provisioned. This could be the sum of sizes
@ -191,13 +192,14 @@ class HostState(object):
'pools':[
{
'pool_name': '1st pool', #\
'total_capacity_gb': 500, # mandatory stats
'free_capacity_gb': 230, # for pools
'allocated_capacity_gb': 270, # |
'qos': 'False', # |
'reserved_percentage': 0, # |
'reserved_snapshot_percentage': 0, #/
'pool_name': '1st pool', #\
'total_capacity_gb': 500, # mandatory stats
'free_capacity_gb': 230, # for pools
'allocated_capacity_gb': 270, # |
'qos': 'False', # |
'reserved_percentage': 0, # |
'reserved_snapshot_percentage': 0, # |
'reserved_share_extend_percentage': 0, #/
'dying_disks': 100, #\
'super_hero_1': 'spider-man', # optional custom
@ -213,6 +215,7 @@ class HostState(object):
'qos': 'False',
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'dying_disks': 200,
'super_hero_1': 'superman',
@ -456,6 +459,8 @@ class PoolState(HostState):
self.reserved_percentage = capability['reserved_percentage']
self.reserved_snapshot_percentage = (
capability['reserved_snapshot_percentage'])
self.reserved_share_extend_percentage = (
capability['reserved_share_extend_percentage'])
self.thin_provisioning = scheduler_utils.thin_provisioning(
capability.get('thin_provisioning', False))
# NOTE(xyang): provisioned_capacity_gb is the apparent total

View File

@ -38,6 +38,8 @@ def generate_stats(host_state, properties):
'reserved_percentage': host_state.reserved_percentage,
'reserved_snapshot_percentage':
host_state.reserved_snapshot_percentage,
'reserved_share_extend_percentage':
host_state.reserved_share_extend_percentage,
'driver_handles_share_servers':
host_state.driver_handles_share_servers,
'thin_provisioning': host_state.thin_provisioning,

View File

@ -54,6 +54,8 @@ class CapacityWeigher(base_host.BaseHostWeigher):
"""Higher weighers win. We want spreading to be the default."""
if weight_properties.get('snapshot_id'):
reserved = float(host_state.reserved_snapshot_percentage) / 100
elif weight_properties.get('is_share_extend'):
reserved = float(host_state.reserved_share_extend_percentage) / 100
else:
reserved = float(host_state.reserved_percentage) / 100

View File

@ -2389,6 +2389,7 @@ class API(base.Base):
context, share['instance']['share_type_id'])
request_spec = self._get_request_spec_dict(share, share_type,
context)
request_spec.update({'is_share_extend': True})
self.scheduler_rpcapi.extend_share(context, share['id'], new_size,
reservations, request_spec)
LOG.info("Extend share request issued successfully.",

View File

@ -51,6 +51,13 @@ share_opts = [
"taken, so we can set a lower value in this option compared to "
"reserved_share_percentage, and allow to create shares from the "
"snapshot on the same host up to a higher threshold."),
cfg.IntOpt(
'reserved_share_extend_percentage',
default=0,
help="The percentage of backend capacity reserved for share extend "
"operation. When existing limit of 'reserved_share_percentage' "
"is hit, we do not want user to create a new share but existing "
"shares can be extended based on value of this parameter."),
cfg.StrOpt(
'share_backend_name',
help='The backend name for a given driver implementation.'),
@ -1315,6 +1322,7 @@ class ShareDriver(object):
free_capacity_gb='unknown',
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
qos=False,
pools=self.pools or None,
snapshot_support=self.snapshots_are_supported,

View File

@ -281,6 +281,11 @@ class CephFSDriver(driver.ExecuteMixin, driver.GaneshaMixin,
'reserved_share_from_snapshot_percentage') or
self.configuration.safe_get(
'reserved_share_percentage'),
'reserved_share_extend_percentage':
self.configuration.safe_get(
'reserved_share_extend_percentage') or
self.configuration.safe_get(
'reserved_share_percentage'),
'dedupe': [False],
'compression': [False],
'thin_provisioning': [False]

View File

@ -127,6 +127,9 @@ class ContainerShareDriver(driver.ShareDriver, driver.ExecuteMixin):
'reserved_snapshot_percentage':
self.configuration.reserved_share_from_snapshot_percentage or
self.configuration.reserved_share_percentage,
'reserved_share_extend_percentage':
self.configuration.reserved_share_extend_percentage or
self.configuration.reserved_share_percentage,
'consistency_group_support': None,
'snapshot_support': False,
'create_share_from_snapshot_support': False,

View File

@ -71,6 +71,7 @@ class LVMHelper(driver.ExecuteMixin):
'free_capacity_gb': float(free_size),
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
}, ]
def _get_lv_device(self, share_name):

View File

@ -82,6 +82,7 @@ class PowerMaxStorageConnection(driver.StorageConnection):
self.pool_conf = None
self.reserved_percentage = None
self.reserved_snapshot_percentage = None
self.reserved_share_extend_percentage = None
self.driver_handles_share_servers = True
self.port_conf = None
self.ipv6_implemented = True
@ -600,6 +601,11 @@ class PowerMaxStorageConnection(driver.StorageConnection):
if self.reserved_snapshot_percentage is None:
self.reserved_snapshot_percentage = self.reserved_percentage
self.reserved_share_extend_percentage = config.safe_get(
'reserved_share_extend_percentage')
if self.reserved_share_extend_percentage is None:
self.reserved_share_extend_percentage = self.reserved_percentage
self.manager = manager.StorageObjectManager(config)
self.port_conf = config.safe_get('powermax_ethernet_ports')
@ -650,6 +656,8 @@ class PowerMaxStorageConnection(driver.StorageConnection):
'reserved_percentage': self.reserved_percentage,
'reserved_snapshot_percentage':
self.reserved_snapshot_percentage,
'reserved_share_extend_percentage':
self.reserved_share_extend_percentage,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
'revert_to_snapshot_support': False,

View File

@ -93,6 +93,7 @@ class UnityStorageConnection(driver.StorageConnection):
self.nas_server_pool = None
self.reserved_percentage = None
self.reserved_snapshot_percentage = None
self.reserved_share_extend_percentage = None
self.max_over_subscription_ratio = None
self.port_ids_conf = None
self.unity_share_server = None
@ -135,6 +136,11 @@ class UnityStorageConnection(driver.StorageConnection):
if self.reserved_snapshot_percentage is None:
self.reserved_snapshot_percentage = self.reserved_percentage
self.reserved_share_extend_percentage = config.safe_get(
'reserved_share_extend_percentage')
if self.reserved_share_extend_percentage is None:
self.reserved_share_extend_percentage = self.reserved_percentage
self.max_over_subscription_ratio = config.safe_get(
'max_over_subscription_ratio')
self.port_ids_conf = config.safe_get('unity_ethernet_ports')
@ -593,6 +599,8 @@ class UnityStorageConnection(driver.StorageConnection):
'reserved_percentage': self.reserved_percentage,
'reserved_snapshot_percentage':
self.reserved_snapshot_percentage,
'reserved_share_extend_percentage':
self.reserved_share_extend_percentage,
'max_over_subscription_ratio':
self.max_over_subscription_ratio,
}

View File

@ -78,6 +78,7 @@ class VNXStorageConnection(driver.StorageConnection):
self.pool_conf = None
self.reserved_percentage = None
self.reserved_snapshot_percentage = None
self.reserved_share_extend_percentage = None
self.driver_handles_share_servers = True
self.port_conf = None
self.ipv6_implemented = True
@ -593,6 +594,11 @@ class VNXStorageConnection(driver.StorageConnection):
if self.reserved_snapshot_percentage is None:
self.reserved_snapshot_percentage = self.reserved_percentage
self.reserved_share_extend_percentage = config.safe_get(
'reserved_share_extend_percentage')
if self.reserved_share_extend_percentage is None:
self.reserved_share_extend_percentage = self.reserved_percentage
self.manager = manager.StorageObjectManager(config)
self.port_conf = config.safe_get('vnx_ethernet_ports')
@ -643,6 +649,8 @@ class VNXStorageConnection(driver.StorageConnection):
reserved_percentage=self.reserved_percentage,
reserved_snapshot_percentage=(
self.reserved_snapshot_percentage),
reserved_share_extend_percentage=(
self.reserved_share_extend_percentage),
)
stats_dict['pools'].append(pool_stat)

View File

@ -636,6 +636,9 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
)
super(GenericShareDriver, self)._update_share_stats(data)

View File

@ -125,6 +125,9 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
reserved_percentage=self.configuration.reserved_share_percentage,
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage))
super(GlusterfsShareDriver, self)._update_share_stats(data)

View File

@ -198,6 +198,9 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin,
reserved_percentage=self.configuration.reserved_share_percentage,
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage or
self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage or
self.configuration.reserved_share_percentage))
# We don't use a service mount to get stats data.

View File

@ -429,6 +429,9 @@ class HDFSNativeShareDriver(driver.ExecuteMixin, driver.ShareDriver):
reserved_share_percentage,
reserved_snapshot_percentage=self.configuration.
reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage,
reserved_share_extend_percentage=self.configuration.
reserved_share_extend_percentage
or self.configuration.reserved_share_percentage)
total, free = self._get_available_capacity()

View File

@ -613,6 +613,8 @@ class HitachiHNASDriver(driver.ShareDriver):
reserved = self.configuration.safe_get('reserved_share_percentage')
reserved_snapshot = self.configuration.safe_get(
'reserved_share_from_snapshot_percentage') or reserved
reserved_share_extend = self.configuration.safe_get(
'reserved_share_extend_percentage') or reserved
data = {
'share_backend_name': self.backend_name,
@ -624,6 +626,7 @@ class HitachiHNASDriver(driver.ShareDriver):
'free_capacity_gb': free_space,
'reserved_percentage': reserved,
'reserved_snapshot_percentage': reserved_snapshot,
'reserved_share_extend_percentage': reserved_share_extend,
'qos': False,
'thin_provisioning': True,
'dedupe': dedupe,

View File

@ -70,6 +70,9 @@ class HitachiHSPDriver(driver.ShareDriver):
reserved_snapshot = (self.configuration.safe_get(
'reserved_share_from_snapshot_percentage') or
self.configuration.safe_get('reserved_share_percentage'))
reserved_share_extend = (self.configuration.safe_get(
'reserved_share_extend_percentage') or
self.configuration.safe_get('reserved_share_percentage'))
max_over_subscription_ratio = self.configuration.safe_get(
'max_over_subscription_ratio')
hsp_cluster = self.hsp.get_cluster()
@ -85,6 +88,7 @@ class HitachiHSPDriver(driver.ShareDriver):
'pools': [{
'reserved_percentage': reserved,
'reserved_snapshot_percentage': reserved_snapshot,
'reserved_share_extend_percentage': reserved_share_extend,
'pool_name': 'HSP',
'thin_provisioning': True,
'total_capacity_gb': total_space / units.Gi,

View File

@ -612,6 +612,11 @@ class HPE3ParShareDriver(driver.ShareDriver):
if reserved_share_from_snapshot_percentage is None:
reserved_share_from_snapshot_percentage = reserved_share_percentage
reserved_share_extend_percentage = self.configuration.safe_get(
'reserved_share_extend_percentage')
if reserved_share_extend_percentage is None:
reserved_share_extend_percentage = reserved_share_percentage
stats = {
'share_backend_name': backend_name,
'driver_handles_share_servers': self.driver_handles_share_servers,
@ -624,6 +629,8 @@ class HPE3ParShareDriver(driver.ShareDriver):
'reserved_percentage': reserved_share_percentage,
'reserved_snapshot_percentage':
reserved_share_from_snapshot_percentage,
'reserved_share_extend_percentage':
reserved_share_extend_percentage,
'max_over_subscription_ratio': max_over_subscription_ratio,
'qos': False,
'thin_provisioning': True, # 3PAR default is thin
@ -639,6 +646,8 @@ class HPE3ParShareDriver(driver.ShareDriver):
fpg_status['reserved_percentage'] = reserved_share_percentage
fpg_status['reserved_snapshot_percentage'] = (
reserved_share_from_snapshot_percentage)
fpg_status['reserved_share_extend_percentage'] = (
reserved_share_extend_percentage)
LOG.debug("FPG status = %s.", fpg_status)
stats.setdefault('pools', []).append(fpg_status)

View File

@ -325,6 +325,7 @@ class V3StorageConnection(driver.HuaweiBase):
qos=self._get_qos_capability(),
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
thin_provisioning=[True, False],
dedupe=[True, False],
compression=[True, False],

View File

@ -750,6 +750,9 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
reserved_percentage=self.configuration.reserved_share_percentage,
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage))
free, capacity = self._get_available_capacity(

View File

@ -165,6 +165,9 @@ class InfiniboxShareDriver(driver.ShareDriver):
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
thin_provisioning=self.configuration.infinidat_thin_provision,
max_over_subscription_ratio=max_over_subscription_ratio,
provisioned_capacity_gb=provisioned_capacity_gb,

View File

@ -123,6 +123,9 @@ class InfortrendNASDriver(driver.ShareDriver):
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
pools=self.ift_nas.update_pools_stats())
LOG.debug('Infortrend pools status: %s', data['pools'])

View File

@ -613,6 +613,9 @@ class AS13000ShareDriver(driver.ShareDriver):
'reserved_snapshot_percentage':
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage,
'reserved_share_extend_percentage':
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage,
'max_over_subscription_ratio':
self.configuration.max_over_subscription_ratio,
'dedupe': False,

View File

@ -125,6 +125,9 @@ class InStorageShareDriver(driver.ShareDriver):
'reserved_snapshot_percentage': (
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
'reserved_share_extend_percentage': (
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
'max_over_subscription_ratio':
self.configuration.max_over_subscription_ratio,
'snapshot_support': False,
@ -302,6 +305,7 @@ class InStorageAssistant(object):
'allocated_capacity_gb': total_allocated_capacity,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'qos': False,
'dedupe': False,
'compression': False,

View File

@ -239,6 +239,9 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
'reserved_snapshot_percentage':
(self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
'reserved_share_extend_percentage':
(self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
'snapshot_support': True,
'create_share_from_snapshot_support': True,
'revert_to_snapshot_support': True,
@ -263,6 +266,7 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
'free_capacity_gb': float(free_size),
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
}, ]
def create_share(self, context, share, share_server=None):

View File

@ -486,6 +486,9 @@ class NetAppCmodeFileStorageLibrary(object):
reserved_snapshot_percentage = (
self.configuration.reserved_share_from_snapshot_percentage or
reserved_percentage)
reserved_shr_extend_percentage = (
self.configuration.reserved_share_extend_percentage or
reserved_percentage)
max_over_ratio = self.configuration.max_over_subscription_ratio
if total_capacity_gb == 0.0:
@ -501,6 +504,7 @@ class NetAppCmodeFileStorageLibrary(object):
'qos': qos_support,
'reserved_percentage': reserved_percentage,
'reserved_snapshot_percentage': reserved_snapshot_percentage,
'reserved_share_extend_percentage': reserved_shr_extend_percentage,
'max_over_subscription_ratio': max_over_ratio,
'dedupe': [True, False],
'compression': [True, False],

View File

@ -219,6 +219,9 @@ class NFSHelper(object):
'reserved_snapshot_percentage':
(self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
'reserved_share_extend_percentage':
(self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
'compression': compression,
'dedupe': dedupe,
'max_over_subscription_ratio': (

View File

@ -522,6 +522,9 @@ class NexentaNasDriver(driver.ShareDriver):
'reserved_snapshot_percentage':
(self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
'reserved_share_extend_percentage':
(self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
'max_over_subscription_ratio': (
self.configuration.safe_get(
'max_over_subscription_ratio')),

View File

@ -164,6 +164,12 @@ class FlashBladeShareDriver(driver.ShareDriver):
if reserved_share_from_snapshot_percentage is None:
reserved_share_from_snapshot_percentage = reserved_share_percentage
reserved_share_extend_percentage = self.configuration.safe_get(
"reserved_share_extend_percentage"
)
if reserved_share_extend_percentage is None:
reserved_share_extend_percentage = reserved_share_percentage
data = dict(
share_backend_name=self._backend_name,
vendor_name="PURE STORAGE",
@ -173,6 +179,8 @@ class FlashBladeShareDriver(driver.ShareDriver):
reserved_percentage=reserved_share_percentage,
reserved_snapshot_percentage=(
reserved_share_from_snapshot_percentage),
reserved_share_extend_percentage=(
reserved_share_extend_percentage),
total_capacity_gb=float(physical_capacity_bytes) / units.Gi,
free_capacity_gb=float(free_capacity_bytes) / units.Gi,
provisioned_capacity_gb=float(provisioned_cap_bytes) / units.Gi,

View File

@ -262,6 +262,9 @@ class QnapShareDriver(driver.ShareDriver):
reserved_snapshot_percentage = self.configuration.safe_get(
'reserved_share_from_snapshot_percentage') or reserved_percentage
reserved_shr_extend_percentage = self.configuration.safe_get(
'reserved_share_extend_percentage') or reserved_percentage
# single pool now, need support multiple pools in the future
single_pool = {
"pool_name": self.configuration.qnap_poolname,
@ -270,6 +273,7 @@ class QnapShareDriver(driver.ShareDriver):
"allocated_capacity_gb": alloc_capacity_gb,
"reserved_percentage": reserved_percentage,
"reserved_snapshot_percentage": reserved_snapshot_percentage,
"reserved_share_extend_percentage": reserved_shr_extend_percentage,
"qos": False,
"dedupe": [True, False],
"compression": [True, False],

View File

@ -144,6 +144,9 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,):
reserved_percentage=self.configuration.reserved_share_percentage,
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage))
super(QuobyteShareDriver, self)._update_share_stats(data)

View File

@ -449,6 +449,9 @@ class TegileShareDriver(driver.ShareDriver):
pool['reserved_snapshot_percentage'] = (
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage)
pool['reserved_share_extend_percentage'] = (
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage)
pool['dedupe'] = True
pool['compression'] = True
pool['thin_provisioning'] = True

View File

@ -622,6 +622,7 @@ class ACCESSShareDriver(driver.ExecuteMixin, driver.ShareDriver):
'free_capacity_gb': free_capacity,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'QoS_support': False,
'snapshot_support': True,
'create_share_from_snapshot_support': True

View File

@ -498,6 +498,9 @@ class ZadaraVPSAShareDriver(driver.ShareDriver):
reserved_snapshot_percentage=(
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
reserved_share_extend_percentage=(
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
compression=[True, False],
dedupe=[True, False],
thin_provisioning=True

View File

@ -361,6 +361,9 @@ class ZFSonLinuxShareDriver(zfs_utils.ExecuteMixin, driver.ShareDriver):
'reserved_snapshot_percentage': (
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
'reserved_share_extend_percentage': (
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
}
pool.update(self.common_capabilities)
if self.configuration.replication_domain:
@ -378,6 +381,9 @@ class ZFSonLinuxShareDriver(zfs_utils.ExecuteMixin, driver.ShareDriver):
'reserved_snapshot_percentage': (
self.configuration.reserved_share_from_snapshot_percentage
or self.configuration.reserved_share_percentage),
'reserved_share_extend_percentage': (
self.configuration.reserved_share_extend_percentage
or self.configuration.reserved_share_percentage),
'snapshot_support': True,
'create_share_from_snapshot_support': True,
'driver_name': 'ZFS',

View File

@ -47,6 +47,7 @@ SERVICE_STATES_NO_POOLS = {
total_capacity_gb=512, free_capacity_gb=200,
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=312,
max_over_subscription_ratio=1.0,
thin_provisioning=False,
@ -59,6 +60,7 @@ SERVICE_STATES_NO_POOLS = {
total_capacity_gb=256, free_capacity_gb=100,
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=400,
max_over_subscription_ratio=2.0,
thin_provisioning=True,
@ -71,6 +73,7 @@ SERVICE_STATES_NO_POOLS = {
total_capacity_gb=10000, free_capacity_gb=700,
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=50000,
max_over_subscription_ratio=20.0,
thin_provisioning=True,
@ -107,6 +110,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
'host1@AAA': dict(share_backend_name='AAA',
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
driver_handles_share_servers=False,
snapshot_support=True,
create_share_from_snapshot_support=True,
@ -117,12 +121,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=41,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=10,
max_over_subscription_ratio=1.0,
thin_provisioning=False)]),
'host2@BBB': dict(share_backend_name='BBB',
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
driver_handles_share_servers=False,
snapshot_support=True,
create_share_from_snapshot_support=True,
@ -133,12 +139,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=42,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=60,
max_over_subscription_ratio=2.0,
thin_provisioning=True)]),
'host3@CCC': dict(share_backend_name='CCC',
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
driver_handles_share_servers=False,
snapshot_support=True,
create_share_from_snapshot_support=True,
@ -149,12 +157,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=43,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=100,
max_over_subscription_ratio=20.0,
thin_provisioning=True)]),
'host4@DDD': dict(share_backend_name='DDD',
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
driver_handles_share_servers=False,
snapshot_support=True,
create_share_from_snapshot_support=True,
@ -165,6 +175,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=441,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=800,
max_over_subscription_ratio=2.0,
thin_provisioning=True),
@ -173,12 +184,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=442,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=2000,
max_over_subscription_ratio=10.0,
thin_provisioning=True)]),
'host5@EEE': dict(share_backend_name='EEE',
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
driver_handles_share_servers=False,
snapshot_support=True,
create_share_from_snapshot_support=True,
@ -189,6 +202,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=451,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=100,
max_over_subscription_ratio=1.0,
thin_provisioning=False),
@ -197,12 +211,14 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb=452,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=100,
max_over_subscription_ratio=1.0,
thin_provisioning=False)]),
'host6@FFF': dict(share_backend_name='FFF',
timestamp=None, reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
driver_handles_share_servers=False,
snapshot_support=True,
create_share_from_snapshot_support=True,
@ -213,6 +229,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb='unknown',
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=100,
max_over_subscription_ratio=1.0,
thin_provisioning=False),
@ -221,6 +238,7 @@ SHARE_SERVICE_STATES_WITH_POOLS = {
free_capacity_gb='unknown',
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
provisioned_capacity_gb=100,
max_over_subscription_ratio=1.0,
thin_provisioning=False)]),
@ -244,6 +262,7 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': False,
'reserved_percentage': 10,
'reserved_snapshot_percentage': 5,
'reserved_share_extend_percentage': 15,
'timestamp': None,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
@ -259,6 +278,7 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': True,
'reserved_percentage': 10,
'reserved_snapshot_percentage': 5,
'reserved_share_extend_percentage': 15,
'timestamp': None,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
@ -274,6 +294,7 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': [False],
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
'timestamp': None,
@ -287,6 +308,7 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': [True],
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 5,
'timestamp': None,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
@ -302,6 +324,7 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': [True, False],
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 5,
'timestamp': None,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
@ -314,6 +337,7 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': False,
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 5,
'snapshot_support': True,
'create_share_from_snapshot_support': True,
'timestamp': None,

View File

@ -113,6 +113,50 @@ class HostFiltersTestCase(test.TestCase):
'service': service})
self.assertFalse(self.filter.host_passes(host, filter_properties))
@ddt.data(
{'free_capacity': 120, 'total_capacity': 200,
'reserved': 20, 'reserved_share_extend_percentage': 5})
@ddt.unpack
def test_capacity_filter_passes_share_extend_reserved(
self, free_capacity,
total_capacity,
reserved,
reserved_share_extend_percentage):
self._stub_service_is_up(True)
filter_properties = {'size': 100, 'is_share_extend': True}
service = {'disabled': False}
host = fakes.FakeHostState('host1',
{'total_capacity_gb': total_capacity,
'free_capacity_gb': free_capacity,
'reserved_percentage': reserved,
'reserved_share_extend_percentage':
reserved_share_extend_percentage,
'updated_at': None,
'service': service})
self.assertTrue(self.filter.host_passes(host, filter_properties))
@ddt.data(
{'free_capacity': 120, 'total_capacity': 200,
'reserved': 20, 'reserved_share_extend_percentage': 15})
@ddt.unpack
def test_capacity_filter_fails_share_extend_reserved(
self, free_capacity,
total_capacity,
reserved,
reserved_share_extend_percentage):
self._stub_service_is_up(True)
filter_properties = {'size': 100, 'is_share_extend': True}
service = {'disabled': False}
host = fakes.FakeHostState('host1',
{'total_capacity_gb': total_capacity,
'free_capacity_gb': free_capacity,
'reserved_percentage': reserved,
'reserved_share_extend_percentage':
reserved_share_extend_percentage,
'updated_at': None,
'service': service})
self.assertFalse(self.filter.host_passes(host, filter_properties))
def test_capacity_filter_passes_unknown(self):
free = 'unknown'
self._stub_service_is_up(True)

View File

@ -198,6 +198,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 512,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 312,
'max_over_subscription_ratio': 1.0,
'thin_provisioning': False,
@ -230,6 +231,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 256,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 400,
'max_over_subscription_ratio': 2.0,
'thin_provisioning': True,
@ -262,6 +264,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 10000,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 50000,
'max_over_subscription_ratio': 20.0,
'thin_provisioning': True,
@ -316,6 +319,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 51,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 10,
'max_over_subscription_ratio': 1.0,
'thin_provisioning': False,
@ -349,6 +353,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 52,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 60,
'max_over_subscription_ratio': 2.0,
'thin_provisioning': True,
@ -382,6 +387,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 53,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 100,
'max_over_subscription_ratio': 20.0,
'thin_provisioning': True,
@ -415,6 +421,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 541,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 800,
'max_over_subscription_ratio': 2.0,
'thin_provisioning': True,
@ -448,6 +455,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 542,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 2000,
'max_over_subscription_ratio': 10.0,
'thin_provisioning': True,
@ -519,6 +527,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 512,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'vendor_name': None,
'storage_protocol': None,
'provisioned_capacity_gb': 312,
@ -551,6 +560,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 256,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'vendor_name': None,
'storage_protocol': None,
'provisioned_capacity_gb': 400,
@ -611,6 +621,7 @@ class HostManagerTestCase(test.TestCase):
'total_capacity_gb': 52,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 60,
'max_over_subscription_ratio': 2.0,
'thin_provisioning': True,
@ -678,6 +689,7 @@ class HostStateTestCase(test.TestCase):
'free_capacity_gb': 100,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None,
'ipv4_support': True,
'ipv6_support': False}
@ -731,6 +743,7 @@ class HostStateTestCase(test.TestCase):
'qos': 'False',
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'dying_disks': 100,
'super_hero_1': 'spider-man',
'super_hero_2': 'flash',
@ -743,6 +756,7 @@ class HostStateTestCase(test.TestCase):
'qos': 'False',
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'dying_disks': 200,
'super_hero_1': 'superman',
'super_hero_2': 'Hulk',
@ -789,6 +803,7 @@ class HostStateTestCase(test.TestCase):
'qos': 'False',
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
},
],
'timestamp': None,
@ -816,6 +831,7 @@ class HostStateTestCase(test.TestCase):
'allocated_capacity_gb': 1,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None
}
fake_context = context.RequestContext('user', 'project', is_admin=True)
@ -845,6 +861,7 @@ class HostStateTestCase(test.TestCase):
'allocated_capacity_gb': provisioned_capacity_gb,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None
}
fake_host = host_manager.PoolState('host1', share_capability, '_pool0')
@ -867,6 +884,7 @@ class HostStateTestCase(test.TestCase):
'allocated_capacity_gb': 0,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None
}
fake_context = context.RequestContext('user', 'project', is_admin=True)
@ -905,6 +923,7 @@ class HostStateTestCase(test.TestCase):
'timestamp': None,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
}
fake_context = context.RequestContext('user', 'project', is_admin=True)
fake_host = host_manager.HostState('host1')
@ -928,6 +947,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': True,
'cap1': 'val1', 'cap2': 'val2'},
'instances':
@ -951,6 +971,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': False, 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[
@ -973,6 +994,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': [False], 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[
@ -995,6 +1017,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': [True, False], 'cap1': 'val1',
'cap2': 'val2'},
'instances':
@ -1018,6 +1041,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'cap1': 'val1', 'cap2': 'val2', 'ipv4_support': True,
'ipv6_support': False},
'instances': []
@ -1027,6 +1051,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': True, 'cap1': 'val1', 'cap2': 'val2',
'ipv4_support': True, 'ipv6_support': False},
'instances': []
@ -1036,6 +1061,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': [False], 'cap1': 'val1', 'cap2': 'val2',
'ipv4_support': True, 'ipv6_support': False},
'instances': []
@ -1045,6 +1071,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'reserved_percentage': 0, 'timestamp': None,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'thin_provisioning': [True, False], 'cap1': 'val1',
'cap2': 'val2', 'ipv4_support': True, 'ipv6_support': False},
'instances': []
@ -1054,6 +1081,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'allocated_capacity_gb': 256, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2',
'ipv4_support': False, 'ipv6_support': True
},
@ -1072,6 +1100,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'allocated_capacity_gb': 256, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2',
'ipv4_support': True, 'ipv6_support': True},
'instances': []
@ -1081,6 +1110,7 @@ class PoolStateTestCase(test.TestCase):
{'total_capacity_gb': 1024, 'free_capacity_gb': 512,
'provisioned_capacity_gb': 256, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2',
'ipv4_support': False, 'ipv6_support': False
},
@ -1100,6 +1130,7 @@ class PoolStateTestCase(test.TestCase):
'allocated_capacity_gb': 256, 'provisioned_capacity_gb': 1,
'thin_provisioning': True, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[
@ -1117,6 +1148,7 @@ class PoolStateTestCase(test.TestCase):
'allocated_capacity_gb': 256, 'provisioned_capacity_gb': 1,
'thin_provisioning': [False], 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[
@ -1134,6 +1166,7 @@ class PoolStateTestCase(test.TestCase):
'allocated_capacity_gb': 256, 'provisioned_capacity_gb': 1,
'thin_provisioning': [True, False], 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[
@ -1151,6 +1184,7 @@ class PoolStateTestCase(test.TestCase):
'allocated_capacity_gb': 256, 'provisioned_capacity_gb': 256,
'thin_provisioning': False, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[
@ -1168,6 +1202,7 @@ class PoolStateTestCase(test.TestCase):
'allocated_capacity_gb': 256, 'provisioned_capacity_gb': 256,
'thin_provisioning': [False], 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'timestamp': None, 'cap1': 'val1', 'cap2': 'val2'},
'instances':
[

View File

@ -544,12 +544,16 @@ class CephFSDriverTestCase(test.TestCase):
'reserved_share_percentage', 5)
self._driver.configuration.local_conf.set_override(
'reserved_share_from_snapshot_percentage', 2)
self._driver.configuration.local_conf.set_override(
'reserved_share_extend_percentage', 2)
self._driver._update_share_stats()
result = self._driver._stats
self.assertEqual(5, result['pools'][0]['reserved_percentage'])
self.assertEqual(2, result['pools'][0]['reserved_snapshot_percentage'])
self.assertEqual(
2, result['pools'][0]['reserved_share_extend_percentage'])
self.assertEqual(164.94, result['pools'][0]['total_capacity_gb'])
self.assertEqual(149.84, result['pools'][0]['free_capacity_gb'])
self.assertTrue(result['ipv4_support'])

View File

@ -103,8 +103,10 @@ class ContainerShareDriverTestCase(test.TestCase):
self.assertEqual('Docker', self._driver._stats['share_backend_name'])
self.assertEqual('CIFS', self._driver._stats['storage_protocol'])
self.assertEqual(0, self._driver._stats['reserved_percentage'])
self.assertEqual(0,
self._driver._stats['reserved_snapshot_percentage'])
self.assertEqual(
0, self._driver._stats['reserved_snapshot_percentage'])
self.assertEqual(
0, self._driver._stats['reserved_share_extend_percentage'])
self.assertIsNone(self._driver._stats['consistency_group_support'])
self.assertEqual(False, self._driver._stats['snapshot_support'])
self.assertEqual('ContainerShareDriver',

View File

@ -56,6 +56,7 @@ class LVMHelperTestCase(test.TestCase):
def test_get_share_server_pools(self, ret_vgs):
expected_result = [{'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'pool_name': 'manila_docker_volumes',
'total_capacity_gb': 72.5,
'free_capacity_gb': 62.5}]

View File

@ -351,6 +351,7 @@ def do_connection_connect(conn, res):
conn.pool_set = set(['pool_1', 'pool_2'])
conn.reserved_percentage = 0
conn.reserved_snapshot_percentage = 0
conn.reserved_share_extend_percentage = 0
conn.max_over_subscription_ratio = 20
conn.port_set = set(['spa_eth1', 'spa_eth2'])
conn.nas_server_pool = StorageObjectMock(res['nas_server_pool'])

View File

@ -302,6 +302,7 @@ class TestConnection(test.TestCase):
enas_utils.bytes_to_gb(10000.0), pool['allocated_capacity_gb'])
self.assertEqual(0, pool['reserved_percentage'])
self.assertEqual(0, pool['reserved_snapshot_percentage'])
self.assertEqual(0, pool['reserved_share_extend_percentage'])
self.assertTrue(pool['thin_provisioning'])
self.assertEqual(
enas_utils.bytes_to_gb(490000.0), pool['free_capacity_gb'])

View File

@ -128,6 +128,7 @@ class EMCShareFrameworkTestCase(test.TestCase):
data['free_capacity_gb'] = 'unknown'
data['reserved_percentage'] = 0
data['reserved_snapshot_percentage'] = 0
data['reserved_share_extend_percentage'] = 0
data['qos'] = False
data['pools'] = None
data['snapshot_support'] = True

View File

@ -482,7 +482,9 @@ class DummyDriver(driver.ShareDriver):
"reserved_percentage":
self.configuration.reserved_share_percentage,
"reserved_snapshot_percentage":
self.configuration.reserved_share_from_snapshot_percentage
self.configuration.reserved_share_from_snapshot_percentage,
"reserved_share_extend_percentage":
self.configuration.reserved_share_extend_percentage
}]
if self.configuration.replication_domain:
pools[0]["replication_type"] = "readable"
@ -498,6 +500,8 @@ class DummyDriver(driver.ShareDriver):
self.configuration.reserved_share_percentage,
"reserved_snapshot_percentage":
self.configuration.reserved_share_from_snapshot_percentage,
"reserved_share_extend_percentage":
self.configuration.reserved_share_extend_percentage,
"snapshot_support": True,
"create_share_from_snapshot_support": True,
"revert_to_snapshot_support": True,

View File

@ -253,6 +253,7 @@ class GlusterfsNativeShareDriverTestCase(test.TestCase):
'storage_protocol': 'glusterfs',
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'qos': False,
'total_capacity_gb': 'unknown',
'free_capacity_gb': 'unknown',

View File

@ -973,6 +973,8 @@ class HitachiHNASTestCase(test.TestCase):
'reserved_percentage': driver.CONF.reserved_share_percentage,
'reserved_snapshot_percentage':
driver.CONF.reserved_share_from_snapshot_percentage,
'reserved_share_extend_percentage':
driver.CONF.reserved_share_extend_percentage,
'qos': False,
'thin_provisioning': True,
'dedupe': True,

View File

@ -74,6 +74,7 @@ stats_data = {
'pools': [{
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'pool_name': 'HSP',
'thin_provisioning': True,
'total_capacity_gb': 100,

View File

@ -728,6 +728,7 @@ class HPE3ParDriverTestCase(test.TestCase):
'max_over_subscription_ratio': None,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': 0,
'share_backend_name': 'HPE_3PAR',
'snapshot_support': True,
@ -792,6 +793,7 @@ class HPE3ParDriverTestCase(test.TestCase):
'hp3par_flash_cache': False,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': expected_capacity
}
@ -806,6 +808,7 @@ class HPE3ParDriverTestCase(test.TestCase):
'provisioned_capacity_gb': 0,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'max_over_subscription_ratio': None,
'max_share_server_size': -1,
'max_shares_per_share_server': -1,
@ -821,6 +824,7 @@ class HPE3ParDriverTestCase(test.TestCase):
'hp3par_flash_cache': False,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'provisioned_capacity_gb': expected_capacity}],
'snapshot_support': True,
'create_share_from_snapshot_support': True,
@ -867,6 +871,7 @@ class HPE3ParDriverTestCase(test.TestCase):
'provisioned_capacity_gb': 0,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'share_backend_name': 'HPE_3PAR',
'storage_protocol': 'NFS_CIFS',
'thin_provisioning': True,

View File

@ -2420,6 +2420,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
"storage_protocol": "NFS_CIFS",
"reserved_percentage": 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
"total_capacity_gb": 0.0,
"free_capacity_gb": 0.0,
"qos": True,
@ -2450,6 +2451,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
qos=True,
reserved_percentage=0,
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0,
compression=[True, False],
dedupe=[True, False],
max_over_subscription_ratio=1,

View File

@ -103,6 +103,7 @@ class InfiniboxDriverTestCaseBase(test.TestCase):
'test_admin_network_config_group')
self.configuration.reserved_share_percentage = 0
self.configuration.reserved_share_from_snapshot_percentage = 0
self.configuration.reserved_share_extend_percentage = 0
self.configuration.filter_function = None
self.configuration.goodness_function = None
self.configuration.driver_handles_share_servers = False

View File

@ -61,6 +61,8 @@ class FakeConfig(object):
"reserved_share_percentage", 0)
self.reserved_share_from_snapshot_percentage = kwargs.get(
"reserved_share_from_snapshot_percentage", 0)
self.reserved_share_extend_percentage = kwargs.get(
"reserved_share_extend_percentage", 0)
self.max_over_subscription_ratio = kwargs.get(
"max_over_subscription_ratio", 20.0)
self.filter_function = kwargs.get("filter_function", None)
@ -884,6 +886,7 @@ class AS13000ShareDriverTestCase(test.TestCase):
pool['pool_name'] = 'fakepath'
pool['reserved_percentage'] = 0
pool['reserved_snapshot_percentage'] = 0
pool['reserved_share_extend_percentage'] = 0
pool['max_over_subscription_ratio'] = 20.0
pool['dedupe'] = False
pool['compression'] = False

View File

@ -61,6 +61,8 @@ class FakeConfig(object):
"reserved_share_percentage", 0)
self.reserved_share_from_snapshot_percentage = kwargs.get(
"reserved_share_from_snapshot_percentage", 0)
self.reserved_share_extend_percentage = kwargs.get(
"reserved_share_extend_percentage", 0)
self.max_over_subscription_ratio = kwargs.get(
"max_over_subscription_ratio", 0)
self.filter_function = kwargs.get("filter_function", None)
@ -140,6 +142,7 @@ class InStorageShareDriverTestCase(test.TestCase):
'allocated_capacity_gb': 10,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'qos': False,
'dedupe': False,
'compression': False,
@ -164,6 +167,7 @@ class InStorageShareDriverTestCase(test.TestCase):
'storage_protocol': 'NFS_CIFS',
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'max_over_subscription_ratio': 0,
'snapshot_support': False,
'create_share_from_snapshot_support': False,
@ -910,6 +914,7 @@ class InStorageAssistantTestCase(test.TestCase):
'qos': False,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'dedupe': False,
'compression': False,
'thin_provisioning': False,

View File

@ -709,6 +709,7 @@ class MapRFSNativeShareDriverTestCase(test.TestCase):
'free_capacity_gb', 'total_capacity_gb',
'driver_handles_share_servers',
'reserved_percentage', 'reserved_snapshot_percentage',
'reserved_share_extend_percentage',
'vendor_name', 'storage_protocol',
]
for key in expected_keys:

View File

@ -970,6 +970,7 @@ POOLS = [
'allocated_capacity_gb': 2.2,
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 2,
'max_over_subscription_ratio': 2.0,
'dedupe': [True, False],
'compression': [True, False],
@ -997,6 +998,7 @@ POOLS = [
'allocated_capacity_gb': 4.0,
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 2,
'max_over_subscription_ratio': 2.0,
'dedupe': [True, False],
'compression': [True, False],
@ -1029,6 +1031,7 @@ POOLS_VSERVER_CREDS = [
'allocated_capacity_gb': 0.0,
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 2,
'max_over_subscription_ratio': 2.0,
'dedupe': [True, False],
'compression': [True, False],
@ -1051,6 +1054,7 @@ POOLS_VSERVER_CREDS = [
'allocated_capacity_gb': 0.0,
'reserved_percentage': 5,
'reserved_snapshot_percentage': 2,
'reserved_share_extend_percentage': 2,
'max_over_subscription_ratio': 2.0,
'dedupe': [True, False],
'compression': [True, False],
@ -1809,6 +1813,7 @@ def get_config_cmode():
config.local_conf.set_override('share_backend_name', BACKEND_NAME)
config.reserved_share_percentage = 5
config.reserved_share_from_snapshot_percentage = 2
config.reserved_share_extend_percentage = 2
config.max_over_subscription_ratio = 2.0
config.netapp_login = CLIENT_KWARGS['username']
config.netapp_password = CLIENT_KWARGS['password']

View File

@ -90,6 +90,7 @@ class TestNexentaNasDriver(test.TestCase):
self.cfg.nexenta_rest_port = 1000
self.cfg.reserved_share_percentage = 0
self.cfg.reserved_share_from_snapshot_percentage = 0
self.cfg.reserved_share_extend_percentage = 0
self.cfg.max_over_subscription_ratio = 0
self.cfg.nexenta_rest_protocol = 'auto'
self.cfg.nexenta_volume = 'volume'
@ -596,6 +597,8 @@ class TestNexentaNasDriver(test.TestCase):
self.cfg.reserved_share_percentage),
'reserved_snapshot_percentage': (
self.cfg.reserved_share_from_snapshot_percentage),
'reserved_share_extend_percentage': (
self.cfg.reserved_share_extend_percentage),
'compression': True,
'dedupe': True,
'thin_provisioning': self.cfg.nexenta_thin_provisioning,

View File

@ -55,6 +55,7 @@ class TestNexentaNasDriver(test.TestCase):
self.cfg.nexenta_dataset_record_size = 131072
self.cfg.reserved_share_percentage = 0
self.cfg.reserved_share_from_snapshot_percentage = 0
self.cfg.reserved_share_extend_percentage = 0
self.cfg.nexenta_folder = 'nfs_share'
self.cfg.nexenta_user = 'user'
self.cfg.share_backend_name = 'NexentaStor5'
@ -394,6 +395,8 @@ class TestNexentaNasDriver(test.TestCase):
self.cfg.reserved_share_percentage),
'reserved_snapshot_percentage': (
self.cfg.reserved_share_from_snapshot_percentage),
'reserved_share_extend_percentage': (
self.cfg.reserved_share_extend_percentage),
'thin_provisioning': self.cfg.nexenta_thin_provisioning,
}],
}

View File

@ -343,7 +343,8 @@ class QuobyteShareDriverTestCase(test.TestCase):
total_capacity_gb=42,
free_capacity_gb=23,
reserved_percentage=0,
reserved_snapshot_percentage=0))
reserved_snapshot_percentage=0,
reserved_share_extend_percentage=0))
def test_get_capacities_gb(self):
capval = 42115548133

View File

@ -38,6 +38,7 @@ test_config.tegile_nas_login = 'some-user'
test_config.tegile_nas_password = 'some-password'
test_config.reserved_share_percentage = 10
test_config.reserved_share_from_snapshot_percentage = 5
test_config.reserved_share_extend_percentage = 5
test_config.max_over_subscription_ratio = 30.0
test_share = {
@ -83,6 +84,7 @@ array_stats = {
'free_capacity_gb': 911.812650680542,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'pool_name': 'pyramid',
},
{
@ -91,6 +93,7 @@ array_stats = {
'free_capacity_gb': 2740.148867149747,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'pool_name': 'cobalt',
},
{
@ -99,6 +102,7 @@ array_stats = {
'free_capacity_gb': 913.4198722839355,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'pool_name': 'test',
},
],
@ -451,6 +455,7 @@ class TegileShareDriverTestCase(test.TestCase):
'qos': False,
'reserved_percentage': 10,
'reserved_snapshot_percentage': 5,
'reserved_share_extend_percentage': 5,
'thin_provisioning': True,
'max_over_subscription_ratio': 30.0,
'total_capacity_gb': 913.5},
@ -463,6 +468,7 @@ class TegileShareDriverTestCase(test.TestCase):
'qos': False,
'reserved_percentage': 10,
'reserved_snapshot_percentage': 5,
'reserved_share_extend_percentage': 5,
'thin_provisioning': True,
'max_over_subscription_ratio': 30.0,
'total_capacity_gb': 2742.1996604874
@ -476,12 +482,14 @@ class TegileShareDriverTestCase(test.TestCase):
'qos': False,
'reserved_percentage': 10,
'reserved_snapshot_percentage': 5,
'reserved_share_extend_percentage': 5,
'thin_provisioning': True,
'max_over_subscription_ratio': 30.0,
'total_capacity_gb': 913.5}, ],
'qos': False,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'replication_domain': None,
'share_backend_name': 'Tegile',
'snapshot_support': True,

View File

@ -1332,6 +1332,7 @@ class GenericShareDriverTestCase(test.TestCase):
'free_capacity_gb', 'total_capacity_gb',
'driver_handles_share_servers',
'reserved_percentage', 'reserved_snapshot_percentage',
'reserved_share_extend_percentage',
'vendor_name', 'storage_protocol',
]

View File

@ -65,6 +65,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
CONF.set_default('reserved_share_percentage', 50)
CONF.set_default('reserved_share_from_snapshot_percentage', 30)
CONF.set_default('reserved_share_extend_percentage', 30)
CONF.set_default('driver_handles_share_servers', False)
self.fake_conf = config.Configuration(None)
@ -157,7 +158,8 @@ class GlusterfsShareDriverTestCase(test.TestCase):
'vendor_name': 'Red Hat',
'share_backend_name': 'GlusterFS',
'reserved_percentage': 50,
'reserved_snapshot_percentage': 30}))
'reserved_snapshot_percentage': 30,
'reserved_share_extend_percentage': 30}))
def test_get_network_allocations_number(self):
self.assertEqual(0, self._driver.get_network_allocations_number())

View File

@ -97,6 +97,7 @@ class LVMShareDriverTestCase(test.TestCase):
CONF.set_default('driver_handles_share_servers', False)
CONF.set_default('reserved_share_percentage', 50)
CONF.set_default('reserved_share_from_snapshot_percentage', 30)
CONF.set_default('reserved_share_extend_percentage', 30)
self._helper_cifs = mock.Mock()
self._helper_nfs = mock.Mock()
@ -607,6 +608,7 @@ class LVMShareDriverTestCase(test.TestCase):
'free_capacity_gb': 22,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
}, ]
out, err = "VSize 33g VFree 22g", None
self.mock_object(

View File

@ -432,6 +432,7 @@ class ACCESSShareDriverTestCase(test.TestCase):
'free_capacity_gb': 9,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'QoS_support': False,
'create_share_from_snapshot_support': True,
'driver_handles_share_servers': False,

View File

@ -737,6 +737,7 @@ class ZadaraVPSAShareDriverTestCase(test.TestCase):
'fake_admin_network_config_group')
self.configuration.reserved_percentage = 0
self.configuration.reserved_snapshot_percentage = 0
self.configuration.reserved_share_extend_percentage = 0
self.configuration.zadara_use_iser = True
self.configuration.zadara_vpsa_host = '192.168.5.5'
self.configuration.zadara_vpsa_port = '80'
@ -757,6 +758,7 @@ class ZadaraVPSAShareDriverTestCase(test.TestCase):
self.configuration.share_backend_name = 'zadaravpsa'
self.configuration.reserved_share_percentage = '0'
self.configuration.reserved_share_from_snapshot_percentage = '0'
self.configuration.reserved_share_extend_percentage = 0
self.configuration.replication_domain = None
self.configuration.filter_function = None
self.configuration.goodness_function = None
@ -963,6 +965,8 @@ class ZadaraVPSAShareDriverTestCase(test.TestCase):
self.configuration.reserved_percentage)
self.assertEqual(data['reserved_snapshot_percentage'],
self.configuration.reserved_snapshot_percentage)
self.assertEqual(data['reserved_share_extend_percentage'],
self.configuration.reserved_share_extend_percentage)
self.assertEqual(data['snapshot_support'], True)
self.assertEqual(data['create_share_from_snapshot_support'], True)
self.assertEqual(data['revert_to_snapshot_support'], False)

View File

@ -64,6 +64,8 @@ class FakeConfig(object):
"reserved_share_percentage", 0)
self.reserved_share_from_snapshot_percentage = kwargs.get(
"reserved_share_from_snapshot_percentage", 0)
self.reserved_share_extend_percentage = kwargs.get(
"reserved_share_extend_percentage", 0)
self.max_over_subscription_ratio = kwargs.get(
"max_over_subscription_ratio", 15.0)
self.filter_function = kwargs.get("filter_function", None)
@ -282,6 +284,7 @@ class ZFSonLinuxShareDriverTestCase(test.TestCase):
{'pool_name': 'foo', 'total_capacity_gb': 3.0,
'free_capacity_gb': 2.0, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'compression': [True, False],
'dedupe': [True, False],
'thin_provisioning': [True],
@ -291,6 +294,7 @@ class ZFSonLinuxShareDriverTestCase(test.TestCase):
{'pool_name': 'bar', 'total_capacity_gb': 4.0,
'free_capacity_gb': 5.0, 'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'compression': [True, False],
'dedupe': [True, False],
'thin_provisioning': [True],
@ -360,6 +364,7 @@ class ZFSonLinuxShareDriverTestCase(test.TestCase):
'replication_domain': replication_domain,
'reserved_percentage': 0,
'reserved_snapshot_percentage': 0,
'reserved_share_extend_percentage': 0,
'share_backend_name': self.driver.backend_name,
'share_group_stats': {'consistent_snapshot_support': None},
'snapshot_support': True,

View File

@ -141,6 +141,7 @@ class ShareDriverTestCase(test.TestCase):
'free_capacity_gb', 'total_capacity_gb',
'driver_handles_share_servers',
'reserved_percentage', 'reserved_snapshot_percentage',
'reserved_share_extend_percentage',
'vendor_name', 'storage_protocol',
'snapshot_support', 'mount_snapshot_support',
]

View File

@ -0,0 +1,9 @@
---
features:
- |
'reserved_share_extend_percentage' backend config option allows
Manila to consider different reservation percentage for share extend
operation.
This distinct option is useful if operators want to prevent provisioning
of new shares but allow extensions of existing shares on storage pools
beyond their reserved space.