|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 05/12] ts-xen-install: default the interface to the one in /etc/network/interfaces
The default was simply eth0. This is the other piece of automatically
coping with the boot interface not being eth0.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
ts-xen-install | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/ts-xen-install b/ts-xen-install
index 09c90ce..a1f5998 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -22,6 +22,7 @@ use File::Path;
use POSIX;
use Osstest::Debian;
use Osstest::TestSupport;
+use Data::Dumper;
my $checkmode= 0;
@@ -210,6 +211,23 @@ sub nodhcp () {
"etc-network-interfaces", sub {
my $physif= get_host_property($ho,'interface force',undef);
+ if (!defined $physif) {
+ # preread /etc/network/interfaces to figure out the interface
+ my %candidates;
+ while (<EI>) {
+ next unless
+ m{^ \s* ( auto \s+ (\S+) ) \s* $}x ||
+ m{^ \s* ( allow-hotplug \s+ (\S+) ) \s* $}x ||
+ m{^ \s* ( iface \s+ (\S+) \s+ inet \s+ ) \s* $}x ;
+ push @{ $candidates{$2} }, $1;
+ }
+ EI->error and die $!;
+ delete $candidates{'lo'};
+ die Dumper(\%candidates)." -- cannot determine default interface"
+ unless (scalar keys %candidates) == 1;
+ ($physif,) = keys %candidates;
+ seek EI,0,0 or die $!;
+ }
my ($iface,$bridgex);
if ($initscripts_nobridge) {
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |