From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 3/4] ts-xen-install: networking: Never rewrite the interface config Date: Thu, 10 Sep 2015 18:17:30 +0100 Message-ID: <1441905451-32518-4-git-send-email-ian.jackson@eu.citrix.com> References: <22001.45551.963251.380388@mariner.uk.xensource.com> <1441905451-32518-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Za5U9-0003tg-2b for xen-devel@lists.xenproject.org; Thu, 10 Sep 2015 17:18:09 +0000 In-Reply-To: <1441905451-32518-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Robert Ho , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Instead, if we need to, simply change the physical interface in the `iface' line to refer to xenbr0, and add the physical interface as a `bridge_ports' along with the other bridge settings. Signed-off-by: Ian Jackson --- ts-xen-install | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/ts-xen-install b/ts-xen-install index b148163..ef26cba 100755 --- a/ts-xen-install +++ b/ts-xen-install @@ -295,36 +295,13 @@ sub nodhcp () { bridge_stp off END - my $routes= target_cmd_output_root($ho, "route -n"); + logm("iface=$iface physif=$iface"); - $routes =~ m/^ [0-9.]+ \s+ 0\.0\.0\.0 \s+ ([0-9.]+) \s+ \S*U\S* \s /mxi - or die "no own local network in route ? $routes "; - my $netmask= $1; - - $routes =~ - m/^ 0\.0\.0\.0 \s+ ([0-9.]+) \s+ 0\.0\.0\.0 \s+ \S*UG\S* \s /mxi - or die "no default gateway ? $routes "; - my $gateway= $1; - - logm("iface $iface mask=$netmask gw=$gateway"); - - my $suppress= 0; while () { - $suppress= 0 unless m/^\s+/; - s/^ \s* allow-hotplug \s+ (?: $physif | xenbr0 ) \s* $ - /auto $iface\n/x; - if (m/^\s* iface \s+ (?: $physif | xenbr0 ) \s+ inet \s /x) { - $suppress= 1; - print EO <{Ip} - netmask $netmask - gateway $gateway -$bridgex -END - } - print EO or die $! - unless $suppress; + if (s/^\s* iface \s+ \Q$physif\E \s+ /iface $iface /x) { + $_ .= $bridgex; + } + print EO or die $!; } }); } -- 1.7.10.4