mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
proxmox_disk: prevent trying to shrink disks
Shrinking Disks is not supported by the PVE API (https://pve.proxmox.com/wiki/Resize_disks) and should be prevented by the module.
This commit is contained in:
parent
980fa36fac
commit
a7e6bfa0ba
1 changed files with 2 additions and 0 deletions
|
@ -816,6 +816,8 @@ def main():
|
|||
actual_size = disk_config['size']
|
||||
if size == actual_size:
|
||||
module.exit_json(changed=False, vmid=vmid, msg="Disk %s is already %s size" % (disk, size))
|
||||
elif size < actual_size:
|
||||
module.fail_json(changed=False, vmid=vmid, msg="Disk %s is size %s, which is smaller than %s: shrinking disks is not supported" % (disk, actual_size, size))
|
||||
proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).resize.set(disk=disk, size=size)
|
||||
module.exit_json(changed=True, vmid=vmid, msg="Disk %s resized in VM %s" % (disk, vmid))
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in a new issue