# HG changeset patch # User Rob Hoes Add Network.MTU field A read/write field to set the MTU for everything connected to the network. interface-reconfigure will be changed to use this field. Signed-off-by: Rob Hoes diff -r d2d98f285dd8 ocaml/client_records/records.ml --- a/ocaml/client_records/records.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/client_records/records.ml Mon Feb 01 17:11:06 2010 +0000 @@ -344,6 +344,7 @@ ~get_set:(fun () -> (List.map (fun vif -> get_uuid_from_ref vif) (x ()).API.network_VIFs)) (); make_field ~name:"PIF-uuids" ~get:(fun () -> String.concat "; " (List.map (fun pif -> get_uuid_from_ref pif) (x ()).API.network_PIFs)) ~get_set:(fun () -> (List.map (fun pif -> get_uuid_from_ref pif) (x ()).API.network_PIFs)) (); + make_field ~name:"MTU" ~get:(fun () -> (Int64.to_string (x ()).API.network_MTU)) (); make_field ~name:"bridge" ~get:(fun () -> (x ()).API.network_bridge) (); make_field ~name:"other-config" ~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.network_other_config) ~add_to_map:(fun k v -> Client.Network.add_to_other_config rpc session_id net k v) diff -r d2d98f285dd8 ocaml/idl/datamodel.ml --- a/ocaml/idl/datamodel.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/idl/datamodel.ml Mon Feb 01 17:11:06 2010 +0000 @@ -3609,6 +3609,7 @@ [ {param_type=String; param_name="name_label"; param_doc=""; param_release=first_rel; param_default=None}; {param_type=String; param_name="name_description"; param_doc=""; param_release=first_rel; param_default=None}; + {param_type=Int; param_name="mTU"; param_doc=""; param_release=first_rel; param_default=(Some (VInt 1500L))}; {param_type=Map(String,String); param_name="other_config"; param_doc=""; param_release=first_rel; param_default=None}; {param_type=String; param_name="bridge"; param_doc=""; param_release=first_rel; param_default=None}; ] @@ -3648,6 +3649,7 @@ ] @ (allowed_and_current_operations ~writer_roles:_R_POOL_OP network_operations) @ [ field ~qualifier:DynamicRO ~ty:(Set (Ref _vif)) "VIFs" "list of connected vifs"; field ~qualifier:DynamicRO ~ty:(Set (Ref _pif)) "PIFs" "list of connected pifs"; + field ~qualifier:RW ~ty:Int ~default_value:(Some (VInt 1500L)) ~in_product_since:rel_midnight_ride "MTU" "MTU in octets"; field ~writer_roles:_R_POOL_OP ~ty:(Map(String, String)) "other_config" "additional configuration" ~map_keys_roles:[("folder",(_R_VM_OP));("XenCenter.CustomFields.*",(_R_VM_OP));("XenCenterCreateInProgress",(_R_VM_OP))]; field ~in_oss_since:None ~qualifier:DynamicRO "bridge" "name of the bridge corresponding to this network on the local host"; field ~qualifier:DynamicRO ~in_product_since:rel_orlando ~ty:(Map(String, Ref _blob)) ~default_value:(Some (VMap [])) "blobs" "Binary blobs associated with this network"; diff -r d2d98f285dd8 ocaml/perftest/createpool.ml --- a/ocaml/perftest/createpool.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/perftest/createpool.ml Mon Feb 01 17:11:06 2010 +0000 @@ -50,7 +50,7 @@ let networks_to_create = pool.interfaces_per_host - pool.bonds in debug "Creating %d networks..." networks_to_create; let networks = Array.init networks_to_create (fun i -> - Client.Network.create rpc session_id (Printf.sprintf "perftestnet%d" i) "" [oc_key,pool.key] []) + Client.Network.create ~rpc ~session_id ~name_label:(Printf.sprintf "perftestnet%d" i) ~name_description:"" ~mTU:1500L ~other_config:[oc_key,pool.key] ~tags:[]) in (* Set up the template - create the VIFs *) @@ -379,7 +379,7 @@ let pifs = Client.PIF.get_all poolrpc poolses in let bondednets = Array.init pool.bonds (fun i -> - Client.Network.create poolrpc poolses (Printf.sprintf "Network associated with bond%d" i) "" [] []) + Client.Network.create poolrpc poolses (Printf.sprintf "Network associated with bond%d" i) "" 1500L [] []) in let unused_nets = ref (List.setify (List.map (fun pif -> Client.PIF.get_network poolrpc poolses pif) pifs)) in diff -r d2d98f285dd8 ocaml/xapi/cli_operations.ml --- a/ocaml/xapi/cli_operations.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/cli_operations.ml Mon Feb 01 17:11:06 2010 +0000 @@ -1393,7 +1393,7 @@ let net_create printer rpc session_id params = let network = List.assoc "name-label" params in let descr = if List.mem_assoc "name-description" params then List.assoc "name-description" params else "" in - let net = Client.Network.create rpc session_id network descr [] [] in + let net = Client.Network.create rpc session_id network descr 1500L [] [] in let uuid = Client.Network.get_uuid rpc session_id net in printer (Cli_printer.PList [uuid]) diff -r d2d98f285dd8 ocaml/xapi/cli_operations_geneva.ml --- a/ocaml/xapi/cli_operations_geneva.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/cli_operations_geneva.ml Mon Feb 01 17:11:06 2010 +0000 @@ -423,7 +423,7 @@ let name = List.assoc "vbridge-name" params in let autoadd = List.assoc "auto-vm-add" params in let desc = try List.assoc "vbridge-description" params with _ -> "" in - ignore(Client.Network.create rpc session_id name desc + ignore(Client.Network.create rpc session_id name desc 1500L (if autoadd="true" then [("auto_add_to_VM",autoadd);("geneva-name",name)] else [("geneva-name",name)]) []) let host_vbridge_remove printer rpc session_id params = diff -r d2d98f285dd8 ocaml/xapi/create_networks.ml --- a/ocaml/xapi/create_networks.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/create_networks.ml Mon Feb 01 17:11:06 2010 +0000 @@ -19,7 +19,7 @@ let exists = try ignore(Helpers.get_guest_installer_network ~__context); true with e -> (log_backtrace(); false) in if not exists then ignore(Xapi_network.create ~__context ~name_label:"Guest installer network" - ~name_description:"Network on which guests will get assigned a private local IP address" + ~name_description:"Network on which guests will get assigned a private local IP address" ~mTU:1500L ~other_config:[Xapi_globs.is_guest_installer_network,"true";"ip_begin","192.168.128.1";"ip_end","192.168.128.254";"netmask","255.255.255.0"] ~tags:[]) let create_networks_localhost () = diff -r d2d98f285dd8 ocaml/xapi/debug_populate.ml --- a/ocaml/xapi/debug_populate.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/debug_populate.ml Mon Feb 01 17:11:06 2010 +0000 @@ -34,7 +34,7 @@ else begin let nw_ref = - Xapi_network.create ~__context ~name_label:("Network-"^(string_of_int i)) ~name_description:"dummy" ~other_config:[] ~tags:[] in + Xapi_network.create ~__context ~name_label:("Network-"^(string_of_int i)) ~name_description:"dummy" ~mTU:1500L ~other_config:[] ~tags:[] in nws := nw_ref :: !nws; make_networks __context (i-1) end diff -r d2d98f285dd8 ocaml/xapi/message_forwarding.ml --- a/ocaml/xapi/message_forwarding.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/message_forwarding.ml Mon Feb 01 17:11:06 2010 +0000 @@ -2190,9 +2190,9 @@ (* Don't forward. These are just db operations. Networks are "attached" when required by hosts that read db entries. Bridges corresponding to networks are removed by per-host GC threads that read from db. *) - let create ~__context ~name_label ~name_description ~other_config ~tags = + let create ~__context ~name_label ~name_description ~mTU ~other_config ~tags = info "Network.create: name_label = '%s'" name_label; - Local.Network.create ~__context ~name_label ~name_description ~other_config ~tags + Local.Network.create ~__context ~name_label ~name_description ~mTU ~other_config ~tags let attach ~__context ~network ~host = info "Network.attach: network = '%s'; host = '%s'" (network_uuid ~__context network) (host_uuid ~__context host); @@ -2200,8 +2200,8 @@ do_op_on ~local_fn ~__context ~host (fun session_id rpc -> Client.Network.attach rpc session_id network host) - let pool_introduce ~__context ~name_label ~name_description ~other_config ~bridge = - Local.Network.pool_introduce ~__context ~name_label ~name_description ~other_config ~bridge + let pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge = + Local.Network.pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge let destroy ~__context ~self = info "Network.destroy: network = '%s'" (network_uuid ~__context self); diff -r d2d98f285dd8 ocaml/xapi/xapi_network.ml --- a/ocaml/xapi/xapi_network.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/xapi_network.ml Mon Feb 01 17:11:06 2010 +0000 @@ -112,14 +112,14 @@ debug "Skipping network GC") -let pool_introduce ~__context ~name_label ~name_description ~other_config ~bridge = +let pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge = let r = Ref.make() and uuid = Uuid.make_uuid() in Db.Network.create ~__context ~ref:r ~uuid:(Uuid.to_string uuid) ~current_operations:[] ~allowed_operations:[] - ~name_label ~name_description ~bridge ~other_config ~blobs:[] ~tags:[]; + ~name_label ~name_description ~mTU ~bridge ~other_config ~blobs:[] ~tags:[]; r -let create ~__context ~name_label ~name_description ~other_config ~tags = +let create ~__context ~name_label ~name_description ~mTU ~other_config ~tags = Mutex.execute mutex (fun () -> let networks = Db.Network.get_all ~__context in let bridges = List.map (fun self -> Db.Network.get_bridge ~__context ~self) networks in @@ -131,7 +131,7 @@ let r = Ref.make () and uuid = Uuid.make_uuid () in Db.Network.create ~__context ~ref:r ~uuid:(Uuid.to_string uuid) ~current_operations:[] ~allowed_operations:[] - ~name_label ~name_description ~bridge:name ~other_config ~blobs:[] ~tags; + ~name_label ~name_description ~mTU ~bridge:name ~other_config ~blobs:[] ~tags; r in loop ()) diff -r d2d98f285dd8 ocaml/xapi/xapi_network.mli --- a/ocaml/xapi/xapi_network.mli Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/xapi_network.mli Mon Feb 01 17:11:06 2010 +0000 @@ -59,6 +59,7 @@ __context:Context.t -> name_label:string -> name_description:string -> + mTU:int64 -> other_config:(string * string) list -> bridge:string -> [ `network ] Ref.t (** Attempt to create a bridge with a unique name *) @@ -66,6 +67,7 @@ __context:Context.t -> name_label:string -> name_description:string -> + mTU:int64 -> other_config:(string * string) list -> tags:string list -> [ `network ] Ref.t diff -r d2d98f285dd8 ocaml/xapi/xapi_pif.ml --- a/ocaml/xapi/xapi_pif.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/xapi_pif.ml Mon Feb 01 17:11:06 2010 +0000 @@ -105,7 +105,7 @@ let () = Db.Network.create ~__context ~ref:net_ref ~uuid:net_uuid ~current_operations:[] ~allowed_operations:[] ~name_label:(Helpers.choose_network_name_for_pif device) - ~name_description:"" + ~name_description:"" ~mTU:1500L ~bridge ~other_config:[] ~blobs:[] ~tags:[] in net_ref diff -r d2d98f285dd8 ocaml/xapi/xapi_pool.ml --- a/ocaml/xapi/xapi_pool.ml Mon Feb 01 17:10:55 2010 +0000 +++ b/ocaml/xapi/xapi_pool.ml Mon Feb 01 17:11:06 2010 +0000 @@ -382,6 +382,7 @@ Client.Network.pool_introduce ~rpc ~session_id ~name_label:my_name ~name_description:network.API.network_name_description + ~mTU:network.API.network_MTU ~other_config:network.API.network_other_config ~bridge:network.API.network_bridge in