1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

proxmox_kvm: allow setting format to null (None) (#1028)

* Allow setting format to null (None)

* Use string instead of None for consistency

* Add changelog

* Update changelogs/fragments/1028-proxmox-kvm-linked-clone.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/cloud/misc/proxmox_kvm.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Substitute 'unspecified' format with None

Co-authored-by: Lukasz Rzasik <lukasz.rzasik@dreamlab.net>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
lukaszrzasik 2020-10-10 10:53:09 +02:00 committed by GitHub
parent 277f2a7df5
commit e3e66a57ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- proxmox_kvm - fix issue causing linked clones not being create by allowing ``format=unspecified`` (https://github.com/ansible-collections/community.general/issues/1027).

View file

@ -120,9 +120,10 @@ options:
description: description:
- Target drive's backing file's data format. - Target drive's backing file's data format.
- Used only with clone - Used only with clone
- Use I(format=unspecified) and I(full=false) for a linked clone.
type: str type: str
default: qcow2 default: qcow2
choices: [ "cloop", "cow", "qcow", "qcow2", "qed", "raw", "vmdk" ] choices: [ "cloop", "cow", "qcow", "qcow2", "qed", "raw", "vmdk", "unspecified" ]
freeze: freeze:
description: description:
- Specify if PVE should freeze CPU at startup (use 'c' monitor command to start execution). - Specify if PVE should freeze CPU at startup (use 'c' monitor command to start execution).
@ -472,6 +473,22 @@ EXAMPLES = '''
format: qcow2 format: qcow2
timeout: 500 timeout: 500
- name: >
Create linked clone VM with only source VM name.
The VM source is spynal.
The target VM name is zavala
community.general.proxmox_kvm:
api_user: root@pam
api_password: secret
api_host: helldorado
clone: spynal
name: zavala
node: sabrewulf
storage: VMs
full: no
format: unspecified
timeout: 500
- name: Clone VM with source vmid and target newid and raw format - name: Clone VM with source vmid and target newid and raw format
community.general.proxmox_kvm: community.general.proxmox_kvm:
api_user: root@pam api_user: root@pam
@ -865,7 +882,7 @@ def main():
description=dict(type='str'), description=dict(type='str'),
digest=dict(type='str'), digest=dict(type='str'),
force=dict(type='bool', default=False), force=dict(type='bool', default=False),
format=dict(type='str', default='qcow2', choices=['cloop', 'cow', 'qcow', 'qcow2', 'qed', 'raw', 'vmdk']), format=dict(type='str', default='qcow2', choices=['cloop', 'cow', 'qcow', 'qcow2', 'qed', 'raw', 'vmdk', 'unspecified']),
freeze=dict(type='bool'), freeze=dict(type='bool'),
full=dict(type='bool', default=True), full=dict(type='bool', default=True),
hostpci=dict(type='dict'), hostpci=dict(type='dict'),
@ -945,6 +962,9 @@ def main():
vmid = module.params['vmid'] vmid = module.params['vmid']
validate_certs = module.params['validate_certs'] validate_certs = module.params['validate_certs']
if module.params['format'] == 'unspecified':
module.params['format'] = None
# If password not set get it from PROXMOX_PASSWORD env # If password not set get it from PROXMOX_PASSWORD env
if not api_password: if not api_password:
try: try: