On 3/27/25 16:17, Christoph Heiss wrote:
Fixes #5811 [0].

Adds a new option to the answer file for specifying to use the
DHCP-provided hostname and domain. For the domain, an additional
fallback/default can be specified, in case the DHCP server only provides
hostnames. The hostname is always required in this mode.

The addition to the answer file format is done in a backwards-compatible
way.

Users can now specify the following to use the DHCP-provided domain:

```
[global]
fqdn.source = "from-dhcp"
```

or additionally with a custom domain:

```
[global.fqdn]
source = "from-dhcp"
domain = "custom.domain.local"
```

Patches #1 through #4 can all be applied independently, #1 & #4 are pure
cleanups.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=5811

Diffstat
========

Christoph Heiss (6):
   auto: utils: avoid a force unwrap()
   auto: tests: parse-answer: allow per-test runtime env
   auto: tests: allow testing for serde parse errors of answer files
   tui, common: move network option tests to correct crate
   common: options: allow user-supplied domain for network options
   fix #5811: auto: add option to retrieve FQDN from DHCP configuration

Tested this patch series with setting up a DHCP server through dnsmasq, where I set up the dnsmasq with `dhcp-fqdn` and `domain=something.com` for the domain part, and `dhcp-host=<MAC>,<IPaddr>,<HOSTNAME>`.

I tested `global.fqdn.source = 'from-dhcp'` with both `global.fqdn.domain` set and unset for:

- not setting hostnames nor domain at all -> correctly errors for both,
- setting a hostname but no domain -> correctly errors for unset domain, works as expected with fallback domain,
- setting no hostname but a domain -> correctly errors for both,
- setting both a hostname and a domain -> works as expected.

Also tested that for the working cases these are set as the fqdn after installation, and also tested that setting `fqdn = "some.local.domain"` also still works as expected as before.

Works great!

Just wanted to ask: Would it make sense to also have a fallback for the hostname if the DHCP server does only provide a domain but no hostname here or should the DHCP provide the full FQDN?

Else, consider this series as:

Tested-by: Daniel Kral <d.k...@proxmox.com>


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to