diff --git a/manila/scheduler/drivers/filter.py b/manila/scheduler/drivers/filter.py index 1402cf3002..9b44dc8d29 100644 --- a/manila/scheduler/drivers/filter.py +++ b/manila/scheduler/drivers/filter.py @@ -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) diff --git a/manila/scheduler/filters/capacity.py b/manila/scheduler/filters/capacity.py index 0a2f74ffe7..7222aadf09 100644 --- a/manila/scheduler/filters/capacity.py +++ b/manila/scheduler/filters/capacity.py @@ -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 diff --git a/manila/scheduler/host_manager.py b/manila/scheduler/host_manager.py index 7bac0f9694..bc3e984c91 100644 --- a/manila/scheduler/host_manager.py +++ b/manila/scheduler/host_manager.py @@ -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 diff --git a/manila/scheduler/utils.py b/manila/scheduler/utils.py index b5f2493b34..989be21850 100644 --- a/manila/scheduler/utils.py +++ b/manila/scheduler/utils.py @@ -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, diff --git a/manila/scheduler/weighers/capacity.py b/manila/scheduler/weighers/capacity.py index 409197aba6..222853b639 100644 --- a/manila/scheduler/weighers/capacity.py +++ b/manila/scheduler/weighers/capacity.py @@ -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 diff --git a/manila/share/api.py b/manila/share/api.py index 312533f651..fc2251090d 100644 --- a/manila/share/api.py +++ b/manila/share/api.py @@ -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.", diff --git a/manila/share/driver.py b/manila/share/driver.py index 1afe8270a0..e10c9b4484 100644 --- a/manila/share/driver.py +++ b/manila/share/driver.py @@ -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, diff --git a/manila/share/drivers/cephfs/driver.py b/manila/share/drivers/cephfs/driver.py index 4de11c2e6c..2b2be031f8 100644 --- a/manila/share/drivers/cephfs/driver.py +++ b/manila/share/drivers/cephfs/driver.py @@ -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] diff --git a/manila/share/drivers/container/driver.py b/manila/share/drivers/container/driver.py index 4b51222f2a..04c912b24b 100644 --- a/manila/share/drivers/container/driver.py +++ b/manila/share/drivers/container/driver.py @@ -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, diff --git a/manila/share/drivers/container/storage_helper.py b/manila/share/drivers/container/storage_helper.py index 40ebc8ad67..6dac976f6b 100644 --- a/manila/share/drivers/container/storage_helper.py +++ b/manila/share/drivers/container/storage_helper.py @@ -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): diff --git a/manila/share/drivers/dell_emc/plugins/powermax/connection.py b/manila/share/drivers/dell_emc/plugins/powermax/connection.py index 00e5bc71c2..9a8bdef631 100644 --- a/manila/share/drivers/dell_emc/plugins/powermax/connection.py +++ b/manila/share/drivers/dell_emc/plugins/powermax/connection.py @@ -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, diff --git a/manila/share/drivers/dell_emc/plugins/unity/connection.py b/manila/share/drivers/dell_emc/plugins/unity/connection.py index bed268f406..baff0addb9 100644 --- a/manila/share/drivers/dell_emc/plugins/unity/connection.py +++ b/manila/share/drivers/dell_emc/plugins/unity/connection.py @@ -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, } diff --git a/manila/share/drivers/dell_emc/plugins/vnx/connection.py b/manila/share/drivers/dell_emc/plugins/vnx/connection.py index e5ba5730eb..623429db4a 100644 --- a/manila/share/drivers/dell_emc/plugins/vnx/connection.py +++ b/manila/share/drivers/dell_emc/plugins/vnx/connection.py @@ -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) diff --git a/manila/share/drivers/generic.py b/manila/share/drivers/generic.py index 9d14aac824..ff8ff83caf 100644 --- a/manila/share/drivers/generic.py +++ b/manila/share/drivers/generic.py @@ -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) diff --git a/manila/share/drivers/glusterfs/__init__.py b/manila/share/drivers/glusterfs/__init__.py index 38faf4565f..1b0ec02ffd 100644 --- a/manila/share/drivers/glusterfs/__init__.py +++ b/manila/share/drivers/glusterfs/__init__.py @@ -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) diff --git a/manila/share/drivers/glusterfs/glusterfs_native.py b/manila/share/drivers/glusterfs/glusterfs_native.py index 7342c0ceb9..9b5760e0fd 100644 --- a/manila/share/drivers/glusterfs/glusterfs_native.py +++ b/manila/share/drivers/glusterfs/glusterfs_native.py @@ -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. diff --git a/manila/share/drivers/hdfs/hdfs_native.py b/manila/share/drivers/hdfs/hdfs_native.py index fac91b1588..982825af6f 100644 --- a/manila/share/drivers/hdfs/hdfs_native.py +++ b/manila/share/drivers/hdfs/hdfs_native.py @@ -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() diff --git a/manila/share/drivers/hitachi/hnas/driver.py b/manila/share/drivers/hitachi/hnas/driver.py index 17958bff5f..193fc7d61d 100644 --- a/manila/share/drivers/hitachi/hnas/driver.py +++ b/manila/share/drivers/hitachi/hnas/driver.py @@ -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, diff --git a/manila/share/drivers/hitachi/hsp/driver.py b/manila/share/drivers/hitachi/hsp/driver.py index 0ef0c44ea2..bd227b7f0c 100644 --- a/manila/share/drivers/hitachi/hsp/driver.py +++ b/manila/share/drivers/hitachi/hsp/driver.py @@ -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, diff --git a/manila/share/drivers/hpe/hpe_3par_driver.py b/manila/share/drivers/hpe/hpe_3par_driver.py index c587f82f17..46b2a5533a 100644 --- a/manila/share/drivers/hpe/hpe_3par_driver.py +++ b/manila/share/drivers/hpe/hpe_3par_driver.py @@ -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) diff --git a/manila/share/drivers/huawei/v3/connection.py b/manila/share/drivers/huawei/v3/connection.py index b08f40ea46..95f4569ce6 100644 --- a/manila/share/drivers/huawei/v3/connection.py +++ b/manila/share/drivers/huawei/v3/connection.py @@ -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], diff --git a/manila/share/drivers/ibm/gpfs.py b/manila/share/drivers/ibm/gpfs.py index a4cc1766de..53f20063b4 100644 --- a/manila/share/drivers/ibm/gpfs.py +++ b/manila/share/drivers/ibm/gpfs.py @@ -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( diff --git a/manila/share/drivers/infinidat/infinibox.py b/manila/share/drivers/infinidat/infinibox.py index d15c6672bc..8a73cd299d 100644 --- a/manila/share/drivers/infinidat/infinibox.py +++ b/manila/share/drivers/infinidat/infinibox.py @@ -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, diff --git a/manila/share/drivers/infortrend/driver.py b/manila/share/drivers/infortrend/driver.py index ecf5e26704..cc25b4ceb6 100644 --- a/manila/share/drivers/infortrend/driver.py +++ b/manila/share/drivers/infortrend/driver.py @@ -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']) diff --git a/manila/share/drivers/inspur/as13000/as13000_nas.py b/manila/share/drivers/inspur/as13000/as13000_nas.py index 93bf7d20d8..e135503b78 100644 --- a/manila/share/drivers/inspur/as13000/as13000_nas.py +++ b/manila/share/drivers/inspur/as13000/as13000_nas.py @@ -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, diff --git a/manila/share/drivers/inspur/instorage/instorage.py b/manila/share/drivers/inspur/instorage/instorage.py index dc703ff3b8..3a1918063e 100644 --- a/manila/share/drivers/inspur/instorage/instorage.py +++ b/manila/share/drivers/inspur/instorage/instorage.py @@ -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, diff --git a/manila/share/drivers/lvm.py b/manila/share/drivers/lvm.py index fcda90e3e9..27bc602436 100644 --- a/manila/share/drivers/lvm.py +++ b/manila/share/drivers/lvm.py @@ -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): diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py index b94a41093c..d5677197d9 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py @@ -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], diff --git a/manila/share/drivers/nexenta/ns4/nexenta_nfs_helper.py b/manila/share/drivers/nexenta/ns4/nexenta_nfs_helper.py index e5e7296e79..792e53e2c0 100644 --- a/manila/share/drivers/nexenta/ns4/nexenta_nfs_helper.py +++ b/manila/share/drivers/nexenta/ns4/nexenta_nfs_helper.py @@ -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': ( diff --git a/manila/share/drivers/nexenta/ns5/nexenta_nas.py b/manila/share/drivers/nexenta/ns5/nexenta_nas.py index 26be90c8a5..fcb05aaaf0 100644 --- a/manila/share/drivers/nexenta/ns5/nexenta_nas.py +++ b/manila/share/drivers/nexenta/ns5/nexenta_nas.py @@ -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')), diff --git a/manila/share/drivers/purestorage/flashblade.py b/manila/share/drivers/purestorage/flashblade.py index 1fd87de6ef..a71b0dc4f7 100644 --- a/manila/share/drivers/purestorage/flashblade.py +++ b/manila/share/drivers/purestorage/flashblade.py @@ -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, diff --git a/manila/share/drivers/qnap/qnap.py b/manila/share/drivers/qnap/qnap.py index f95a02d755..20c8626613 100644 --- a/manila/share/drivers/qnap/qnap.py +++ b/manila/share/drivers/qnap/qnap.py @@ -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], diff --git a/manila/share/drivers/quobyte/quobyte.py b/manila/share/drivers/quobyte/quobyte.py index 983db5a6da..e2c2ec071a 100644 --- a/manila/share/drivers/quobyte/quobyte.py +++ b/manila/share/drivers/quobyte/quobyte.py @@ -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) diff --git a/manila/share/drivers/tegile/tegile.py b/manila/share/drivers/tegile/tegile.py index 6a5b0691a5..cacb08e4fe 100644 --- a/manila/share/drivers/tegile/tegile.py +++ b/manila/share/drivers/tegile/tegile.py @@ -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 diff --git a/manila/share/drivers/veritas/veritas_isa.py b/manila/share/drivers/veritas/veritas_isa.py index c9863fbca2..8483235dff 100644 --- a/manila/share/drivers/veritas/veritas_isa.py +++ b/manila/share/drivers/veritas/veritas_isa.py @@ -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 diff --git a/manila/share/drivers/zadara/zadara.py b/manila/share/drivers/zadara/zadara.py index 3e4e1a208b..37ab6015b9 100644 --- a/manila/share/drivers/zadara/zadara.py +++ b/manila/share/drivers/zadara/zadara.py @@ -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 diff --git a/manila/share/drivers/zfsonlinux/driver.py b/manila/share/drivers/zfsonlinux/driver.py index c126ed2552..4b3eae8d88 100644 --- a/manila/share/drivers/zfsonlinux/driver.py +++ b/manila/share/drivers/zfsonlinux/driver.py @@ -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', diff --git a/manila/tests/scheduler/fakes.py b/manila/tests/scheduler/fakes.py index 76f907023d..43fe4bb319 100644 --- a/manila/tests/scheduler/fakes.py +++ b/manila/tests/scheduler/fakes.py @@ -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, diff --git a/manila/tests/scheduler/filters/test_capacity.py b/manila/tests/scheduler/filters/test_capacity.py index efb40ce15b..6334e0e6a6 100644 --- a/manila/tests/scheduler/filters/test_capacity.py +++ b/manila/tests/scheduler/filters/test_capacity.py @@ -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) diff --git a/manila/tests/scheduler/test_host_manager.py b/manila/tests/scheduler/test_host_manager.py index 6db925bb53..cedf2c10de 100644 --- a/manila/tests/scheduler/test_host_manager.py +++ b/manila/tests/scheduler/test_host_manager.py @@ -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': [ diff --git a/manila/tests/share/drivers/cephfs/test_driver.py b/manila/tests/share/drivers/cephfs/test_driver.py index 89dee79070..75279f8e87 100644 --- a/manila/tests/share/drivers/cephfs/test_driver.py +++ b/manila/tests/share/drivers/cephfs/test_driver.py @@ -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']) diff --git a/manila/tests/share/drivers/container/test_driver.py b/manila/tests/share/drivers/container/test_driver.py index 06e8161f18..b162fc9a2f 100644 --- a/manila/tests/share/drivers/container/test_driver.py +++ b/manila/tests/share/drivers/container/test_driver.py @@ -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', diff --git a/manila/tests/share/drivers/container/test_storage_helper.py b/manila/tests/share/drivers/container/test_storage_helper.py index c1c62ea4a3..531c9d3929 100644 --- a/manila/tests/share/drivers/container/test_storage_helper.py +++ b/manila/tests/share/drivers/container/test_storage_helper.py @@ -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}] diff --git a/manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py b/manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py index 6f4e28681b..fbccfba31d 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py +++ b/manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py @@ -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']) diff --git a/manila/tests/share/drivers/dell_emc/plugins/unity/test_connection.py b/manila/tests/share/drivers/dell_emc/plugins/unity/test_connection.py index 4c0f748e63..4637ad1921 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/unity/test_connection.py +++ b/manila/tests/share/drivers/dell_emc/plugins/unity/test_connection.py @@ -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']) diff --git a/manila/tests/share/drivers/dell_emc/test_driver.py b/manila/tests/share/drivers/dell_emc/test_driver.py index da857fe6da..b72ec4e4e0 100644 --- a/manila/tests/share/drivers/dell_emc/test_driver.py +++ b/manila/tests/share/drivers/dell_emc/test_driver.py @@ -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 diff --git a/manila/tests/share/drivers/dummy.py b/manila/tests/share/drivers/dummy.py index 601827af65..f5a0b62bba 100644 --- a/manila/tests/share/drivers/dummy.py +++ b/manila/tests/share/drivers/dummy.py @@ -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, diff --git a/manila/tests/share/drivers/glusterfs/test_glusterfs_native.py b/manila/tests/share/drivers/glusterfs/test_glusterfs_native.py index 2853d2058e..07515c8505 100644 --- a/manila/tests/share/drivers/glusterfs/test_glusterfs_native.py +++ b/manila/tests/share/drivers/glusterfs/test_glusterfs_native.py @@ -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', diff --git a/manila/tests/share/drivers/hitachi/hnas/test_driver.py b/manila/tests/share/drivers/hitachi/hnas/test_driver.py index ee48e210de..e9d627a984 100644 --- a/manila/tests/share/drivers/hitachi/hnas/test_driver.py +++ b/manila/tests/share/drivers/hitachi/hnas/test_driver.py @@ -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, diff --git a/manila/tests/share/drivers/hitachi/hsp/fakes.py b/manila/tests/share/drivers/hitachi/hsp/fakes.py index 040e8a97c5..66b0dc4b62 100644 --- a/manila/tests/share/drivers/hitachi/hsp/fakes.py +++ b/manila/tests/share/drivers/hitachi/hsp/fakes.py @@ -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, diff --git a/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py b/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py index 642990a67c..018c5e491c 100644 --- a/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py +++ b/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py @@ -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, diff --git a/manila/tests/share/drivers/huawei/test_huawei_nas.py b/manila/tests/share/drivers/huawei/test_huawei_nas.py index 5f6a85b393..4b1673d05a 100644 --- a/manila/tests/share/drivers/huawei/test_huawei_nas.py +++ b/manila/tests/share/drivers/huawei/test_huawei_nas.py @@ -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, diff --git a/manila/tests/share/drivers/infinidat/test_infinidat.py b/manila/tests/share/drivers/infinidat/test_infinidat.py index 3eda0a469b..beebd5c542 100644 --- a/manila/tests/share/drivers/infinidat/test_infinidat.py +++ b/manila/tests/share/drivers/infinidat/test_infinidat.py @@ -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 diff --git a/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py b/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py index acd58a3e4e..7f15100f0e 100644 --- a/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py +++ b/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py @@ -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 diff --git a/manila/tests/share/drivers/inspur/instorage/test_instorage.py b/manila/tests/share/drivers/inspur/instorage/test_instorage.py index 4eb831e516..601a1b7587 100644 --- a/manila/tests/share/drivers/inspur/instorage/test_instorage.py +++ b/manila/tests/share/drivers/inspur/instorage/test_instorage.py @@ -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, diff --git a/manila/tests/share/drivers/maprfs/test_maprfs.py b/manila/tests/share/drivers/maprfs/test_maprfs.py index 6276ed6dd0..9cb5773a44 100644 --- a/manila/tests/share/drivers/maprfs/test_maprfs.py +++ b/manila/tests/share/drivers/maprfs/test_maprfs.py @@ -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: diff --git a/manila/tests/share/drivers/netapp/dataontap/fakes.py b/manila/tests/share/drivers/netapp/dataontap/fakes.py index 0c0fd2acdd..ddca99a3d2 100644 --- a/manila/tests/share/drivers/netapp/dataontap/fakes.py +++ b/manila/tests/share/drivers/netapp/dataontap/fakes.py @@ -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'] diff --git a/manila/tests/share/drivers/nexenta/ns4/test_nexenta_nas.py b/manila/tests/share/drivers/nexenta/ns4/test_nexenta_nas.py index 1e671e9a95..a7b3834770 100644 --- a/manila/tests/share/drivers/nexenta/ns4/test_nexenta_nas.py +++ b/manila/tests/share/drivers/nexenta/ns4/test_nexenta_nas.py @@ -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, diff --git a/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py b/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py index 2245a0cffa..74a55cf816 100644 --- a/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py +++ b/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py @@ -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, }], } diff --git a/manila/tests/share/drivers/quobyte/test_quobyte.py b/manila/tests/share/drivers/quobyte/test_quobyte.py index f5ba34c314..27bbf38e82 100644 --- a/manila/tests/share/drivers/quobyte/test_quobyte.py +++ b/manila/tests/share/drivers/quobyte/test_quobyte.py @@ -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 diff --git a/manila/tests/share/drivers/tegile/test_tegile.py b/manila/tests/share/drivers/tegile/test_tegile.py index 063fba4a4a..0979b70a68 100644 --- a/manila/tests/share/drivers/tegile/test_tegile.py +++ b/manila/tests/share/drivers/tegile/test_tegile.py @@ -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, diff --git a/manila/tests/share/drivers/test_generic.py b/manila/tests/share/drivers/test_generic.py index f547401a14..77cbee727d 100644 --- a/manila/tests/share/drivers/test_generic.py +++ b/manila/tests/share/drivers/test_generic.py @@ -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', ] diff --git a/manila/tests/share/drivers/test_glusterfs.py b/manila/tests/share/drivers/test_glusterfs.py index 6bda8df8b7..f3247a2a2b 100644 --- a/manila/tests/share/drivers/test_glusterfs.py +++ b/manila/tests/share/drivers/test_glusterfs.py @@ -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()) diff --git a/manila/tests/share/drivers/test_lvm.py b/manila/tests/share/drivers/test_lvm.py index ac101d7942..2501221518 100644 --- a/manila/tests/share/drivers/test_lvm.py +++ b/manila/tests/share/drivers/test_lvm.py @@ -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( diff --git a/manila/tests/share/drivers/veritas/test_veritas_isa.py b/manila/tests/share/drivers/veritas/test_veritas_isa.py index cf911acf4b..4b4134874c 100644 --- a/manila/tests/share/drivers/veritas/test_veritas_isa.py +++ b/manila/tests/share/drivers/veritas/test_veritas_isa.py @@ -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, diff --git a/manila/tests/share/drivers/zadara/test_zadara.py b/manila/tests/share/drivers/zadara/test_zadara.py index 04519f9e51..eb4dec6fa4 100644 --- a/manila/tests/share/drivers/zadara/test_zadara.py +++ b/manila/tests/share/drivers/zadara/test_zadara.py @@ -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) diff --git a/manila/tests/share/drivers/zfsonlinux/test_driver.py b/manila/tests/share/drivers/zfsonlinux/test_driver.py index 984892de19..c48c8f615f 100644 --- a/manila/tests/share/drivers/zfsonlinux/test_driver.py +++ b/manila/tests/share/drivers/zfsonlinux/test_driver.py @@ -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, diff --git a/manila/tests/share/test_driver.py b/manila/tests/share/test_driver.py index b576de379c..2713001471 100644 --- a/manila/tests/share/test_driver.py +++ b/manila/tests/share/test_driver.py @@ -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', ] diff --git a/releasenotes/notes/bug-1961087-add-reserved-share-extend-percentage-c6da2ac8a0113d2c.yaml b/releasenotes/notes/bug-1961087-add-reserved-share-extend-percentage-c6da2ac8a0113d2c.yaml new file mode 100644 index 0000000000..c8b7dc9739 --- /dev/null +++ b/releasenotes/notes/bug-1961087-add-reserved-share-extend-percentage-c6da2ac8a0113d2c.yaml @@ -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.