[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 1 of 2] vswitch: pass network uuid to vswitch when creating an internal network
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1278596113 -3600 # Node ID 75e2b541f6709d5bb8472782cbefad324c7ec459 # Parent d28575be8a5deec1b73ea7120a98e37be6373fa9 vswitch: pass network uuid to vswitch when creating an internal network For external networks this is taken care of by interface-reconfigure but in the internal network case there is currently no callout so simply pass the network uuid when creating calling out to create the bridge. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r d28575be8a5d -r 75e2b541f670 ocaml/netdev/netdev.ml --- a/ocaml/netdev/netdev.ml Thu Jul 08 14:33:34 2010 +0100 +++ b/ocaml/netdev/netdev.ml Thu Jul 08 14:35:13 2010 +0100 @@ -18,7 +18,7 @@ type network_ops = { kind: kind; - add: string -> unit; + add: string -> ?uuid:string -> unit; del: string -> unit; list: unit -> string list; @@ -99,7 +99,7 @@ external _add : Unix.file_descr -> string -> unit = "stub_bridge_add" external _del : Unix.file_descr -> string -> unit = "stub_bridge_del" -let add name = +let add name ?uuid = Internal.with_fd (fun fd -> _add fd name) let del name = @@ -224,7 +224,11 @@ | "" -> [] | s -> Stringext.String.split '\n' s -let add name = ignore(vsctl ["add-br" ; name]) +let add name ?uuid = + let extra = match uuid with + | Some uuid' -> ["--"; "br-set-external-id"; name; "network-uuids"; uuid'] + | None -> ["--"; "foo"] in + ignore(vsctl (["add-br" ; name] @ extra)) let del name = ignore(vsctl ["del-br" ; name]) let list () = vsctl [ "list-br" ] diff -r d28575be8a5d -r 75e2b541f670 ocaml/netdev/netdev.mli --- a/ocaml/netdev/netdev.mli Thu Jul 08 14:33:34 2010 +0100 +++ b/ocaml/netdev/netdev.mli Thu Jul 08 14:35:13 2010 +0100 @@ -21,7 +21,7 @@ (** Possible operations on each network backend type. *) type network_ops = { kind : kind; (** The type of network backend. *) - add : string -> unit; (** Add a bridge. *) + add : string -> ?uuid:string -> unit; (** Add a bridge. *) del : string -> unit; (** Remove a bridge. *) list : unit -> string list; (** List all bridges. *) exists : string -> bool; (** Query the existance of a bridge. *) diff -r d28575be8a5d -r 75e2b541f670 ocaml/xapi/xapi_network.ml --- a/ocaml/xapi/xapi_network.ml Thu Jul 08 14:33:34 2010 +0100 +++ b/ocaml/xapi/xapi_network.ml Thu Jul 08 14:35:13 2010 +0100 @@ -24,10 +24,10 @@ let get_allowed_messages ~__context ~self = [] *) -let create_internal_bridge ~bridge = - debug "Creating internal bridge %s" bridge; +let create_internal_bridge ~bridge ~uuid = + debug "Creating internal bridge %s (uuid:%s)" bridge uuid; let current = Netdev.network.Netdev.list () in - if not(List.mem bridge current) then Netdev.network.Netdev.add bridge; + if not(List.mem bridge current) then Netdev.network.Netdev.add bridge ?uuid:(Some uuid); if not(Netdev.Link.is_up bridge) then Netdev.Link.up bridge let attach_internal ?(management_interface=false) ~__context ~self () = @@ -36,10 +36,11 @@ Xapi_network_attach_helpers.assert_can_attach_network_on_host ~__context ~self ~host ~overide_management_if_check:management_interface in let bridge = Db.Network.get_bridge ~__context ~self in + let uuid = Db.Network.get_uuid ~__context ~self in (* 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; + if List.length(local_pifs) = 0 then create_internal_bridge ~bridge ~uuid; (* Check if we're a guest-installer network: *) let other_config = Db.Network.get_other_config ~__context ~self in ocaml/netdev/netdev.ml | 10 +++++++--- ocaml/netdev/netdev.mli | 2 +- ocaml/xapi/xapi_network.ml | 9 +++++---- 3 files changed, 13 insertions(+), 8 deletions(-) Attachment:
vswitch-add-network-uuid-to-internal-networks.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |