|
155 | 155 | type: bool
|
156 | 156 | description:
|
157 | 157 | - Use ZFS thin-provisioning.
|
| 158 | + snapshot_as_volume_chain: |
| 159 | + required: false |
| 160 | + type: bool |
| 161 | + default: false |
| 162 | + description: |
| 163 | + - Enable support for creating storage-vendor agnostic snapshot through volume backing-chains. |
| 164 | + - Only supported for LVM storage type. |
158 | 165 | is_mountpoint:
|
159 | 166 | required: false
|
160 | 167 | type: bool
|
|
227 | 234 | type: lvm
|
228 | 235 | content: [ "images", "rootdir" ]
|
229 | 236 | vgname: vg1
|
| 237 | +- name: Create an LVM storage type with snapshot support |
| 238 | + proxmox_storage: |
| 239 | + name: lvm1 |
| 240 | + type: lvm |
| 241 | + content: [ "images", "rootdir" ] |
| 242 | + vgname: vg1 |
| 243 | + snapshot_as_volume_chain: true |
230 | 244 | - name: Create an LVM-thin storage type
|
231 | 245 | proxmox_storage:
|
232 | 246 | name: lvmthin1
|
@@ -318,6 +332,7 @@ def __init__(self, module):
|
318 | 332 | self.vgname = module.params['vgname']
|
319 | 333 | self.thinpool = module.params['thinpool']
|
320 | 334 | self.sparse = module.params['sparse']
|
| 335 | + self.snapshot_as_volume_chain = module.params['snapshot_as_volume_chain'] |
321 | 336 | self.is_mountpoint = module.params['is_mountpoint']
|
322 | 337 | self.create_subdirs = module.params['create_subdirs']
|
323 | 338 |
|
@@ -345,6 +360,12 @@ def __init__(self, module):
|
345 | 360 | self.module.fail_json(msg=("encryption_key needs to be valid "
|
346 | 361 | "JSON or set to 'autogen'."))
|
347 | 362 |
|
| 363 | + if self.krbd is not None and self.type != 'rbd': |
| 364 | + self.module.fail_json(msg="krbd is only allowed with 'rbd' storage type") |
| 365 | + |
| 366 | + if self.snapshot_as_volume_chain is not None and self.type != 'lvm': |
| 367 | + self.module.fail_json(msg="snapshot_as_volume_chain is only allowed with 'lvm' storage type") |
| 368 | + |
348 | 369 | # Attempt to retrieve current/live storage definitions
|
349 | 370 | try:
|
350 | 371 | self.existing_storages = pvesh.get("storage")
|
@@ -418,6 +439,8 @@ def prepare_storage_args(self):
|
418 | 439 | args['namespace'] = self.namespace
|
419 | 440 | if self.sparse is not None:
|
420 | 441 | args['sparse'] = 1 if self.sparse else 0
|
| 442 | + if self.snapshot_as_volume_chain is not None: |
| 443 | + args['snapshot-as-volume-chain'] = 1 if self.snapshot_as_volume_chain else 0 |
421 | 444 | if self.is_mountpoint is not None:
|
422 | 445 | args['is_mountpoint'] = 1 if self.is_mountpoint else 0
|
423 | 446 | if self.create_subdirs is not None:
|
@@ -453,8 +476,6 @@ def prepare_storage_args(self):
|
453 | 476 | map(lambda cfg: '{}={}'.format(cfg['option'], cfg['value']), other_entries)
|
454 | 477 | )
|
455 | 478 | )
|
456 |
| - if self.krbd is not None and self.type != 'rbd': |
457 |
| - self.module.fail_json(msg="krbd is only allowed with 'rbd' storage type") |
458 | 479 |
|
459 | 480 | return args
|
460 | 481 |
|
@@ -594,6 +615,7 @@ def main():
|
594 | 615 | vgname=dict(default=None, type='str', required=False),
|
595 | 616 | thinpool=dict(default=None, type='str', required=False),
|
596 | 617 | sparse=dict(default=None, type='bool', required=False),
|
| 618 | + snapshot_as_volume_chain=dict(default=None, type='bool', required=False), |
597 | 619 | is_mountpoint=dict(default=None, type='bool', required=False),
|
598 | 620 | create_subdirs=dict(default=None, type='bool', required=False),
|
599 | 621 | namespace=dict(default=None, type='str', required=False),
|
|
0 commit comments