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

feat: proxmox_vm_info - add network information for guests #8471

Merged

Conversation

coffeelover
Copy link
Contributor

SUMMARY

Information of guests should include current network settings to support waiting on network settings when provisioning new machines. The methods for accessing the information are already present in the API and only need to be called.

The retrieval of network information can be enabled/disabled via new bool param network (default=false)

For qemu vms, agent must be enabled and running. Otherwise, a clear error message from the API is shown:
"msg": "Failed to retrieve QEMU VMs information: 500 Internal Server Error: QEMU guest agent is not running"

For lxc containers, the information is always there.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

proxmox_vm_info

ADDITIONAL INFORMATION

Information of guests should include current network settings to support waiting on network settings when provisioning new machines. The methods for accessing the information are already present in the API and only need to be called.

New list of network interfaces in the result:

(QEMU)
[...]
"network": [
                    {
                        "hardware-address": "00:00:00:00:00:00",
                        "ip-addresses": [
                            {
                                "ip-address": "127.0.0.1",
                                "ip-address-type": "ipv4",
                                "prefix": 8
                            },
                            {
                                "ip-address": "::1",
                                "ip-address-type": "ipv6",
                                "prefix": 128
                            }
                        ],
                        "name": "lo",
                        "statistics": {
                            "rx-bytes": 5920,
                            "rx-dropped": 0,
                            "rx-errs": 0,
                            "rx-packets": 80,
                            "tx-bytes": 5920,
                            "tx-dropped": 0,
                            "tx-errs": 0,
                            "tx-packets": 80
                        }
                    },
                    {
                        "hardware-address": "bc:24:XX:XX:73:6d",
                        "ip-addresses": [
                            {
                                "ip-address": "192.168.XXX.XXX",
                                "ip-address-type": "ipv4",
                                "prefix": 24
                            },
                            {
                                "ip-address": "fe80::be24:XXXX:XXXX:736d",
                                "ip-address-type": "ipv6",
                                "prefix": 64
                            }
                        ],
                        "name": "ens18",
                        "statistics": {
                            "rx-bytes": 6134,
                            "rx-dropped": 30,
                            "rx-errs": 0,
                            "rx-packets": 51,
                            "tx-bytes": 1016,
                            "tx-dropped": 0,
                            "tx-errs": 0,
                            "tx-packets": 6
                        }
                    }
                ],
[...]

(LXC)
[...]
                "network": [
                    {
                        "hwaddr": "00:00:00:00:00:00",
                        "inet": "127.0.0.1/8",
                        "inet6": "::1/128",
                        "name": "lo"
                    },
                    {
                        "hwaddr": "82:00:XX:XX:84:f8",
                        "inet": "192.168.XXX.XXX/24",
                        "inet6": "fe80::8000:XXXX:XXXX:84f8/64",
                        "name": "eth0"
                    }
                ],
[...]

- Uses agent information for qemu-vms
- Uses network information for lxc container
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Jun 6, 2024
@coffeelover coffeelover changed the title feat: add network information for guests feat: proxmox_vm_info - add network information for guests Jun 6, 2024
@coffeelover coffeelover marked this pull request as ready for review June 6, 2024 15:46
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed WIP Work in progress labels Jun 6, 2024
@ansibullbot ansibullbot removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jun 6, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-9 Automatically create a backport for the stable-9 branch labels Jun 7, 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.

plugins/modules/proxmox_vm_info.py Show resolved Hide resolved
plugins/modules/proxmox_vm_info.py Outdated Show resolved Hide resolved
coffeelover and others added 2 commits June 8, 2024 16:01
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
@coffeelover
Copy link
Contributor Author

Thank you. I committed your suggestions.

@felixfontein
Copy link
Collaborator

As far as I can judge this looks good. 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 Jun 14, 2024
@felixfontein felixfontein merged commit 2574cb0 into ansible-collections:main Jun 14, 2024
132 checks passed
Copy link

patchback bot commented Jun 14, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/2574cb0dea23008be2cc158310523b00e72354d4/pr-8471

Backported as #8505

🤖 @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 Jun 14, 2024
* feat: add network information for guests

- Uses agent information for qemu-vms
- Uses network information for lxc container

* chore: add changelog fragment

* fix: change default, add doc

* chore: clarify doc

* chore: add optional ,

* chore: fix pep8 indentation warning

* Update plugins/modules/proxmox_vm_info.py

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

* Update plugins/modules/proxmox_vm_info.py

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

---------

Co-authored-by: Jan Wenzel <jan.wenzel@gonicus.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2574cb0)
@felixfontein
Copy link
Collaborator

@coffeelover thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Jun 14, 2024
…twork information for guests (#8505)

feat: proxmox_vm_info - add network information for guests (#8471)

* feat: add network information for guests

- Uses agent information for qemu-vms
- Uses network information for lxc container

* chore: add changelog fragment

* fix: change default, add doc

* chore: clarify doc

* chore: add optional ,

* chore: fix pep8 indentation warning

* Update plugins/modules/proxmox_vm_info.py

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

* Update plugins/modules/proxmox_vm_info.py

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

---------

Co-authored-by: Jan Wenzel <jan.wenzel@gonicus.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2574cb0)

Co-authored-by: Jan Wenzel <jan@coffeelover.de>
@coffeelover coffeelover deleted the feat-proxmox-vm-info branch June 14, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-9 Automatically create a backport for the stable-9 branch feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants