Add junction path to ontap_volume_clone (#51391)
* changes to clusteR * Revert "changes to clusteR" This reverts commit 33ee1b71e4bc8435fb315762a871f8c4cb6c5f80. * add new option * Fix issues
This commit is contained in:
parent
cd9471ef17
commit
994063bbf9
1 changed files with 20 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# (c) 2018, NetApp, Inc
|
# (c) 2018-2019, NetApp, Inc
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
@ -55,20 +55,25 @@ options:
|
||||||
description:
|
description:
|
||||||
- The volume-type setting which should be used for the volume clone.
|
- The volume-type setting which should be used for the volume clone.
|
||||||
choices: ['rw', 'dp']
|
choices: ['rw', 'dp']
|
||||||
|
junction_path:
|
||||||
|
version_added: '2.8'
|
||||||
|
description:
|
||||||
|
- Junction path of the volume.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: create volume clone
|
- name: create volume clone
|
||||||
na_ontap_volume_clone:
|
na_ontap_volume_clone:
|
||||||
state=present
|
state: present
|
||||||
username=admin
|
username: "{{ netapp username }}"
|
||||||
password=netapp1!
|
password: "{{ netapp password }}"
|
||||||
hostname=10.193.74.27
|
hostname: "{{ netapp hostname }}"
|
||||||
vserver=vs_hack
|
vserver: vs_hack
|
||||||
parent_volume=normal_volume
|
parent_volume: normal_volume
|
||||||
volume=clone_volume_7
|
volume: clone_volume_7
|
||||||
space_reserve=none
|
space_reserve: none
|
||||||
parent_snapshot=backup1
|
parent_snapshot: backup1
|
||||||
|
junction_path: /clone_volume_7
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
|
@ -100,6 +105,7 @@ class NetAppOntapVolumeClone(object):
|
||||||
qos_policy_group_name=dict(required=False, type='str', default=None),
|
qos_policy_group_name=dict(required=False, type='str', default=None),
|
||||||
space_reserve=dict(required=False, choices=['volume', 'none'], default=None),
|
space_reserve=dict(required=False, choices=['volume', 'none'], default=None),
|
||||||
volume_type=dict(required=False, choices=['rw', 'dp']),
|
volume_type=dict(required=False, choices=['rw', 'dp']),
|
||||||
|
junction_path=dict(required=False, type='str', default=None)
|
||||||
))
|
))
|
||||||
|
|
||||||
self.module = AnsibleModule(
|
self.module = AnsibleModule(
|
||||||
|
@ -119,6 +125,7 @@ class NetAppOntapVolumeClone(object):
|
||||||
self.volume = parameters['volume']
|
self.volume = parameters['volume']
|
||||||
self.volume_type = parameters['volume_type']
|
self.volume_type = parameters['volume_type']
|
||||||
self.vserver = parameters['vserver']
|
self.vserver = parameters['vserver']
|
||||||
|
self.junction_path = parameters['junction_path']
|
||||||
|
|
||||||
if HAS_NETAPP_LIB is False:
|
if HAS_NETAPP_LIB is False:
|
||||||
self.module.fail_json(msg="the python NetApp-Lib module is required")
|
self.module.fail_json(msg="the python NetApp-Lib module is required")
|
||||||
|
@ -143,6 +150,8 @@ class NetAppOntapVolumeClone(object):
|
||||||
clone_obj.add_new_child("parent-vserver", self.parent_vserver)
|
clone_obj.add_new_child("parent-vserver", self.parent_vserver)
|
||||||
if self.volume_type:
|
if self.volume_type:
|
||||||
clone_obj.add_new_child("volume-type", self.volume_type)
|
clone_obj.add_new_child("volume-type", self.volume_type)
|
||||||
|
if self.junction_path:
|
||||||
|
clone_obj.add_new_child("junction-path", self.junction_path)
|
||||||
self.server.invoke_successfully(clone_obj, True)
|
self.server.invoke_successfully(clone_obj, True)
|
||||||
|
|
||||||
def does_volume_clone_exists(self):
|
def does_volume_clone_exists(self):
|
||||||
|
@ -150,7 +159,7 @@ class NetAppOntapVolumeClone(object):
|
||||||
clone_obj.add_new_child("volume", self.volume)
|
clone_obj.add_new_child("volume", self.volume)
|
||||||
try:
|
try:
|
||||||
results = self.server.invoke_successfully(clone_obj, True)
|
results = self.server.invoke_successfully(clone_obj, True)
|
||||||
except Exception:
|
except netapp_utils.zapi.NaApiError:
|
||||||
return False
|
return False
|
||||||
attributes = results.get_child_by_name('attributes')
|
attributes = results.get_child_by_name('attributes')
|
||||||
info = attributes.get_child_by_name('volume-clone-info')
|
info = attributes.get_child_by_name('volume-clone-info')
|
||||||
|
|
Loading…
Reference in a new issue