From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH OSSTEST v2 08/20] ts-host-install: Add force-mac-address host flag Date: Wed, 29 Oct 2014 10:41:30 +0000 Message-ID: <1414579302-6692-8-git-send-email-ian.campbell@citrix.com> References: <1414579268.29975.13.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1414579268.29975.13.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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. This is only useful on systems which have exactly one Ethernet device, otherwise there is no reliable way to determine which device is which. Signed-off-by: Ian Campbell Acked-by: Ian Jackson --- v2; Added final para to commit log. --- ts-host-install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts-host-install b/ts-host-install index 2f72b5f..b954e53 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", - <{Flags}{'force-mac-address'} ? <{Ether}", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="$wantphysif" END } -- 2.1.1