Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
CP-12093: Add a new field "capabilities" to PIF record
Use fcoe_driver interface to identify fcoe capable NICs.

Capabilities field:
1) ["fcoe"] - represents NIC supports fcoe
2) [] - represents NIC doesn't support fcoe

Signed-off-by: sharad yadav <[email protected]>
  • Loading branch information
sharady committed Jun 8, 2015
commit 05427264ead6060adb278de801c295508746f46c
2 changes: 2 additions & 0 deletions ocaml/client_records/records.ml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ let pif_record rpc session_id pif =
~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.pIF_properties)
~get_map:(fun () -> (x ()).API.pIF_properties)
~set_in_map:(fun k v -> Client.PIF.set_property rpc session_id pif k v) ();
make_field ~name:"capabilities" ~get:(fun () -> String.concat "; " (x ()).API.pIF_capabilities)
~get_set:(fun () -> (x ()).API.pIF_capabilities) ();
make_field ~name:"io_read_kbs" ~get:(fun () ->
try
let host = (x ()).API.pIF_host in
Expand Down
1 change: 1 addition & 0 deletions ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4896,6 +4896,7 @@ let pif =
is managed by xapi. If it is not, then xapi will not configure the interface, the commands PIF.plug/unplug/reconfigure_ip(v6) \
can not be used, nor can the interface be bonded or have VLANs based on top through xapi." ~default_value:(Some (VBool true));
field ~lifecycle:[Published, rel_creedence, ""] ~qualifier:DynamicRO ~ty:(Map(String, String)) ~default_value:(Some (VMap [])) "properties" "Additional configuration properties for the interface.";
field ~lifecycle:[Published, rel_dundee, ""] ~qualifier:DynamicRO ~ty:(Set(String)) ~default_value:(Some (VSet [])) "capabilities" "Additional capabilities on the interface.";
]
()

Expand Down
1 change: 1 addition & 0 deletions ocaml/xapi/network.mli
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Net :
val exists : string -> name:Network_interface.iface -> bool
val get_mac : string -> name:Network_interface.iface -> string
val is_up : string -> name:Network_interface.iface -> bool
val get_capabilities: string -> name:Network_interface.iface -> string list
val get_ipv4_addr :
string ->
name:Network_interface.iface -> (Unix.inet_addr * int) list
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_bond.ml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ let create ~__context ~network ~members ~mAC ~mode ~properties =
~ip_configuration_mode:`None ~iP:"" ~netmask:"" ~gateway:"" ~dNS:"" ~bond_slave_of:Ref.null
~vLAN_master_of:Ref.null ~management:false ~other_config:[] ~disallow_unplug:false
~ipv6_configuration_mode:`None ~iPv6:[""] ~ipv6_gateway:"" ~primary_address_type:`IPv4 ~managed:true
~properties:pif_properties;
~properties:pif_properties ~capabilities:[];
Db.Bond.create ~__context ~ref:bond ~uuid:(Uuid.to_string (Uuid.make_uuid ())) ~master:master ~other_config:[]
~primary_slave ~mode ~properties ~links_up:0L;

Expand Down
16 changes: 13 additions & 3 deletions ocaml/xapi/xapi_pif.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,18 @@ let refresh_internal ~__context ~self =
(Db.PIF.set_MAC)
(fun () -> Net.Interface.get_mac dbg ~name:device)
(id);

maybe_update_database "MTU"
(Db.PIF.get_MTU)
(Db.PIF.set_MTU)
(Int64.of_int ++ (fun () -> Net.Interface.get_mtu dbg ~name:bridge))
(Int64.to_string)
(Int64.to_string);

maybe_update_database "capabilities"
(Db.PIF.get_capabilities)
(Db.PIF.set_capabilities)
(fun () -> Net.Interface.get_capabilities dbg ~name:device)
(String.concat "; ")

let refresh ~__context ~host ~self =
assert (host = Helpers.get_localhost ~__context);
Expand Down Expand Up @@ -316,7 +323,7 @@ let pool_introduce
~ip_configuration_mode ~iP ~netmask ~gateway ~dNS
~bond_slave_of:Ref.null ~vLAN_master_of ~management
~other_config ~disallow_unplug ~ipv6_configuration_mode
~iPv6 ~ipv6_gateway ~primary_address_type ~managed ~properties in
~iPv6 ~ipv6_gateway ~primary_address_type ~managed ~properties ~capabilities:[] in
pif_ref

let db_introduce = pool_introduce
Expand All @@ -339,6 +346,9 @@ let introduce_internal
| None -> make_pif_metrics ~__context
| Some m -> m
in
let dbg = Context.string_of_task __context in
let capabilities = Net.Interface.get_capabilities dbg device in

let pif = Ref.make () in
debug
"Creating a new record for NIC: %s: %s"
Expand All @@ -352,7 +362,7 @@ let introduce_internal
~dNS:"" ~bond_slave_of:Ref.null ~vLAN_master_of ~management:false
~other_config:[] ~disallow_unplug:false ~ipv6_configuration_mode:`None
~iPv6:[] ~ipv6_gateway:"" ~primary_address_type:`IPv4 ~managed
~properties:default_properties in
~properties:default_properties ~capabilities:capabilities in

(* If I'm a pool slave and this pif represents my management
* interface then leave it alone: if the interface goes down
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_tunnel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let create_internal ~__context ~transport_PIF ~network ~host =
~physical:false ~currently_attached:false
~ip_configuration_mode:`None ~iP:"" ~netmask:"" ~gateway:"" ~dNS:"" ~bond_slave_of:Ref.null
~vLAN_master_of:Ref.null ~management:false ~other_config:[] ~disallow_unplug:false ~ipv6_configuration_mode:`None
~iPv6:[""] ~ipv6_gateway:"" ~primary_address_type:`IPv4 ~managed:true ~properties:[];
~iPv6:[""] ~ipv6_gateway:"" ~primary_address_type:`IPv4 ~managed:true ~properties:[] ~capabilities:[];
Db.Tunnel.create ~__context ~ref:tunnel ~uuid:(Uuid.to_string (Uuid.make_uuid ()))
~access_PIF ~transport_PIF ~status:["active", "false"] ~other_config:[];
tunnel, access_PIF
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_vlan.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let create_internal ~__context ~host ~tagged_PIF ~tag ~network ~device =
~ip_configuration_mode:`None ~iP:"" ~netmask:"" ~gateway:"" ~dNS:"" ~bond_slave_of:Ref.null
~vLAN_master_of:vlan ~management:false ~other_config:[] ~disallow_unplug:false
~ipv6_configuration_mode:`None ~iPv6:[""] ~ipv6_gateway:"" ~primary_address_type:`IPv4 ~managed:true
~properties:[];
~properties:[] ~capabilities:[];

let () = Db.VLAN.create ~__context ~ref:vlan ~uuid:vlan_uuid ~tagged_PIF ~untagged_PIF ~tag ~other_config:[] in
vlan, untagged_PIF
Expand Down