105
105
elements: dict
106
106
'''
107
107
108
+ import copy
108
109
import logging
109
110
import os
110
111
import traceback
@@ -1500,6 +1501,39 @@ def activate_swaps(b, pools, volumes):
1500
1501
1501
1502
def run_module ():
1502
1503
# available arguments/parameters that a user can pass
1504
+ common_volume_opts = dict (encryption = dict (type = 'bool' ),
1505
+ encryption_cipher = dict (type = 'str' ),
1506
+ encryption_key = dict (type = 'str' ),
1507
+ encryption_key_size = dict (type = 'int' ),
1508
+ encryption_luks_version = dict (type = 'str' ),
1509
+ encryption_password = dict (type = 'str' ),
1510
+ fs_create_options = dict (type = 'str' ),
1511
+ fs_label = dict (type = 'str' , default = '' ),
1512
+ fs_type = dict (type = 'str' ),
1513
+ mount_options = dict (type = 'str' ),
1514
+ mount_point = dict (type = 'str' ),
1515
+ name = dict (type = 'str' ),
1516
+ raid_level = dict (type = 'str' ),
1517
+ size = dict (type = 'str' ),
1518
+ state = dict (type = 'str' , default = 'present' , choices = ['present' , 'absent' ]),
1519
+ type = dict (type = 'str' ))
1520
+ volume_opts = copy .deepcopy (common_volume_opts )
1521
+ volume_opts .update (
1522
+ dict (disks = dict (type = 'list' ),
1523
+ raid_device_count = dict (type = 'int' ),
1524
+ raid_spare_count = dict (type = 'int' ),
1525
+ raid_metadata_version = dict (type = 'str' )))
1526
+ pool_volume_opts = copy .deepcopy (common_volume_opts )
1527
+ pool_volume_opts .update (
1528
+ dict (cached = dict (type = 'bool' ),
1529
+ cache_devices = dict (type = 'list' , elements = 'str' , default = list ()),
1530
+ cache_mode = dict (type = 'str' ),
1531
+ cache_size = dict (type = 'str' ),
1532
+ compression = dict (type = 'bool' ),
1533
+ deduplication = dict (type = 'bool' ),
1534
+ raid_disks = dict (type = 'list' , elements = 'str' , default = list ()),
1535
+ vdo_pool_size = dict (type = 'str' )))
1536
+
1503
1537
module_args = dict (
1504
1538
pools = dict (type = 'list' , elements = 'dict' ,
1505
1539
options = dict (disks = dict (type = 'list' , elements = 'str' , default = list ()),
@@ -1517,49 +1551,9 @@ def run_module():
1517
1551
state = dict (type = 'str' , default = 'present' , choices = ['present' , 'absent' ]),
1518
1552
type = dict (type = 'str' ),
1519
1553
volumes = dict (type = 'list' , elements = 'dict' , default = list (),
1520
- options = dict (cached = dict (type = 'bool' ),
1521
- cache_devices = dict (type = 'list' , elements = 'str' , default = list ()),
1522
- cache_mode = dict (type = 'str' ),
1523
- cache_size = dict (type = 'str' ),
1524
- compression = dict (type = 'bool' ),
1525
- deduplication = dict (type = 'bool' ),
1526
- encryption = dict (type = 'bool' ),
1527
- encryption_cipher = dict (type = 'str' ),
1528
- encryption_key = dict (type = 'str' ),
1529
- encryption_key_size = dict (type = 'int' ),
1530
- encryption_luks_version = dict (type = 'str' ),
1531
- encryption_password = dict (type = 'str' ),
1532
- fs_create_options = dict (type = 'str' ),
1533
- fs_label = dict (type = 'str' , default = '' ),
1534
- fs_type = dict (type = 'str' ),
1535
- mount_point = dict (type = 'str' ),
1536
- name = dict (type = 'str' ),
1537
- raid_disks = dict (type = 'list' , elements = 'str' , default = list ()),
1538
- raid_level = dict (type = 'str' ),
1539
- size = dict (type = 'str' ),
1540
- state = dict (type = 'str' , default = 'present' , choices = ['present' , 'absent' ]),
1541
- type = dict (type = 'str' ),
1542
- vdo_pool_size = dict (type = 'str' ))))),
1554
+ options = pool_volume_opts ))),
1543
1555
volumes = dict (type = 'list' , elements = 'dict' ,
1544
- options = dict (disks = dict (type = 'list' ),
1545
- encryption = dict (type = 'bool' ),
1546
- encryption_cipher = dict (type = 'str' ),
1547
- encryption_key = dict (type = 'str' ),
1548
- encryption_key_size = dict (type = 'int' ),
1549
- encryption_luks_version = dict (type = 'str' ),
1550
- encryption_password = dict (type = 'str' ),
1551
- fs_create_options = dict (type = 'str' ),
1552
- fs_label = dict (type = 'str' , default = '' ),
1553
- fs_type = dict (type = 'str' ),
1554
- mount_point = dict (type = 'str' ),
1555
- name = dict (type = 'str' ),
1556
- raid_level = dict (type = 'str' ),
1557
- raid_device_count = dict (type = 'int' ),
1558
- raid_spare_count = dict (type = 'int' ),
1559
- raid_metadata_version = dict (type = 'str' ),
1560
- size = dict (type = 'str' ),
1561
- state = dict (type = 'str' , default = 'present' , choices = ['present' , 'absent' ]),
1562
- type = dict (type = 'str' ))),
1556
+ options = volume_opts ),
1563
1557
packages_only = dict (type = 'bool' , required = False , default = False ),
1564
1558
disklabel_type = dict (type = 'str' , required = False , default = None ),
1565
1559
safe_mode = dict (type = 'bool' , required = False , default = True ),
0 commit comments