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

[Xen-devel] [OSSTEST PATCH 1/4] ts-xen-install: networking: Do nothing if there's already a bridge



The main effect is that old Xend tests will no longer replace the
bridge network interface.  If it was using dhcp then it will keep
using dhcp, rather than being switched to have the dhcp-obtained
address hardwired in a static configuration.

A side effect is that after this, `nodhcp' will do nothing if it has
already been run, rather than replacing the effects of a previous run.
This case is only relevant for ad-hoc by-hand invocations, where
changes to the script may not be reflected when it is rerun.

Most invocations remain unaffected.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 ts-xen-install |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ts-xen-install b/ts-xen-install
index b511e2b..433a6d3 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -255,7 +255,6 @@ 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 ||
@@ -266,20 +265,18 @@ sub nodhcp () {
                }
                if (
                        (
-                        (m{^ \s* iface \s+ (xenbr\w*) \s+ inet \s+ }x
-                             ? ((push @bridges, $1), 1) : 0)
+                        m{^ \s* iface \s+ (xenbr\w*) \s+ inet \s+ }x
                         ...
                         !m{^ [ \t] }x
                        )
                    &&
                        m{^ \s+ bridge_ports \s+ (\S+) \s }x
                    ) {
-                   push @{ $candidates{$1} }, "$bridges[$#bridges] $_";
+                   targt_editfile_cancel("already have a bridge");
                }
            }
            EI->error and die $!;
            delete $candidates{'lo'};
-           delete $candidates{$_} foreach @bridges;
            die Dumper(\%candidates, \@bridges).
                " -- cannot determine default interface"
                unless (scalar keys %candidates) == 1;
-- 
1.7.10.4


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


 


Rackspace

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