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: Add clone parameter #3930

Conversation

m-rtijn
Copy link
Contributor

@m-rtijn m-rtijn commented Dec 20, 2021

SUMMARY

This PR adds a 'clone' parameter to the proxmox module to clone a container. The implementation is based on the clone option in the proxmox_kvm module.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

proxmox

WIP

A small todo list of things which I already know I should do:

  • Check if the older OpenVZ type also supports the clone API operation just like the LXC one. If not, make sure that the clone operation is only used with LXC-enabled proxmox nodes. Not solved, just ignored: it now fails when using this on a node that does not use LXC. A note is added in the documentation.
  • Actually test out the code
  • Check development conventions
  • Check documentation conventions
  • Add changelog fragment
  • Change the required_if[('state', 'present' ... accordingly
  • Check if cloned container is a template or not (if not, a 'storage' parameter can't be passed/should be ignored)
  • Add extra examples

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress cloud feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Dec 20, 2021
@m-rtijn
Copy link
Contributor Author

m-rtijn commented Dec 20, 2021

Hm. It fails with an error that the clone parameter is not supported. It is however supplied to the AnsibleModule(argument_spec), so I'm not sure what wrong here.

@felixfontein felixfontein added backport-4 check-before-release PR will be looked at again shortly before release and merged if possible. labels Dec 21, 2021
m-rtijn and others added 2 commits December 21, 2021 11:01
Co-authored-by: Felix Fontein <[email protected]>
@m-rtijn
Copy link
Contributor Author

m-rtijn commented Dec 21, 2021

Hm. It fails with an error that the clone parameter is not supported. It is however supplied to the AnsibleModule(argument_spec), so I'm not sure what wrong here.

Ah never mind this, I wasn't running my own code :')

@ansibullbot

This comment has been minimized.

@ansibullbot ansibullbot added the ci_verified Push fixes to PR branch to re-run CI label Dec 21, 2021
@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Dec 21, 2021
@ansibullbot

This comment has been minimized.

@ansibullbot ansibullbot added the ci_verified Push fixes to PR branch to re-run CI label Dec 21, 2021
@m-rtijn
Copy link
Contributor Author

m-rtijn commented Dec 21, 2021

While debugging I discovered that I get "400 Bad Request: Parameter verification failed" (PVE v7.1-8) errors even when not running my own changes when I try to create a new container. So that's a bit of a bummer (and oversight that I didn't try that first 😅)

@m-rtijn
Copy link
Contributor Author

m-rtijn commented Dec 22, 2021

While debugging I discovered that I get "400 Bad Request: Parameter verification failed" (PVE v7.1-8) errors even when not running my own changes when I try to create a new container. So that's a bit of a bummer (and oversight that I didn't try that first sweat_smile)

Ah, I found the culprit. It's a bit disappointing that proxmoxer only gives a 400 error even though the PVE API neatly tells the user what the error is.

@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Dec 22, 2021
@ansibullbot

This comment has been minimized.

@m-rtijn m-rtijn changed the title [WIP] proxmox: Add clone parameter proxmox: Add clone parameter Dec 22, 2021
@ansibullbot ansibullbot removed the WIP Work in progress label Dec 22, 2021
@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 23, 2021
@m-rtijn m-rtijn requested a review from felixfontein December 23, 2021 19:03
plugins/modules/cloud/misc/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/cloud/misc/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/cloud/misc/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/cloud/misc/proxmox.py Outdated Show resolved Hide resolved
m-rtijn and others added 4 commits December 24, 2021 18:02
Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
@m-rtijn m-rtijn requested a review from felixfontein December 24, 2021 17:05
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 reasonable to me. Let's see what the modue maintainers say about this.

@ansibullbot ansibullbot added stale_ci CI is older than 7 days, rerun before merging has_issue labels Jan 3, 2022
@felixfontein
Copy link
Collaborator

If nobody complains, I'll merge this in a few days.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 6, 2022
@felixfontein felixfontein merged commit b0c27f7 into ansible-collections:main Jan 6, 2022
@patchback
Copy link

patchback bot commented Jan 6, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/b0c27f7a688344359875be604927f216df847ca7/pr-3930

Backported as #3992

🤖 @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 Jan 6, 2022
* proxmox: Add clone parameter

* Add changelog fragment

* Add version_added

Co-authored-by: Felix Fontein <[email protected]>

* Add PR URL to changelog fragment

Co-authored-by: Felix Fontein <[email protected]>

* Clarify what content_check does

* Split up try/except block to give a separate error message when creation pre-checks fail

* Create seperate case for cloning

* Prevent 'clone' argument from being removed

* Fix double argument, add todo's

* Check if to be cloned container actually exists

* Adjust module options dependencies

* Require 'storage' parameter when cloned container is not a template and ignore otherwise

* Don't only create linked clones of template containers

* Fix pylint errors

* Add extra example

* Minor language fix

* Add clone_type parameter to specify cloning behaviour

* I can't find if openvz nodes have this clone API, so just don't support it

* Remove unrelated changes

* Don't pass unused kwargs

* Revert more unrelated changes

* Remove required_together clone and clone_type because clone_type has a default choice

* Fix clone_type reference

Co-authored-by: Felix Fontein <[email protected]>

* Fix missing period

Co-authored-by: Felix Fontein <[email protected]>

* Fix redundant period

Co-authored-by: Felix Fontein <[email protected]>

* Fix redundant period

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit b0c27f7)
@felixfontein
Copy link
Collaborator

@m-rtijn thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Jan 6, 2022
* proxmox: Add clone parameter

* Add changelog fragment

* Add version_added

Co-authored-by: Felix Fontein <[email protected]>

* Add PR URL to changelog fragment

Co-authored-by: Felix Fontein <[email protected]>

* Clarify what content_check does

* Split up try/except block to give a separate error message when creation pre-checks fail

* Create seperate case for cloning

* Prevent 'clone' argument from being removed

* Fix double argument, add todo's

* Check if to be cloned container actually exists

* Adjust module options dependencies

* Require 'storage' parameter when cloned container is not a template and ignore otherwise

* Don't only create linked clones of template containers

* Fix pylint errors

* Add extra example

* Minor language fix

* Add clone_type parameter to specify cloning behaviour

* I can't find if openvz nodes have this clone API, so just don't support it

* Remove unrelated changes

* Don't pass unused kwargs

* Revert more unrelated changes

* Remove required_together clone and clone_type because clone_type has a default choice

* Fix clone_type reference

Co-authored-by: Felix Fontein <[email protected]>

* Fix missing period

Co-authored-by: Felix Fontein <[email protected]>

* Fix redundant period

Co-authored-by: Felix Fontein <[email protected]>

* Fix redundant period

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit b0c27f7)

Co-authored-by: Martijn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloud feature This issue/PR relates to a feature request has_issue module module new_contributor Help guide this first time contributor plugins plugin (any type) stale_ci CI is older than 7 days, rerun before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants