xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <paul@xen.org>
To: xen-devel@lists.xenproject.org
Cc: Paul Durrant <pdurrant@amazon.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: [PATCH v2 2/4] tools/hotplug: combine add/online and remove/offline in vif-bridge...
Date: Mon,  3 Aug 2020 13:49:29 +0100	[thread overview]
Message-ID: <20200803124931.2678-3-paul@xen.org> (raw)
In-Reply-To: <20200803124931.2678-1-paul@xen.org>

From: Paul Durrant <pdurrant@amazon.com>

... as they are in vif-route.

The script is invoked with online/offline for vifs and add/remove for taps.
The operations that are necessary, however, are the same in both cases. This
patch therefore combines the cases.

The open-coded bridge removal code is also replaced with call to
remove_from_bridge().

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>
---
 tools/hotplug/Linux/vif-bridge | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge
index e722090ca8..e1d7c49788 100644
--- a/tools/hotplug/Linux/vif-bridge
+++ b/tools/hotplug/Linux/vif-bridge
@@ -77,25 +77,17 @@ then
 fi
 
 case "$command" in
+    add)
+        ;&
     online)
         setup_virtual_bridge_port "$dev"
         set_mtu "$bridge" "$dev"
         add_to_bridge "$bridge" "$dev"
         ;;
-
+    remove)
+        ;&
     offline)
-        if which brctl >&/dev/null; then
-            do_without_error brctl delif "$bridge" "$dev"
-        else
-            do_without_error ip link set "$dev" nomaster
-        fi
-        do_without_error ifconfig "$dev" down
-        ;;
-
-    add)
-        setup_virtual_bridge_port "$dev"
-        set_mtu "$bridge" "$dev"
-        add_to_bridge "$bridge" "$dev"
+        remove_from_bridge "$bridge" "$dev"
         ;;
 esac
 
-- 
2.20.1



  parent reply	other threads:[~2020-08-03 12:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 12:49 [PATCH v2 0/4] tools: propagate bridge MTU to vif frontends Paul Durrant
2020-08-03 12:49 ` [PATCH v2 1/4] tools/hotplug: add remove_from_bridge() and improve debug output Paul Durrant
2020-08-04 11:06   ` Ian Jackson
2020-08-03 12:49 ` Paul Durrant [this message]
2020-08-04 11:08   ` [PATCH v2 2/4] tools/hotplug: combine add/online and remove/offline in vif-bridge Ian Jackson
2020-08-03 12:49 ` [PATCH v2 3/4] public/io/netif: specify MTU override node Paul Durrant
2020-08-04 11:10   ` Ian Jackson
2020-08-03 12:49 ` [PATCH v2 4/4] tools/hotplug: modify set_mtu() to inform the frontend via xenstore Paul Durrant
2020-08-04 11:13   ` Ian Jackson
2020-08-04 11:20     ` Paul Durrant
2020-08-04 11:35       ` Ian Jackson
2020-08-04 13:31         ` Paul Durrant
2020-08-05  9:30           ` Ian Jackson
2020-08-05  9:44             ` Durrant, Paul
2020-08-05 10:13               ` Ian Jackson
2020-08-05 10:42                 ` Durrant, Paul

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=20200803124931.2678-3-paul@xen.org \
    --to=paul@xen.org \
    --cc=ian.jackson@eu.citrix.com \
    --cc=pdurrant@amazon.com \
    --cc=wl@xen.org \
    --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).