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

[PR #8471/2574cb0d backport][stable-9] feat: proxmox_vm_info - add network information for guests #8505

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Jun 14, 2024

This is a backport of PR #8471 as merged into main (2574cb0).

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"
                    }
                ],
[...]

* 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)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport 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 14, 2024
@felixfontein felixfontein merged commit fe3a3a7 into stable-9 Jun 14, 2024
133 checks passed
@felixfontein felixfontein deleted the patchback/backports/stable-9/2574cb0dea23008be2cc158310523b00e72354d4/pr-8471 branch June 14, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 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