[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC OSSTEST 09/19] ts-host-install: Add force-mac-address host flag



This causes us to emit udev runes which force the device named in the host's
Interface_Force property to have the MAC address given in the host's Ether
property. This is the reverse of the behaviour of the Interface_Force property
without this flag, which is to rename the device with MAC address Ether to have
the requested name.

This is necessary because the arndale's USB Ethernet device has no burned in
MAC address and there is no mechanism to configure this e.g. via the bootloader
in a way which Linux will then notice.

Without this change Linux will pick a random mac address when loading the
driver, which breaks osstest's attempts to observe when the test host has
picked up its preseed file by watching the webserver logs, since DHCP will not
map a random mac address to the IP we are expecting.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 ts-host-install | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ts-host-install b/ts-host-install
index 7c8d693..e874b98 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -181,6 +181,7 @@ sub setup_pxeboot_firstboot($) {
 
     my $ipappend = 2;
     my $wantphysif= get_host_property($ho,'interface force','auto');
+    logm("Forcing interface $wantphysif");
     if ($wantphysif ne 'auto') {
        $ipappend = 0;
        die "need Ether for $ho->{Name} ($wantphysif)"
@@ -188,7 +189,9 @@ sub setup_pxeboot_firstboot($) {
         system_checked(qw(mkdir -p --), "$initrd_overlay.d/etc/udev/rules.d");
         file_simple_write_contents
             ("$initrd_overlay.d/etc/udev/rules.d/70-persistent-net.rules",
-             <<END);
+             $ho->{Flags}{'force-mac-address'} ? <<END : <<END);
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="$wantphysif", RUN += 
"/bin/ip link set $wantphysif address $ho->{Ether}"
+END
 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$ho->{Ether}", 
ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="$wantphysif"
 END
     }
-- 
2.1.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.