Merge ~r00ta/maas:lp-2026824 into maas:master

Proposed by Jacopo Rota
Status: Merged
Approved by: Jacopo Rota
Approved revision: 8274953f5a1c6992a8b152a7c91d6422c1442abc
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~r00ta/maas:lp-2026824
Merge into: maas:master
Diff against target: 35 lines (+3/-3)
3 files modified
src/provisioningserver/boot/ipxe.py (+1/-1)
src/provisioningserver/templates/ipxe/config.ephemeral.template (+1/-1)
src/provisioningserver/templates/ipxe/config.install.template (+1/-1)
Reviewer Review Type Date Requested Status
Anton Troyanov Approve
MAAS Lander Approve
Review via email: mp+446601@code.launchpad.net

Commit message

ipxe uses mac address from dhcp packet instead of the mac of the first interface of the machine

Description of the change

as per bug description https://bugs.launchpad.net/maas/+bug/2026824 if the machine does not pxe boot (non-UEFI) from the first interface the enlistment fails.

The MP aims to fix this bug by communicating the correct mac address of the interface used by DHCP so that the cmdline contains the right information for the cloud-init that will configure only that particular network interface.

See the discussion with ipxe community https://github.com/ipxe/ipxe/discussions/995.

`mac` contains the mac address of the latest used NIC - same for `next-server` that we already use.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp-2026824 lp:~r00ta/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 8274953f5a1c6992a8b152a7c91d6422c1442abc

review: Approve
Revision history for this message
Anton Troyanov (troyanov) wrote :

Nice fix!

Is there a difference between {netX/mac} suggested on GH and {mac} that you've discovered?

Revision history for this message
Jacopo Rota (r00ta) wrote :

> Nice fix!
>
> Is there a difference between {netX/mac} suggested on GH and {mac} that you've
> discovered?

afaiu there are no differences between {netX/mac} and {mac} until we are sure that {netX/mac} is the latest used NIC (like in our case).

In our case, the only interface being used is the one that uses DHCP to PXE. Until we don't touch any other interface in the script, {netX/mac} and {mac} will be the same.

As an example, if we pxe boot on net1 and in the script we call

# !ipxe

ifstat net0
show mac

then {mac} will be {net0/mac}. But until we don't touch any other nic, we should be good to go

Revision history for this message
Anton Troyanov (troyanov) wrote :

Thanks for the clarification!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/provisioningserver/boot/ipxe.py b/src/provisioningserver/boot/ipxe.py
2index d3da134..881ae80 100644
3--- a/src/provisioningserver/boot/ipxe.py
4+++ b/src/provisioningserver/boot/ipxe.py
5@@ -19,7 +19,7 @@ CONFIG_FILE = dedent(
6 # MAAS iPXE pre-loader configuration file
7
8 # Load based on MAC address first.
9- chain http://${next-server}:5248/ipxe.cfg-${net0/mac} ||
10+ chain http://${next-server}:5248/ipxe.cfg-${mac} ||
11
12 # Failed to load based on MAC address.
13 chain http://${next-server}:5248/ipxe.cfg-default-amd64
14diff --git a/src/provisioningserver/templates/ipxe/config.ephemeral.template b/src/provisioningserver/templates/ipxe/config.ephemeral.template
15index 348436e..0b7d799 100644
16--- a/src/provisioningserver/templates/ipxe/config.ephemeral.template
17+++ b/src/provisioningserver/templates/ipxe/config.ephemeral.template
18@@ -1,5 +1,5 @@
19 #!ipxe
20 kernel {{kernel_params | fs_host}}{{kernel_params | kernel_path}}
21-imgargs {{kernel_params | kernel_name}} {{kernel_params | kernel_command}} maas_url={{kernel_params.preseed_url }} BOOTIF=01-${net0/mac}
22+imgargs {{kernel_params | kernel_name}} {{kernel_params | kernel_command}} maas_url={{kernel_params.preseed_url }} BOOTIF=01-${mac}
23 initrd {{kernel_params | fs_host}}{{kernel_params | initrd_path}}
24 boot
25diff --git a/src/provisioningserver/templates/ipxe/config.install.template b/src/provisioningserver/templates/ipxe/config.install.template
26index 6f47c73..e65f961 100644
27--- a/src/provisioningserver/templates/ipxe/config.install.template
28+++ b/src/provisioningserver/templates/ipxe/config.install.template
29@@ -1,5 +1,5 @@
30 #!ipxe
31 kernel {{kernel_params | fs_host}}{{kernel_params | kernel_path}}
32-imgargs {{kernel_params | kernel_name}} {{kernel_params | kernel_command}} BOOTIF=01-${net0/mac}
33+imgargs {{kernel_params | kernel_name}} {{kernel_params | kernel_command}} BOOTIF=01-${mac}
34 initrd {{kernel_params | fs_host}}{{kernel_params | initrd_path}}
35 boot

Subscribers

People subscribed via source and target branches