-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 Allow vm hibernation #9653
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this 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.
@@ -0,0 +1,2 @@ | |||
minor_changes: | |||
- proxmox_kvm - allow hibernation and suspending of VMs (https://github.com/ansible-collections/community.general/pull/9653), (https://github.com/ansible-collections/community.general/issues/9620). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- proxmox_kvm - allow hibernation and suspending of VMs (https://github.com/ansible-collections/community.general/pull/9653), (https://github.com/ansible-collections/community.general/issues/9620). | |
- proxmox_kvm - allow hibernation and suspending of VMs (https://github.com/ansible-collections/community.general/issues/9620, https://github.com/ansible-collections/community.general/pull/9653). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in commit 739193e
@@ -456,7 +456,7 @@ | |||
- If V(current), the current state of the VM will be fetched. You can access it with C(results.status). | |||
- V(template) was added in community.general 8.1.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- V(template) was added in community.general 8.1.0. | |
- V(template) was added in community.general 8.1.0. | |
- V(paused) and V(hibernated) were added in community.general 10.4.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo in Felix's comment: version is 10.4.0 not 11.4.0 ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in commit 739193e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @ff05 thanks for your PR!
Couple of comments below.
if not self.wait_for_task(vm['node'], taskid): | ||
self.module.fail_json(msg='Reached timeout while waiting for suspending VM. Last line in task before timeout: %s' % | ||
proxmox_node.tasks(taskid).log.get()[:1]) | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is never executed - fail_json()
ends up raising an exception, and rips through the call stack. Please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which line do you mean exactly? I tried to stay in line with the existing code base
vmid = vm['vmid'] | ||
proxmox_node = self.proxmox_api.nodes(vm['node']) | ||
taskid = proxmox_node.qemu(vmid).status.suspend.post(todisk=(1 if todisk else 0), timeout=timeout) | ||
if not self.wait_for_task(vm['node'], taskid): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any option for the user so that they do not have to wait for the operation to complete? As in a a fire-and-forget kind of operation. Apparently not, just making sure.
If indeed it has no such option, I would suggest adding one (on a different PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be possible to implement, but the other states also doesn't have a "fire and forget". So Yeah I think that should be another PR implementing that for all possble states
@@ -456,7 +456,7 @@ | |||
- If V(current), the current state of the VM will be fetched. You can access it with C(results.status). | |||
- V(template) was added in community.general 8.1.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo in Felix's comment: version is 10.4.0 not 11.4.0 ;-)
@ff05 this PR contains the following merge commits: Please rebase your branch to remove these commits. |
SUMMARY
ISSUE TYPE
Feature Pull Request
COMPONENT NAME
proxmox_kvm
ADDITIONAL INFORMATION
solves #9620