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_kvm - new param to support unsafe updates #7843

Merged

Conversation

nxet
Copy link
Contributor

@nxet nxet commented Jan 14, 2024

SUMMARY

Add parameter update_unsafe to avoid limitations when updating dangerous values.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

proxmox_kvm

ADDITIONAL INFORMATION

This simply allows to override the limits present on specific config options during update.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module plugins plugin (any type) labels Jan 14, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch labels Jan 14, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've added some first comments.

changelogs/fragments/7843-proxmox_kvm-update_unsafe.yml Outdated Show resolved Hide resolved
plugins/modules/proxmox_kvm.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_kvm.py Outdated Show resolved Hide resolved
Co-authored-by: Felix Fontein <felix@fontein.de>
@nxet
Copy link
Contributor Author

nxet commented Jan 16, 2024

Thank you for taking the time to review the PR.

While we have the thread open, I'd like to ping the module creator @helldorado and quickly discuss the original update parameter.

While I understand that reducing the number of ways an user can shoot themself in the foot is always a good approach, in this instance I believe the module should not enforce this restriction, and instead transparently implement the Proxmox API.
This is based on the assumption that the API devs know better where to place hard limits on their interfaces (e.g. many calls are restricted to authentication as root@pam + password, completely disabling token auth).
Any extra layer of security implemented on our part should be exclusively related to ansible and its inner workings, otherwise it looks quite arbitrary IMO. This also means extra documentation to be maintained.
Not to mention it forces the user to keep an eye on these extra docs thus fragmenting the API knowledge base, and possibly requiring workarounds to achieve tasks otherwise easily doable with direct API access.

Therefore I believe the module should avoid this opinion, thus removing the lines of code clearing up "unsafe" parameters.

What do you think?
Why was this feature implemented in the first place?

Thanks for your time

@felixfontein
Copy link
Collaborator

I don't know the proxmox API (and proxmox in general), but generally options that can avoid in data loss that potentially surprises users should be taken care of specially. For disk-related options, it could be that changing their values would re-create the disks and thus make all the data stored on the current disk(s) vanish. TPM state could contain cryptographic keys that get lost (and can't be recovered if they weren't stored anywhere else). (Losing network access is inconvenient, but nothing that cannot be undone without permanent loss of data. So no idea why net is part of this.)

@@ -525,6 +525,12 @@
- Update of O(pool) is disabled. It needs an additional API endpoint not covered by this module.
type: bool
default: false
update_unsafe:
description:
- If V(true), does not enforce limitations on parameters O(net), O(virtio), O(ide), O(sata), and O(scsi).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing two affected parameters:

Suggested change
- If V(true), does not enforce limitations on parameters O(net), O(virtio), O(ide), O(sata), and O(scsi).
- If V(true), does not enforce limitations on parameters O(net), O(virtio), O(ide), O(sata), O(scsi), O(efidisk0), and O(tpmstate0).

@felixfontein
Copy link
Collaborator

Actually I just saw that the documentation for the update option contains some rationale, and also mentions why net is on the list.

Your PR should also update documentation for update to mention the new update_safe option.

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Jan 29, 2024
@ansibullbot ansibullbot removed the stale_ci CI is older than 7 days, rerun before merging label Jan 31, 2024
@nxet
Copy link
Contributor Author

nxet commented Jan 31, 2024

Sorry it took a while.
I totally understand and agree with your point, it makes a lot of sense to implement this extra security step.
I just pushed a couple small improvements to the docs, let me know if there's anything else!

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. If nobody objects, I'll merge this in ~a week.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Feb 7, 2024
@felixfontein felixfontein merged commit c7a2e28 into ansible-collections:main Feb 7, 2024
121 checks passed
Copy link

patchback bot commented Feb 7, 2024

Backport to stable-8: cherry-pick succeeded

Backport PR branch: patchback/backports/stable-8/c7a2e28daa262bebe45b76173ceca85b86043046/pr-7843

PR branch created, proceeding with making a PR.

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Feb 7, 2024
* proxmox_kvm - new param to support unsafe updates

* changelog fragments

* Apply suggestions from code review

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

* improved docs

* updated `version_added`

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c7a2e28)
@felixfontein
Copy link
Collaborator

@nxet thanks for your contribution!

@felixfontein felixfontein added backport-8 Automatically create a backport for the stable-8 branch and removed backport-8 Automatically create a backport for the stable-8 branch labels Feb 7, 2024
Copy link

patchback bot commented Feb 7, 2024

Backport to stable-8: cherry-pick succeeded

Backport PR branch: patchback/backports/stable-8/c7a2e28daa262bebe45b76173ceca85b86043046/pr-7843

PR branch created, proceeding with making a PR.

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Feb 7, 2024
* proxmox_kvm - new param to support unsafe updates

* changelog fragments

* Apply suggestions from code review

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

* improved docs

* updated `version_added`

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c7a2e28)
felixfontein added a commit that referenced this pull request Feb 7, 2024
…7954)

proxmox_kvm - new param to support unsafe updates (#7843)

* proxmox_kvm - new param to support unsafe updates

* changelog fragments

* Apply suggestions from code review

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

* improved docs

* updated `version_added`

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c7a2e28)

Co-authored-by: nxet <nxet821@protonmail.com>
@nxet
Copy link
Contributor Author

nxet commented Feb 7, 2024

@felixfontein thanks to you for the review and merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch feature This issue/PR relates to a feature request module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants