xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Robert Ho <robert.hu@intel.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 3/4] ts-xen-install: networking: Never rewrite the interface config
Date: Thu, 10 Sep 2015 18:17:30 +0100	[thread overview]
Message-ID: <1441905451-32518-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1441905451-32518-1-git-send-email-ian.jackson@eu.citrix.com>

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 <Ian.Jackson@eu.citrix.com>
---
 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 (<EI>) {
-            $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 <<END;
-iface $iface inet static
-    address $ho->{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

  parent reply	other threads:[~2015-09-10 17:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05  6:22 OSSTEST -- nested test case development, RFC: ts-guest-destroy doesn't call guest_await_dhcp_tcp() if guest has fixed IP Hu, Robert
2015-08-05  6:43 ` Hu, Robert
2015-08-05 12:26 ` Ian Campbell
2015-08-06  1:57   ` Hu, Robert
2015-08-06  9:00     ` Ian Campbell
2015-08-06 10:33       ` Hu, Robert
2015-08-11 12:54       ` Ian Jackson
2015-08-12  5:15         ` Hu, Robert
2015-08-12 15:27           ` Ian Jackson
2015-08-13  3:46             ` Hu, Robert
2015-08-14  2:41               ` Hu, Robert
2015-09-10 16:38               ` Ian Jackson
2015-09-10 17:17                 ` [OSSTest Nested v12 18/21] After Xen install, configure its xenbr0 interface as dhcp Ian Jackson
2015-09-10 17:17                   ` [OSSTEST PATCH 1/4] ts-xen-install: networking: Do nothing if there's already a bridge Ian Jackson
2015-09-10 17:17                   ` [OSSTEST PATCH 2/4] ts-xen-install: networking: Bail if we expected a bridge but there wasn't one Ian Jackson
2015-09-10 17:17                   ` Ian Jackson [this message]
2015-09-25 18:34                     ` [OSSTEST PATCH 3/4] ts-xen-install: networking: Never rewrite the interface config Ian Jackson
2015-09-10 17:17                   ` [OSSTEST PATCH 4/4] ts-xen-install: networking: Rename `nodhcp' to `ensurebridge' Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441905451-32518-4-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=robert.hu@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).