[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 3/3] ts-xen-install: nodhcp: Make idempotent
If run more than once, this function would erroneously determine that xenbr0 was the primary physical interface name and try to enroll it into the bridge (also named xenbr0). Instead, spot the "bridge_ports" line and use it to extract the physical interface name. Eliminate from consideration any interfaces matching xenbr\d+. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- ts-xen-install | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ts-xen-install b/ts-xen-install index c59fdd3..4215ed3 100755 --- a/ts-xen-install +++ b/ts-xen-install @@ -217,6 +217,7 @@ sub nodhcp () { if (!defined $physif) { # preread /etc/network/interfaces to figure out the interface my %candidates; + my @bridges; while (<EI>) { if ( m{^ \s* ( auto \s+ (\S+) ) \s* $}x || @@ -225,10 +226,24 @@ sub nodhcp () { ) { push @{ $candidates{$2} }, $1; } + if ( + ( + (m{^ \s* iface \s+ (xenbr\w*) \s+ inet \s+ }x + ? ((push @bridges, $1), 1) : 0) + ... + !m{^ [ \t] }x + ) + && + m{^ \s+ bridge_ports \s+ (\S+) \s }x + ) { + push @{ $candidates{$1} }, "$bridges[$#bridges] $_"; + } } EI->error and die $!; delete $candidates{'lo'}; - die Dumper(\%candidates)." -- cannot determine default interface" + delete $candidates{$_} foreach @bridges; + die Dumper(\%candidates, \@bridges). + " -- cannot determine default interface" unless (scalar keys %candidates) == 1; ($physif,) = keys %candidates; seek EI,0,0 or die $!; -- 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 |