]> xenbits.xensource.com Git - osstest.git/commitdiff
ts-host-install: Add force-mac-address host flag flight-31256 flight-31275 flight-31293 flight-31328 flight-31329 flight-31330 flight-31331 flight-31332 flight-31333 flight-31334 flight-31335 flight-31336 flight-31337 flight-31338 flight-31339 flight-31340 flight-31341 flight-31342 flight-31343 flight-31344 flight-31345 flight-31346 flight-31347 flight-31348 flight-31349 flight-31350 flight-31351 flight-31352 flight-31353 flight-31355 flight-31356 flight-31357 flight-31358 flight-31359 flight-31362 flight-31363 flight-31364 flight-31365 flight-31366 flight-31367 flight-31368 flight-31369 flight-31370 flight-31371 flight-31372 flight-31373 flight-31374 flight-31375 flight-31376 flight-31377 flight-31378 flight-31379 flight-31380 flight-31381 flight-31382 flight-31384 flight-31385 flight-31386 flight-31387 flight-31388 flight-31389 flight-31390 flight-31391 flight-31392 flight-31393 flight-31394 flight-31395 flight-31396 flight-31397 flight-31399 flight-31400 flight-31401 flight-31402 flight-31403 flight-31404 flight-31405 flight-31406 flight-31407 flight-31408 flight-31409 flight-31410 flight-31411 flight-31412 flight-31413 flight-31414 flight-31415 flight-31416 flight-31417 flight-31418 flight-31419 flight-31420 flight-31421 flight-31422 flight-31423 flight-31424 flight-31426 flight-31427 flight-31428 flight-31429 flight-31430 flight-31431
authorIan Campbell <ian.campbell@citrix.com>
Wed, 29 Oct 2014 10:41:30 +0000 (10:41 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 29 Oct 2014 16:49:14 +0000 (16:49 +0000)
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 <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
ts-host-install

index 2f72b5faba51db30def5ab01e4cace482922d719..b954e53b39a60f976570aa493d4cb42270a085ee 100755 (executable)
@@ -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
     }