WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 2 of 4] Only explictly create internal bridges (those w

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 2 of 4] Only explictly create internal bridges (those with no local PIFs)
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 15 Dec 2009 12:33:07 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 15 Dec 2009 04:33:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1260880385@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
from Xapi_network.attach_internal.

external bridges are brought up and configured by calling
interface-reconfigure.

Has no impact when using Linux bridging but when vswitch is enabled it
prevents the creation of spurious bridges when attaching a VLAN
network (since there is not supposed to be a separate bridge in that case).

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r a177a071a241 -r 475dd68da5f8 ocaml/xapi/xapi_network.ml
--- a/ocaml/xapi/xapi_network.ml        Tue Dec 15 12:30:48 2009 +0000
+++ b/ocaml/xapi/xapi_network.ml        Tue Dec 15 12:30:48 2009 +0000
@@ -24,16 +24,21 @@
 let get_allowed_messages ~__context ~self = []
 *)
 
+let create_internal_bridge ~bridge =
+  let current = Netdev.Bridge.list () in
+  if not(List.mem bridge current) then Netdev.Bridge.add bridge;
+  if not(Netdev.Link.is_up bridge) then Netdev.Link.up bridge
+
 let attach_internal ?(management_interface=false) ~__context ~self () =
   let host = Helpers.get_localhost () in
   let shafted_pifs, local_pifs = 
     Xapi_network_attach_helpers.assert_can_attach_network_on_host ~__context 
~self ~host ~overide_management_if_check:management_interface in
 
-  (* Ensure bridge exists and is up *)
   let bridge = Db.Network.get_bridge ~__context ~self in
-  let current = Netdev.Bridge.list () in
-  if not(List.mem bridge current) then Netdev.Bridge.add bridge;
-  if not(Netdev.Link.is_up bridge) then Netdev.Link.up bridge;
+
+  (* Ensure internal bridge exists and is up. external bridges will be
+     brought up by call to interface-reconfigure. *)
+  if List.length(local_pifs) = 0 then create_internal_bridge ~bridge;
 
   (* Check if we're a guest-installer network: *)
   let other_config = Db.Network.get_other_config ~__context ~self in

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api