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: Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 04/12] ts-xen-install: nodhcp: restructure
Date: Tue, 11 Feb 2014 15:25:46 +0000	[thread overview]
Message-ID: <1392132354-7594-5-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1392132354-7594-1-git-send-email-ian.jackson@eu.citrix.com>

Move target_editfile_root to contain all the meat of the function.
This is useful because we're going to possibly want to read the input
interfaces file twice.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 ts-xen-install |   42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/ts-xen-install b/ts-xen-install
index fc96516..09c90ce 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -206,33 +206,37 @@ END
 }
 
 sub nodhcp () {
-    my ($iface,$bridgex);
-    my $physif= get_host_property($ho,'interface force','eth0');
-    if ($initscripts_nobridge) {
-        $iface= 'xenbr0';
-        $bridgex= <<END;
+    target_editfile_root($ho, "/etc/network/interfaces",
+                         "etc-network-interfaces", sub {
+        my $physif= get_host_property($ho,'interface force',undef);
+
+	my ($iface,$bridgex);
+
+	if ($initscripts_nobridge) {
+	    $iface= 'xenbr0';
+	    $bridgex= <<END;
     bridge_ports $physif
     bridge_fd 0
     bridge_stp off
 END
-    } else {
-        $iface= $physif;
-        $bridgex= '';
-    }
+	} else {
+	    $iface= $physif;
+	    $bridgex= '';
+        }
 
-    my $routes= target_cmd_output_root($ho, "route -n");
+	my $routes= target_cmd_output_root($ho, "route -n");
 
-    $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-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;
+	$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");
 
-    logm("iface $iface mask=$netmask gw=$gateway");
-    target_editfile_root($ho, "/etc/network/interfaces",
-                         "etc-network-interfaces", sub {
         my $suppress= 0;
         while (<EI>) {
             $suppress= 0 unless m/^\s+/;
-- 
1.7.10.4

  parent reply	other threads:[~2014-02-11 15:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 15:25 [OSSTEST PATCH 00/12] Wheezy Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 01/12] ts-xen-build-prep: avoid lvextend segfault (Debian #736173) with wheezy Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 02/12] ts-kernel-build: force CONFIG_BLK_DEV_NBD=y Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 03/12] ts-host-install: set `IPAPPEND 2' (if interface isn't forced) Ian Jackson
2014-02-11 15:25 ` Ian Jackson [this message]
2014-02-11 15:25 ` [OSSTEST PATCH 05/12] ts-xen-install: default the interface to the one in /etc/network/interfaces Ian Jackson
2014-04-16 14:51   ` Ian Campbell
2014-04-16 15:02     ` Ian Jackson
2014-04-16 15:05       ` Ian Campbell
2014-04-17 15:13         ` [OSSTEST PATCH 1/3] ts-xen-install: nodhcp: Fix iface regexp Ian Jackson
2014-04-17 15:13           ` [OSSTEST PATCH 2/3] ts-xen-install: nohcp: Invert sense of interfaces loop Ian Jackson
2014-04-17 15:13           ` [OSSTEST PATCH 3/3] ts-xen-install: nodhcp: Make idempotent Ian Jackson
2014-04-22  8:41           ` [OSSTEST PATCH 1/3] ts-xen-install: nodhcp: Fix iface regexp Ian Campbell
2014-02-11 15:25 ` [OSSTEST PATCH 06/12] TestSupport: break out target_run_apt Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 07/12] TestSupport: Suppress prompting by apt Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 08/12] ts-guests-nbd-mirror: purge old packages first Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 09/12] ts-guests-nbd-mirror: add checkaccessible test Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 10/12] ts-guests-nbd-mirror: set "oldstyle=true" Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 11/12] Debian: Switch to wheezy Ian Jackson
2014-02-11 15:25 ` [OSSTEST PATCH 12/12] make-flight: abolish special-casing of suite for armhf 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=1392132354-7594-5-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.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).