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

[Xen-devel] [OSSTEST PATCH v2 16/19] Set mac address in interfaces(5) if force-mac-address is set



ff9e0d8cbd generated a udev rule for setting the mac address. But that
udev rule is not copied into the target so reboot after installation
will fail.

We can copy the udev rule to target system so the reboot after
installation works, but then the generated udev rules will end up in
initramfs, which means the guest (which uses host's initrd)  will use
the same rune to set conflicting mac address.

Put the mac address in interfaces(5). We still need to keep the udev
rule for the initrd overlay otherwise host installation will fail.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 Osstest/Debian.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 2bfd5ae..2c3bcf4 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1207,6 +1207,16 @@ END
        preseed_hook_command($ho, 'late_command', $sfx, $cmds);
     }
 
+    my $wantphysif= get_host_property($ho,'interface force','auto');
+    if ($wantphysif ne 'auto' && $ho->{Flags}{'force-mac-address'}) {
+       preseed_hook_command($ho, 'late_command', $sfx, <<END);
+#!/bin/sh
+set -ex
+
+sed -i 's/\\(iface\\s*$wantphysif\\s*inet.*\\)/\\1\\n    hwaddress 
$ho->{Ether}/' /target/etc/network/interfaces
+END
+    }
+
     if ( $ho->{Flags}{'need-uboot-bootscr'} ) {
        my @bootargs = uboot_common_kernel_bootargs($ho);
 
-- 
2.11.0


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

 


Rackspace

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