Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxmox_disk: prevent trying to shrink disks #7969

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- proxmox_disk - the module doesn't detect that shrinking a disk is not supported and fails
aBUDmdBQ marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions plugins/modules/proxmox_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading