Let Pimox generate worker NIC MACs by default
This commit is contained in:
parent
ed0983d09a
commit
0cda6573ad
|
|
@ -734,6 +734,9 @@ qemu-guest-agent. Static mode uses
|
||||||
`LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`,
|
`LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`,
|
||||||
`LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, and
|
`LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, and
|
||||||
`LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`.
|
`LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`.
|
||||||
|
Worker NIC MAC addresses are also auto-generated by Pimox by default. Set
|
||||||
|
`LAB_PIMOX_WORKER_MAC_MODE=deterministic` only when you explicitly need stable
|
||||||
|
MAC addresses derived from VM IDs.
|
||||||
Worker creation fails faster than template creation: static guest-network
|
Worker creation fails faster than template creation: static guest-network
|
||||||
configuration waits up to `LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=120`,
|
configuration waits up to `LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=120`,
|
||||||
worker IP/SSH readiness waits up to `LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`,
|
worker IP/SSH readiness waits up to `LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`,
|
||||||
|
|
|
||||||
|
|
@ -734,6 +734,9 @@ qemu-guest-agent. Static mode uses
|
||||||
`LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`,
|
`LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`,
|
||||||
`LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, and
|
`LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, and
|
||||||
`LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`.
|
`LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`.
|
||||||
|
Worker NIC MAC addresses are also auto-generated by Pimox by default. Set
|
||||||
|
`LAB_PIMOX_WORKER_MAC_MODE=deterministic` only when you explicitly need stable
|
||||||
|
MAC addresses derived from VM IDs.
|
||||||
Worker creation fails faster than template creation: static guest-network
|
Worker creation fails faster than template creation: static guest-network
|
||||||
configuration waits up to `LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=120`,
|
configuration waits up to `LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=120`,
|
||||||
worker IP/SSH readiness waits up to `LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`,
|
worker IP/SSH readiness waits up to `LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`,
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,9 @@ reservations are not available: set `LAB_PIMOX_WORKER_NETWORK_MODE=static`,
|
||||||
`LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`,
|
`LAB_PIMOX_WORKER_STATIC_IPS="192.168.100.66 192.168.100.67 192.168.100.76"`,
|
||||||
`LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, `LAB_PIMOX_WORKER_INTERFACE=enp0s18`,
|
`LAB_PIMOX_WORKER_GATEWAY=192.168.100.1`, `LAB_PIMOX_WORKER_INTERFACE=enp0s18`,
|
||||||
and `LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`.
|
and `LAB_PIMOX_WORKER_DNS_SERVERS="192.168.100.89 1.1.1.1"`.
|
||||||
|
Worker NIC MAC addresses are auto-generated by Pimox by default. Set
|
||||||
|
`LAB_PIMOX_WORKER_MAC_MODE=deterministic` only when VMID-derived MAC addresses
|
||||||
|
are required.
|
||||||
Worker clone failures are intentionally faster than template build failures:
|
Worker clone failures are intentionally faster than template build failures:
|
||||||
`LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=120`,
|
`LAB_PIMOX_GUEST_AGENT_CONFIG_TIMEOUT_SECONDS=120`,
|
||||||
`LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`, and
|
`LAB_PIMOX_WORKER_WAIT_TIMEOUT_SECONDS=600`, and
|
||||||
|
|
|
||||||
|
|
@ -547,6 +547,10 @@ state.
|
||||||
: Worker guest networking mode. Defaults to `dhcp`. Set to `static` only when
|
: Worker guest networking mode. Defaults to `dhcp`. Set to `static` only when
|
||||||
Jeannie should configure guest static IPs through qemu-guest-agent.
|
Jeannie should configure guest static IPs through qemu-guest-agent.
|
||||||
|
|
||||||
|
`LAB_PIMOX_WORKER_MAC_MODE`
|
||||||
|
: Worker NIC MAC mode. Defaults to `auto`, letting Pimox generate the MAC. Set
|
||||||
|
to `deterministic` to derive MAC addresses from VM IDs.
|
||||||
|
|
||||||
`LAB_PIMOX_WORKER_REQUIRE_LAN_PROBE`
|
`LAB_PIMOX_WORKER_REQUIRE_LAN_PROBE`
|
||||||
: Require the worker guest to ping the LAN gateway and probe host after static
|
: Require the worker guest to ping the LAN gateway and probe host after static
|
||||||
IP assignment. Defaults to `true`.
|
IP assignment. Defaults to `true`.
|
||||||
|
|
|
||||||
29
jeannie
29
jeannie
|
|
@ -1212,6 +1212,27 @@ pimox_worker_static_ip() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pimox_worker_net0_config() {
|
||||||
|
local vmid="$1"
|
||||||
|
local bridge="$2"
|
||||||
|
local mac_mode="${LAB_PIMOX_WORKER_MAC_MODE:-auto}"
|
||||||
|
local mac
|
||||||
|
|
||||||
|
case "${mac_mode}" in
|
||||||
|
auto)
|
||||||
|
printf 'virtio,bridge=%s\n' "${bridge}"
|
||||||
|
;;
|
||||||
|
deterministic)
|
||||||
|
mac="$(pimox_generated_mac "${vmid}")"
|
||||||
|
printf 'virtio=%s,bridge=%s\n' "${mac}" "${bridge}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "LAB_PIMOX_WORKER_MAC_MODE must be 'auto' or 'deterministic'." >&2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
validate_ipv4_cidr_or_host() {
|
validate_ipv4_cidr_or_host() {
|
||||||
local value="$1"
|
local value="$1"
|
||||||
|
|
||||||
|
|
@ -1434,7 +1455,7 @@ ensure_pimox_worker_node() {
|
||||||
local worker_key
|
local worker_key
|
||||||
local worker_name
|
local worker_name
|
||||||
local node_name
|
local node_name
|
||||||
local mac
|
local net0_config
|
||||||
local guest_ip
|
local guest_ip
|
||||||
local static_ip
|
local static_ip
|
||||||
|
|
||||||
|
|
@ -1443,7 +1464,9 @@ ensure_pimox_worker_node() {
|
||||||
worker_key="${worker_key_prefix}${padded}"
|
worker_key="${worker_key_prefix}${padded}"
|
||||||
worker_name="${worker_name_prefix}-${padded}"
|
worker_name="${worker_name_prefix}-${padded}"
|
||||||
node_name="${worker_node_prefix}-${padded}"
|
node_name="${worker_node_prefix}-${padded}"
|
||||||
mac="$(pimox_generated_mac "${vmid}")"
|
if ! net0_config="$(pimox_worker_net0_config "${vmid}" "${bridge}")"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' status '${vmid}' >/dev/null 2>&1"; then
|
if pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' status '${vmid}' >/dev/null 2>&1"; then
|
||||||
if pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' config '${vmid}' | grep -q '^template: 1$'"; then
|
if pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' config '${vmid}' | grep -q '^template: 1$'"; then
|
||||||
|
|
@ -1522,7 +1545,7 @@ if [ -n '${worker_cpu_affinity}' ]; then
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
sudo '${qm_bin}' set '${vmid}' --net0 'virtio=${mac},bridge=${bridge}'
|
sudo '${qm_bin}' set '${vmid}' --net0 '${net0_config}'
|
||||||
sudo '${qm_bin}' set '${vmid}' --boot 'order=scsi0;net0'
|
sudo '${qm_bin}' set '${vmid}' --boot 'order=scsi0;net0'
|
||||||
sudo '${qm_bin}' set '${vmid}' --onboot 1
|
sudo '${qm_bin}' set '${vmid}' --onboot 1
|
||||||
sudo '${qm_bin}' start '${vmid}'"
|
sudo '${qm_bin}' start '${vmid}'"
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,14 @@ test_pimox_guest_exec_exitcode_parser() {
|
||||||
assert_command_failure_contains "pimox guest exec rejects invalid JSON" "" pimox_guest_exec_exitcode 'not json'
|
assert_command_failure_contains "pimox guest exec rejects invalid JSON" "" pimox_guest_exec_exitcode 'not json'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_pimox_worker_net0_config_defaults_to_auto_mac() {
|
||||||
|
unset LAB_PIMOX_WORKER_MAC_MODE
|
||||||
|
assert_eq "pimox worker net0 defaults to auto MAC" "virtio,bridge=vmbr0" "$(pimox_worker_net0_config 9010 vmbr0)"
|
||||||
|
LAB_PIMOX_WORKER_MAC_MODE=deterministic
|
||||||
|
assert_eq "pimox worker net0 deterministic MAC opt-in" "virtio=02:68:10:00:23:32,bridge=vmbr0" "$(pimox_worker_net0_config 9010 vmbr0)"
|
||||||
|
unset LAB_PIMOX_WORKER_MAC_MODE
|
||||||
|
}
|
||||||
|
|
||||||
test_pimox_worker_count_detects_generated_topology
|
test_pimox_worker_count_detects_generated_topology
|
||||||
test_configured_worker_count_cannot_hide_existing_workers
|
test_configured_worker_count_cannot_hide_existing_workers
|
||||||
test_configured_worker_count_can_expand_target_set
|
test_configured_worker_count_can_expand_target_set
|
||||||
|
|
@ -350,6 +358,7 @@ test_inventory_validator_rejects_ip_drift
|
||||||
test_heal_cooldown_escalates_to_diagnostics
|
test_heal_cooldown_escalates_to_diagnostics
|
||||||
test_pimox_worker_static_ip_selection
|
test_pimox_worker_static_ip_selection
|
||||||
test_pimox_guest_exec_exitcode_parser
|
test_pimox_guest_exec_exitcode_parser
|
||||||
|
test_pimox_worker_net0_config_defaults_to_auto_mac
|
||||||
|
|
||||||
if ((FAILURES > 0)); then
|
if ((FAILURES > 0)); then
|
||||||
printf '\n%s unit test(s) failed.\n' "${FAILURES}" >&2
|
printf '\n%s unit test(s) failed.\n' "${FAILURES}" >&2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue