Merge "Add snap reserve config option to NetApp cDOT driver"

This commit is contained in:
Jenkins 2016-01-07 22:40:16 +00:00 committed by Gerrit Code Review
commit 5f4978c506
6 changed files with 20 additions and 7 deletions

View File

@ -1131,7 +1131,8 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
def create_volume(self, aggregate_name, volume_name, size_gb, def create_volume(self, aggregate_name, volume_name, size_gb,
thin_provisioned=False, snapshot_policy=None, thin_provisioned=False, snapshot_policy=None,
language=None, dedup_enabled=False, language=None, dedup_enabled=False,
compression_enabled=False, max_files=None): compression_enabled=False, max_files=None,
snapshot_reserve=None):
"""Creates a volume.""" """Creates a volume."""
api_args = { api_args = {
@ -1146,6 +1147,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
api_args['snapshot-policy'] = snapshot_policy api_args['snapshot-policy'] = snapshot_policy
if language is not None: if language is not None:
api_args['language-code'] = language api_args['language-code'] = language
if snapshot_reserve is not None:
api_args['percentage-snapshot-reserve'] = six.text_type(
snapshot_reserve)
self.send_request('volume-create', api_args) self.send_request('volume-create', api_args)
# cDOT compression requires that deduplication be enabled. # cDOT compression requires that deduplication be enabled.

View File

@ -383,9 +383,10 @@ class NetAppCmodeFileStorageLibrary(object):
'provisioning options %(options)s', 'provisioning options %(options)s',
{'share': share_name, 'pool': pool_name, {'share': share_name, 'pool': pool_name,
'options': provisioning_options}) 'options': provisioning_options})
vserver_client.create_volume(pool_name, share_name, vserver_client.create_volume(
share['size'], pool_name, share_name, share['size'],
**provisioning_options) snapshot_reserve=self.configuration.
netapp_volume_snapshot_reserve_percent, **provisioning_options)
@na_utils.trace @na_utils.trace
def _remap_standard_boolean_extra_specs(self, extra_specs): def _remap_standard_boolean_extra_specs(self, extra_specs):

View File

@ -83,7 +83,13 @@ netapp_provisioning_opts = [
cfg.StrOpt('netapp_root_volume', cfg.StrOpt('netapp_root_volume',
deprecated_name='netapp_root_volume_name', deprecated_name='netapp_root_volume_name',
default='root', default='root',
help='Root volume name.'), ] help='Root volume name.'),
cfg.IntOpt('netapp_volume_snapshot_reserve_percent',
min=0,
max=90,
default=5,
help='The percentage of share space set aside as reserve for '
'snapshot usage; valid values range from 0 to 90.'), ]
netapp_cluster_opts = [ netapp_cluster_opts = [
cfg.StrOpt('netapp_vserver', cfg.StrOpt('netapp_vserver',

View File

@ -2055,7 +2055,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
fake.SHARE_AGGREGATE_NAME, fake.SHARE_NAME, 100, fake.SHARE_AGGREGATE_NAME, fake.SHARE_NAME, 100,
thin_provisioned=True, language='en-US', thin_provisioned=True, language='en-US',
snapshot_policy='default', dedup_enabled=True, snapshot_policy='default', dedup_enabled=True,
compression_enabled=True, max_files=5000) compression_enabled=True, max_files=5000, snapshot_reserve=15)
volume_create_args = { volume_create_args = {
'containing-aggr-name': fake.SHARE_AGGREGATE_NAME, 'containing-aggr-name': fake.SHARE_AGGREGATE_NAME,
@ -2065,6 +2065,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
'space-reserve': 'none', 'space-reserve': 'none',
'language-code': 'en-US', 'language-code': 'en-US',
'snapshot-policy': 'default', 'snapshot-policy': 'default',
'percentage-snapshot-reserve': '15',
} }
self.client.send_request.assert_called_with('volume-create', self.client.send_request.assert_called_with('volume-create',

View File

@ -569,7 +569,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
fake.POOL_NAME, fake.SHARE_NAME, fake.SHARE['size'], fake.POOL_NAME, fake.SHARE_NAME, fake.SHARE['size'],
thin_provisioned=True, snapshot_policy='default', thin_provisioned=True, snapshot_policy='default',
language='en-US', dedup_enabled=True, language='en-US', dedup_enabled=True,
compression_enabled=False, max_files=5000) compression_enabled=False, max_files=5000, snapshot_reserve=8)
mock_remap_standard_boolean_extra_specs.assert_called_once_with( mock_remap_standard_boolean_extra_specs.assert_called_once_with(
fake.EXTRA_SPEC) fake.EXTRA_SPEC)

View File

@ -511,4 +511,5 @@ def get_config_cmode():
config.netapp_root_volume_aggregate = ROOT_VOLUME_AGGREGATE config.netapp_root_volume_aggregate = ROOT_VOLUME_AGGREGATE
config.netapp_root_volume = ROOT_VOLUME config.netapp_root_volume = ROOT_VOLUME
config.netapp_lif_name_template = LIF_NAME_TEMPLATE config.netapp_lif_name_template = LIF_NAME_TEMPLATE
config.netapp_volume_snapshot_reserve_percent = 8
return config return config