Added parameters to na_cdot_volume (#37202)
* Added parameters to na_cdot_volume Before this commit there were no parameter for creating a volume and exporting it as NFS volume. The added parameters are: - *junction-path* for specifying where to mount the volume in the namespace - *export-policy* for specifying which export policy to apply to the given namespace - *snapshot-policy* if required, applying a snapshot policy for scheduling data protection tasks * Sanity fixes * Sanity fixes (2)
This commit is contained in:
parent
872a7b4a7a
commit
e541bed186
1 changed files with 41 additions and 3 deletions
|
@ -69,6 +69,26 @@ options:
|
||||||
- Name of the vserver to use.
|
- Name of the vserver to use.
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
junction_path:
|
||||||
|
description:
|
||||||
|
- Junction path where to mount the volume
|
||||||
|
required: false
|
||||||
|
version_added: '2.6'
|
||||||
|
|
||||||
|
export_policy:
|
||||||
|
description:
|
||||||
|
- Export policy to set for the specified junction path.
|
||||||
|
required: false
|
||||||
|
default: default
|
||||||
|
version_added: '2.6'
|
||||||
|
|
||||||
|
snapshot_policy:
|
||||||
|
description:
|
||||||
|
- Snapshot policy to set for the specified volume.
|
||||||
|
required: false
|
||||||
|
default: default
|
||||||
|
version_added: '2.6'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
|
@ -85,6 +105,9 @@ EXAMPLES = """
|
||||||
hostname: "{{ netapp_hostname }}"
|
hostname: "{{ netapp_hostname }}"
|
||||||
username: "{{ netapp_username }}"
|
username: "{{ netapp_username }}"
|
||||||
password: "{{ netapp_password }}"
|
password: "{{ netapp_password }}"
|
||||||
|
junction_path: /ansibleVolume
|
||||||
|
export_policy: all_nfs_networks
|
||||||
|
snapshot_policy: daily
|
||||||
|
|
||||||
- name: Make FlexVol offline
|
- name: Make FlexVol offline
|
||||||
na_cdot_volume:
|
na_cdot_volume:
|
||||||
|
@ -142,6 +165,9 @@ class NetAppCDOTVolume(object):
|
||||||
'pb', 'eb', 'zb', 'yb'], type='str'),
|
'pb', 'eb', 'zb', 'yb'], type='str'),
|
||||||
aggregate_name=dict(type='str'),
|
aggregate_name=dict(type='str'),
|
||||||
vserver=dict(required=True, type='str', default=None),
|
vserver=dict(required=True, type='str', default=None),
|
||||||
|
junction_path=dict(required=False, type='str', default=None),
|
||||||
|
export_policy=dict(required=False, type='str', default='default'),
|
||||||
|
snapshot_policy=dict(required=False, type='str', default='default'),
|
||||||
))
|
))
|
||||||
|
|
||||||
self.module = AnsibleModule(
|
self.module = AnsibleModule(
|
||||||
|
@ -161,6 +187,9 @@ class NetAppCDOTVolume(object):
|
||||||
self.is_online = p['is_online']
|
self.is_online = p['is_online']
|
||||||
self.size_unit = p['size_unit']
|
self.size_unit = p['size_unit']
|
||||||
self.vserver = p['vserver']
|
self.vserver = p['vserver']
|
||||||
|
self.junction_path = p['junction_path']
|
||||||
|
self.export_policy = p['export_policy']
|
||||||
|
self.snapshot_policy = p['snapshot_policy']
|
||||||
|
|
||||||
if p['size'] is not None:
|
if p['size'] is not None:
|
||||||
self.size = p['size'] * self._size_unit_map[self.size_unit]
|
self.size = p['size'] * self._size_unit_map[self.size_unit]
|
||||||
|
@ -226,10 +255,19 @@ class NetAppCDOTVolume(object):
|
||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
def create_volume(self):
|
def create_volume(self):
|
||||||
volume_create = netapp_utils.zapi.NaElement.create_node_with_children(
|
create_parameters = {'volume': self.name,
|
||||||
'volume-create', **{'volume': self.name,
|
|
||||||
'containing-aggr-name': self.aggregate_name,
|
'containing-aggr-name': self.aggregate_name,
|
||||||
'size': str(self.size)})
|
'size': str(self.size),
|
||||||
|
}
|
||||||
|
if self.junction_path:
|
||||||
|
create_parameters['junction-path'] = str(self.junction_path)
|
||||||
|
if self.export_policy != 'default':
|
||||||
|
create_parameters['export-policy'] = str(self.export_policy)
|
||||||
|
if self.snapshot_policy != 'default':
|
||||||
|
create_parameters['snapshot-policy'] = str(self.snapshot_policy)
|
||||||
|
|
||||||
|
volume_create = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||||
|
'volume-create', **create_parameters)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.server.invoke_successfully(volume_create,
|
self.server.invoke_successfully(volume_create,
|
||||||
|
|
Loading…
Reference in a new issue