Skip to content

Add support for external DNS/Static IPs, as well as bridged adapters other than virbr0 #97

@ocient-cliimatta

Description

@ocient-cliimatta

Many networks have external IPAM and/or DHCP servers to hand out IP addresses for VMs.

It would be great if a non-libvirt managed DHCP server could be used with Nomad's Virt driver.

Ideally, Nomad could use the builtin capability for qemu-agent to execute and return information from the guest's network adapters.

This method would enable almost universal support for different network configurations, like static IPs retrieved from an IPAM solution like Netbox/Infoblox, and enable bridged adapters other than the libvirt managed virbr0.

It would require qemu-guest-agent package to be installed inside the guest VM.

Example:
virsh qemu-agent-command virt-task-4930bb25 '{"execute":"guest-network-get-interfaces"}' | jq .

This returns JSON which could be parsed by Nomad:

{
  "return": [
    {
      "name": "lo",
      "ip-addresses": [
        {
          "ip-address-type": "ipv4",
          "ip-address": "127.0.0.1",
          "prefix": 8
        },
        {
          "ip-address-type": "ipv6",
          "ip-address": "::1",
          "prefix": 128
        }
      ],
      "statistics": {
        "tx-packets": 1875360,
        "tx-errs": 0,
        "rx-bytes": 133160856,
        "rx-dropped": 0,
        "rx-packets": 1875360,
        "rx-errs": 0,
        "tx-bytes": 133160856,
        "tx-dropped": 0
      },
      "hardware-address": "00:00:00:00:00:00"
    },
    {
      "name": "enp0s5",
      "ip-addresses": [
        {
          "ip-address-type": "ipv4",
          "ip-address": "10.14.30.29",
          "prefix": 24
        },
        {
          "ip-address-type": "ipv6",
          "ip-address": "redacted",
          "prefix": 64
        }
      ],
      "statistics": {
        "tx-packets": 958693,
        "tx-errs": 0,
        "rx-bytes": 439869753,
        "rx-dropped": 176893,
        "rx-packets": 1563633,
        "rx-errs": 0,
        "tx-bytes": 80836052,
        "tx-dropped": 0
      },
      "hardware-address": "redacted"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions