Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
4012c99
CP-25797 Add network SR-IOV model
krizex Jan 9, 2018
636924a
CP-23644: Add network sriov as a feature
cheng-z Jan 9, 2018
ef28037
CP-26302: Add driver_name in PCI object
cheng-z Jan 10, 2018
a6a8208
CP-26333 Add PIF.PCI field
krizex Dec 22, 2017
5dbf9e7
CP-26430:fix autocompletion error of network-sriov
minli1 Jan 20, 2018
975e584
CP:26014:Set reserved_pci to Ref.null when vm halted.
minli1 Jan 20, 2018
155f2f4
refine based on Lindig's comments
minli1 Jan 22, 2018
d87f6d0
Clarify function comments based on Marcello's comments
minli1 Jan 23, 2018
9e098fd
Temporary fix to make xapi a sucessful build (#3427)
krizex Feb 2, 2018
d823445
CP-25699 Refine PIF type check related stuff
krizex Feb 1, 2018
062284d
Merge pull request #3431 from krizex/private/yangqi/CP-25699-pif
mseri Feb 5, 2018
94cce78
Code refine
krizex Feb 7, 2018
6df0a39
CP-25699 Network sriov create/destroy
krizex Feb 7, 2018
c16606d
CP-25699 call networkd when enable/disable sriov
krizex Feb 9, 2018
9fdc3fa
CP-25699 Add UT for vlan/bond/tunnel/network_sriov
krizex Feb 7, 2018
726b56f
CP-25795: Support network SR-IOV VF backed vif.
minglumlu Feb 9, 2018
a2f32d6
CP-25795: Add PCIs of network SR-IOV VFs into metadata.
minglumlu Feb 9, 2018
427509f
CP-25795: Enhance backend_of_network function.
minglumlu Feb 9, 2018
2df4154
Merge pull request #3432 from krizex/private/yangqi/CP-25699
robhoes Feb 9, 2018
c0c501e
Merge pull request #3434 from minglumlu/private/mingl/CP-25795
robhoes Feb 9, 2018
f986577
Fix indentation
krizex Feb 11, 2018
ee6ef4a
CP-26857: Blocking 'forget' on SR-IOV logical PIF
minglumlu Feb 14, 2018
a6346fb
Remove vlan-on-vlan support
krizex Feb 23, 2018
6ac045d
CP-27001 Update pci status after enable/disable sriov
krizex Feb 9, 2018
7539b0d
Merge pull request #3465 from krizex/private/yangqi/CP-27001
robhoes Feb 28, 2018
c27ccbb
Move function `is_device_underneath_same_type` to new place
krizex Feb 28, 2018
3c85533
Rename exception `network_is_not_sriov_compatible` to `network_incomp…
krizex Feb 28, 2018
d5affe0
CP-26627 Isolate sriov/sriov vlan network from other network
krizex Feb 28, 2018
3494008
Add unit test for vlan/bond/tunnel
krizex Feb 28, 2018
f677425
Rename and move `assert_sriov_pif_compatible_with_network` to `assert…
krizex Feb 28, 2018
2230695
Merge pull request #3479 from krizex/private/yangqi/CP-26627
robhoes Feb 28, 2018
28e21fa
CP-26148: Function for Network SR-IOV get free capacity
minli1 Feb 24, 2018
69ddfb6
CP-25811: Update host selection and resource reservation for VM with …
minli1 Feb 24, 2018
4846454
CP-26606: Unit tests for choose host with SR-IOV
minli1 Jan 30, 2018
b2e3d14
CP-26608: Disallow SR-IOV VIF plug/unplug
minli1 Feb 28, 2018
13ec5de
CP-23782: Add license restriction for VF usage
cheng-z Jan 22, 2018
ef7c60b
Merge remote-tracking branch 'upstream/master' into sr-iov
krizex Mar 2, 2018
7743f1f
CP-27201 Add network sriov precheck for pool join
krizex Mar 1, 2018
966eb34
CP-27201 Sync network sriov from master to slave when slave restarting
krizex Mar 1, 2018
3418a46
CP-27201 Best effort bring up sriov logical PIFs when xapi start
krizex Mar 1, 2018
f256e09
CP-27201 Gc sriovs when gcing PIFs
krizex Mar 1, 2018
ef0d4ca
CP-27201 refine `sync_vlans` and `sync_tunnels`
krizex Mar 1, 2018
428fdef
CP-27329: Make Network SR-IOV Sync Do Plug on Slave
minglumlu Mar 8, 2018
63503ed
CP-27381: Auto-plug SR-IOV physical PIF
minglumlu Mar 8, 2018
526ee06
gen_api: remove Legacy module
Mar 6, 2018
124be4c
graph: remove unnecessary use of the API.Legacy module
Mar 6, 2018
52f8b79
xapi_vm_clone: remove unnecessary Legacy module
Mar 6, 2018
4ac4085
xapi_vm_clone: improve error reporting
Mar 6, 2018
036837e
importexport: remove unused function
Mar 6, 2018
f9221ba
xapi_vm_clone: read the xml as an rpc and not as a response
Mar 6, 2018
2cf16b6
importexport: replace use of Legacy module
Mar 6, 2018
32d1bdf
importexport: restore some of the old behaviour
Mar 6, 2018
ae211ce
import: don't use the Legacy module
Mar 6, 2018
14fd690
cli_operations: remove unnecessary use of Legacy module
Mar 6, 2018
995d73c
export: get rid of Legacy module
Mar 6, 2018
af2239b
import, importexport: further reduce the use of XMLRPC and cleanup code
Mar 6, 2018
f91a014
import: further reduce and localise the use of Bigbuffer.to_string
Mar 6, 2018
e5b9bb4
xapi, xapi-database: remove use of Xapi_stdext_bigbuffer
Mar 7, 2018
147b67d
datamodel_values: to_rpc, function parity to to_xml
Mar 8, 2018
e3d6bf6
gen_api: add default values to rpc unmarshal
Mar 8, 2018
4d849fd
genOCaml: delete unused module
Mar 8, 2018
2abe925
datamodel_values: remove unused to_xml
Mar 8, 2018
c65c1c6
idl: revert datamodel_values to_rpc change and use to_ocaml_string in…
Mar 8, 2018
06c75bc
datamodel_values: correctly stringify numbers also when they are nega…
Mar 8, 2018
a106d54
gen_api: prevent default values for VCustom fields, these may contain…
Mar 8, 2018
7650afe
gen_api, datamodel_values: get defaults for VCustoms suitable for the…
Mar 8, 2018
2fcf58c
Further unused files cleanup
Mar 8, 2018
ef6d5d8
CP-27381: Auto-unplug SR-IOV logical PIF
minglumlu Mar 9, 2018
0ef88a8
CP-23788: VM guest metrics can read SR-IOV VF IPs
xiewei20082008 Mar 8, 2018
29cb781
CP-23788: Add unitest for VM guest metrics to read SR-IOV VF IPs
xiewei20082008 Mar 8, 2018
7ad1c19
CP-27381: Make "SRIOV" in debug message consistent as upper case
minglumlu Mar 9, 2018
4171386
Merge pull request #3498 from xiewei20082008/sr-iov-dev
cheng-z Mar 9, 2018
60abcc7
CP-27272: Restore lost codes in merge commit
minli1 Mar 9, 2018
dfec6c3
Merge pull request #3501 from minli1/private/minl1/fix3
cheng-z Mar 9, 2018
ca0eb3e
Merge pull request #3499 from minglumlu/private/mingl/CP-27329
robhoes Mar 9, 2018
24938e3
database: simplify types after removing bigbuffer
Mar 12, 2018
349d682
Fix for VM without SR-IOV VIF start failed
minli1 Mar 6, 2018
f27a01d
importexport: use Rpc.to_string instead of Jsonrpc.to_string
Mar 12, 2018
9fb96c3
Port test_vm_migrate to Alcotest
Mar 3, 2018
63c89d6
Port test_ca91480 to Alcotest
Mar 3, 2018
1a6984b
Port test_no_migrate to alcotest
Mar 3, 2018
96adbb2
Port test_gpu_group to Alcotest
Mar 3, 2018
ecbcd6e
Port test_pool_update to Alcotest
Mar 3, 2018
cbde988
Port test_pusb to Alcotest
Mar 11, 2018
e93fb36
Port test_pool_apply_edition to Alcotest
Mar 11, 2018
fbd2931
Port test_pvs_site to Alcotest
Mar 11, 2018
49c037e
Port test_pvs_proxy to Alcotest
Mar 11, 2018
f3503bf
Fix typo in VLAN test
Mar 12, 2018
9ec2685
database: resurrect db_cache_test
Mar 12, 2018
f8d1cd9
db_rpc_common_v2: completely remove Read_set_ref
Mar 12, 2018
5c90f9a
Merge pull request #3504 from minishrink/alcoport
gaborigloi Mar 12, 2018
e14d893
Merge pull request #3490 from mseri/no-legacy
Mar 13, 2018
808eb52
Eliminate fd leak in timebox
krizex Mar 13, 2018
d0f9d51
Merge pull request #3507 from krizex/timebox
krizex Mar 14, 2018
6d16c99
CA-285897: Filter out un-attached VF-backed vifs in PCI metadata
minglumlu Mar 14, 2018
c41e6a9
Merge pull request #3511 from minglumlu/CA-285897
krizex Mar 15, 2018
e7f431b
CA-280342: Bad error message when migration fails
YarsinCitrix Mar 15, 2018
62e114c
CA-284492: Ignore vGPU live-migratability in migrate_send for halted VMs
robhoes Mar 14, 2018
f344bec
Merge pull request #3515 from robhoes/master
Mar 15, 2018
4222160
CP-27433 remove checks for vgpu_migration_enabled()
lindig Mar 15, 2018
9684cea
Merge remote-tracking branch 'upstream/master' into sr-iov
krizex Mar 16, 2018
c46fcbf
Merge pull request #3518 from lindig/remove-vgpu-flag
mseri Mar 16, 2018
cf3e71a
CP-27446: Change the way for getting SR-IOV object from PIF when group
minli1 Mar 19, 2018
67e06dd
Merge pull request #3520 from minli1/private/minl1/fix-sriov-vlan
mseri Mar 19, 2018
168a1ef
CA-286292: VLAN PIF on SR-IOV status is incorrect after restarting
krizex Mar 19, 2018
c9886a9
Merge pull request #3521 from krizex/CA-286292
cheng-z Mar 19, 2018
a87a0b1
CA-286135: Bring up bond when bring up SR-IOV physical
minglumlu Mar 19, 2018
cbf4a15
CA-281178: Update allowed operations in consider_enabling_host
minglumlu Mar 20, 2018
46a83e5
CA-286135: Bring down SR-IOV physical PIF when bring down bond
minglumlu Mar 20, 2018
9b2b4cc
Merge pull request #3523 from minglumlu/private/mingl/CA-286135
krizex Mar 20, 2018
dc8a9ae
Merge remote-tracking branch 'upstream/master' into sr-iov
krizex Mar 21, 2018
6d9468d
Merge pull request #3514 from YarsinCitrix/master
mseri Mar 21, 2018
5341a24
Merge remote-tracking branch 'upstream/master' into sr-iov
krizex Mar 22, 2018
bcd3f3b
Merge pull request #3526 from minglumlu/private/mingl/CA-281178
mseri Mar 22, 2018
f59ce6c
Merge pull request #3528 from xapi-project/sr-iov
mseri Mar 22, 2018
6f00378
Fix typo of `modprobe`
krizex Mar 23, 2018
a3d3393
Merge pull request #3529 from krizex/sriov-typo
mseri Mar 23, 2018
f5e0297
Merge tag 'v1.85.0' into origin-qemu-stable
mg12ctx Mar 23, 2018
bc1059a
Merge branch 'master' of https://github.com/xapi-project/xen-api into…
mg12ctx Mar 23, 2018
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
4 changes: 1 addition & 3 deletions ocaml/database/db_interface.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
* GNU Lesser General Public License for more details.
*)

type response =
| String of string
| Bigbuf of Xapi_stdext_bigbuffer.Bigbuffer.t
type response = string

(** A generic RPC interface *)
module type RPC = sig
Expand Down
6 changes: 3 additions & 3 deletions ocaml/database/db_remote_cache_access_v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ let handler req bio _ =
let body = Http_svr.read_body ~limit:Db_globs.http_limit_max_rpc_size req bio in
let body_xml = Xml.parse_string body in
let reply_xml = DBCacheRemoteListener.process_xmlrpc body_xml in
let response = Xml.to_bigbuffer reply_xml in
Http_svr.response_fct req fd (Xapi_stdext_bigbuffer.Bigbuffer.length response)
(fun fd -> Xapi_stdext_bigbuffer.Bigbuffer.to_fct response (fun s -> ignore(Unix.write fd s 0 (String.length s))))
let response = Xml.to_string reply_xml in
Http_svr.response_fct req fd (Int64.of_int @@ String.length response)
(fun fd -> Unix.write fd response 0 (String.length response) |> ignore)
5 changes: 2 additions & 3 deletions ocaml/database/db_rpc_client_v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ module Make = functor(RPC: Db_interface.RPC) -> struct
let do_remote_call marshall_args unmarshall_resp fn_name args =
let xml = marshall_args args in
let xml = XMLRPC.To.array [XMLRPC.To.string fn_name; XMLRPC.To.string "" (* unused *); xml] in
let resp = match RPC.rpc (Xml.to_string xml) with
| Db_interface.String s -> Xml.parse_string s
| Db_interface.Bigbuf b -> Xml.parse_bigbuffer b
let resp =
RPC.rpc (Xml.to_string xml) |> Xml.parse_string
in
match XMLRPC.From.array (fun x->x) resp with
[status_xml; resp_xml] ->
Expand Down
4 changes: 1 addition & 3 deletions ocaml/database/db_rpc_client_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ open Db_exn
module Make = functor(RPC: Db_interface.RPC) -> struct
let initialise = RPC.initialise
let rpc x =
match RPC.rpc (Jsonrpc.to_string x) with
| Db_interface.String s -> Jsonrpc.of_string s
| Db_interface.Bigbuf b -> raise (Failure "Response too large - cannot convert bigbuffer to json!")
RPC.rpc (Jsonrpc.to_string x) |> Jsonrpc.of_string

let process (x: Request.t) =
let y : Response.t = Response.t_of_rpc (rpc (Request.rpc_of_t x)) in
Expand Down
2 changes: 0 additions & 2 deletions ocaml/database/db_rpc_common_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module Request = struct
| Read_field_where of Db_cache_types.where_record
| Db_get_by_uuid of string * string
| Db_get_by_name_label of string * string
| Read_set_ref of Db_cache_types.where_record
| Create_row of string * (string * string) list * string
| Delete_row of string * string
| Write_field of string * string * string * string
Expand Down Expand Up @@ -57,7 +56,6 @@ module Response = struct
| Read_field_where of string list
| Db_get_by_uuid of string
| Db_get_by_name_label of string list
| Read_set_ref of string list
| Create_row of unit
| Delete_row of unit
| Write_field of unit
Expand Down
18 changes: 17 additions & 1 deletion ocaml/database/jbuild
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
http-svr
gzip
uuid
xapi-stdext-bigbuffer
xapi-stdext-encodings
xapi-stdext-monadic
xapi-stdext-pervasives
Expand All @@ -74,6 +73,15 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
)
)

(executable
((name db_cache_test)
(modules (db_cache_test))
(libraries (
oUnit
xapi-database
))
))

(executable
((name unit_test_marshall)
(modules (
Expand Down Expand Up @@ -130,4 +138,12 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
)
)

(alias
((name runtest)
(deps (db_cache_test.exe))
(package xapi-database)
(action (run ${<}))
)
)

|} (flags rewriters) coverage_rewriter
17 changes: 5 additions & 12 deletions ocaml/database/master_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ exception Content_length_required
let do_db_xml_rpc_persistent_with_reopen ~host ~path (req: string) : Db_interface.response =
let time_call_started = Unix.gettimeofday() in
let write_ok = ref false in
let result = ref (Db_interface.String "") in
let result = ref "" in
let surpress_no_timeout_logs = ref false in
let backoff_delay = ref 2.0 in (* initial delay = 2s *)
let update_backoff_delay () =
Expand Down Expand Up @@ -185,19 +185,12 @@ let do_db_xml_rpc_persistent_with_reopen ~host ~path (req: string) : Db_interfac
with_timestamp (fun () ->
with_http request (fun (response, _) ->
(* XML responses must have a content-length because we cannot use the Xml.parse_in
in_channel function: the input channel will buffer an arbitrary amount of stuff
and we'll be out of sync with the next request. *)
in_channel function: the input channel will buffer an arbitrary amount of stuff
and we'll be out of sync with the next request. *)
let res = match response.Http.Response.content_length with
| None -> raise Content_length_required
| Some l -> begin
let open Xapi_stdext_unix in
if (Int64.to_int l) <= Sys.max_string_length then
Db_interface.String (Unixext.really_read_string fd (Int64.to_int l))
else
let buf = Xapi_stdext_bigbuffer.Bigbuffer.make () in
Unixext.really_read_bigbuffer fd buf l;
Db_interface.Bigbuf buf
end
| Some l ->
Xapi_stdext_unix.Unixext.really_read_string fd (Int64.to_int l)
in
write_ok := true;
result := res (* yippeee! return and exit from while loop *)
Expand Down
14 changes: 7 additions & 7 deletions ocaml/graph/graph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ let refs_of_record cls record =
let fields = Datamodel_utils.fields_of_obj obj in
let rec refs_of ty xml = match ty with
| Ref _ -> [ XMLRPC.From.string xml ]
| Set t -> List.concat (API.Legacy.From.set (refs_of t) xml)
| Map(k, v) ->
let pairs = API.Legacy.From.map (fun x -> x) (refs_of v) xml in
| Set t -> List.concat (XMLRPC.From.array (refs_of t) xml)
| Map(kt, vt) ->
let pairs = List.map (fun (k, v) -> k, refs_of vt v) (XMLRPC.From.structure xml) in
let vs = List.concat (List.map snd pairs) in
begin match k with
begin match kt with
| Ref _ -> List.map fst pairs @ vs
| _ -> vs
end
Expand All @@ -48,8 +48,8 @@ let name_label_of_record cls record =
let all_classes = List.map (fun x -> x.name)
(Dm_api.objects_of_api Datamodel.all_api)

open XMLRPC
let do_rpc rpc name args =
let open XMLRPC in
match From.methodResponse(rpc(To.methodCall name args)) with
| Fault _ -> invalid_arg "Fault"
| Failure(code, strings) -> raise (Api_errors.Server_error(code, strings))
Expand All @@ -60,8 +60,8 @@ let do_rpc rpc name args =

let get_all rpc session_id cls =
let name = Printf.sprintf "%s.get_all_records_where" cls in
let args = [ To.string (Ref.string_of session_id); To.string "true" ] in
API.Legacy.From.map (fun x -> x) (fun x -> x) (do_rpc rpc name args)
let args = [ XMLRPC.To.string (Ref.string_of session_id); XMLRPC.To.string "true" ] in
XMLRPC.From.structure (do_rpc rpc name args)

type node = { id: string; label: string; cls: string }
type edge = { a: string; b: string }
Expand Down
71 changes: 71 additions & 0 deletions ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,9 @@ module PIF = struct
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.";
field ~lifecycle:[Published, rel_inverness, ""] ~qualifier:DynamicRO ~ty:igmp_status ~default_value:(Some (VEnum "unknown")) "igmp_snooping_status" "The IGMP snooping status of the corresponding network bridge";
field ~in_oss_since:None ~ty:(Set (Ref _network_sriov)) ~in_product_since:rel_kolkata ~qualifier:DynamicRO "sriov_physical_PIF_of" "Indicates which network_sriov this interface is physical of";
field ~in_oss_since:None ~ty:(Set (Ref _network_sriov)) ~in_product_since:rel_kolkata ~qualifier:DynamicRO "sriov_logical_PIF_of" "Indicates which network_sriov this interface is logical of";
field ~qualifier:DynamicRO ~ty:(Ref _pci) ~lifecycle:[Published, rel_kolkata, ""] ~default_value:(Some (VRef null_ref)) "PCI" "Link to underlying PCI device";
]
()
end
Expand Down Expand Up @@ -1643,6 +1646,7 @@ module VIF = struct
field ~ty:ipv6_configuration_mode ~in_product_since:rel_dundee ~qualifier:DynamicRO "ipv6_configuration_mode" "Determines whether IPv6 addresses are configured on the VIF" ~default_value:(Some (VEnum "None"));
field ~ty:(Set (String)) ~in_product_since:rel_dundee ~qualifier:DynamicRO "ipv6_addresses" "IPv6 addresses in CIDR format" ~default_value:(Some (VSet []));
field ~ty:String ~in_product_since:rel_dundee ~qualifier:DynamicRO "ipv6_gateway" "IPv6 gateway (the empty string means that no gateway is set)" ~default_value:(Some (VString ""));
field ~ty:(Ref _pci) ~in_product_since:rel_kolkata ~internal_only:true ~qualifier:DynamicRO "reserved_pci" "pci of network SR-IOV VF which is reserved for this vif" ~default_value:(Some (VRef null_ref));
])
()
end
Expand Down Expand Up @@ -4220,6 +4224,68 @@ let alert =
()
*)

(** network sriov **)
module Network_sriov = struct
let lifecycle = [Published, rel_kolkata, ""]

let sriov_configuration_mode = Enum ("sriov_configuration_mode",
[
"sysfs", "Configure network sriov by sysfs, do not need reboot";
"modprobe", "Configure network sriov by modprobe, need reboot";
"unknown", "Unknown mode";
])

let create = call
~name:"create"
~doc:"Enable SR-IOV on the specific PIF. It will create a network-sriov based on the specific PIF and automatically create a logical PIF to connect the specific network."
~params:[Ref _pif, "pif", "PIF on which to enable SR-IOV";
Ref _network, "network", "Network to connect SR-IOV virtual functions with VM VIFs"]
~result:(Ref _network_sriov, "The reference of the created network_sriov object")
~lifecycle
~allowed_roles:_R_POOL_OP
()

let destroy = call
~name:"destroy"
~doc:"Disable SR-IOV on the specific PIF. It will destroy the network-sriov and the logical PIF accordingly."
~params:[Ref _network_sriov, "self", "SRIOV to destroy"]
~lifecycle
~allowed_roles:_R_POOL_OP
()

let get_remaining_capacity = call
~name:"get_remaining_capacity"
~doc:"Get the number of free SR-IOV VFs on the associated PIF"
~params:[Ref _network_sriov, "self", "the NETWORK_SRIOV object"]
~lifecycle
~result:(Int, "The number of free SR-IOV VFs on the associated PIF")
~allowed_roles:_R_READ_ONLY
()

let t =
create_obj
~name:_network_sriov
~descr:"network-sriov which connects logical pif and physical pif"
~doccomments:[]
~gen_constructor_destructor:false
~gen_events:true
~in_db:true
~lifecycle
~messages:[create; destroy; get_remaining_capacity]
~messages_default_allowed_roles:_R_POOL_OP
~persist:PersistEverything
~in_oss_since:None
~contents:
([
uid _network_sriov;
field ~qualifier:StaticRO ~ty:(Ref _pif) ~lifecycle "physical_PIF" "The PIF that has SR-IOV enabled" ~default_value:(Some (VRef ""));
field ~qualifier:StaticRO ~ty:(Ref _pif) ~lifecycle "logical_PIF" "The logical PIF to connect to the SR-IOV network after enable SR-IOV on the physical PIF" ~default_value:(Some (VRef ""));
field ~qualifier:DynamicRO ~ty:Bool ~lifecycle "requires_reboot" "Indicates whether the host need to be rebooted before SR-IOV is enabled on the physical PIF" ~default_value:(Some (VBool false));
field ~qualifier:DynamicRO ~ty:sriov_configuration_mode ~lifecycle "configuration_mode" "The mode for configure network sriov" ~default_value:(Some (VEnum "unknown"));
])
()
end

(** PCI devices *)

module PCI = struct
Expand Down Expand Up @@ -4258,6 +4324,7 @@ module PCI = struct
field ~qualifier:StaticRO ~ty:String ~lifecycle:[] "subsystem_device_id" "Subsystem device ID" ~default_value:(Some (VString "")) ~internal_only:true;
field ~qualifier:StaticRO ~ty:String ~lifecycle:[Published, rel_clearwater_whetstone, ""] "subsystem_device_name" "Subsystem device name" ~default_value:(Some (VString ""));
field ~qualifier:DynamicRO ~ty:(Ref _vm) ~lifecycle:[Published, rel_falcon, ""] ~internal_only:true "scheduled_to_be_attached_to" "The VM to which this PCI device is scheduled to be attached (passed through)" ~default_value:(Some (VRef null_ref));
field ~qualifier:StaticRO ~ty:String ~lifecycle:[Published, rel_kolkata, ""] "driver_name" "Driver name" ~default_value:(Some (VString ""));
]
()
end
Expand Down Expand Up @@ -5255,6 +5322,7 @@ let all_system =
Message.t;
Secret.t;
Tunnel.t;
Network_sriov.t;
PCI.t;
PGPU.t;
GPU_group.t;
Expand Down Expand Up @@ -5366,6 +5434,8 @@ let all_relations =
(_vusb, "VM"), (_vm, "VUSBs");

(_feature, "host"), (_host, "features");
(_network_sriov, "physical_PIF"), (_pif, "sriov_physical_PIF_of");
(_network_sriov, "logical_PIF"), (_pif, "sriov_logical_PIF_of");
]

(** the full api specified here *)
Expand Down Expand Up @@ -5457,6 +5527,7 @@ let expose_get_all_messages_for = [
_pvs_cache_storage;
_feature;
_sdn_controller;
_network_sriov;
(* _vdi_nbd_server_info must NOT be included here *)
_pusb;
_usb_group;
Expand Down
1 change: 1 addition & 0 deletions ocaml/idl/datamodel_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ let _vdi_nbd_server_info = "vdi_nbd_server_info"
let _pusb = "PUSB"
let _usb_group = "USB_group"
let _vusb = "VUSB"
let _network_sriov = "network_sriov"
let _cluster = "Cluster"
let _cluster_host = "Cluster_host"

Expand Down
43 changes: 42 additions & 1 deletion ocaml/idl/datamodel_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@ let _ =
error Api_errors.user_is_not_local_superuser [ "msg" ]
~doc:"Only the local superuser can execute this operation" ();

(* SR-IOV errors *)
error Api_errors.network_sriov_insufficient_capacity [ "network" ]
~doc:"There is insufficient capacity for VF reservation" ();
error Api_errors.network_sriov_already_enabled ["PIF"]
~doc:"The PIF selected for the SR-IOV network is already enabled" ();
error Api_errors.network_sriov_enable_failed ["PIF"; "msg"]
~doc:"Failed to enable SR-IOV on PIF" ();
error Api_errors.network_sriov_disable_failed ["PIF"; "msg"]
~doc:"Failed to disable SR-IOV on PIF" ();
error Api_errors.network_has_incompatible_sriov_pifs ["PIF"; "network"]
~doc:"The PIF is not compatible with the selected SR-IOV network" ();
error Api_errors.network_has_incompatible_vlan_on_sriov_pifs ["PIF"; "network"]
~doc:"VLAN on the PIF is not compatible with the selected SR-IOV VLAN network" ();
error Api_errors.network_incompatible_with_sriov ["network"]
~doc:"The network is incompatible with sriov" ();
error Api_errors.network_incompatible_with_vlan_on_bridge ["network"]
~doc:"The network is incompatible with vlan on bridge" ();
error Api_errors.network_incompatible_with_vlan_on_sriov ["network"]
~doc:"The network is incompatible with vlan on sriov" ();
error Api_errors.network_incompatible_with_bond ["network"]
~doc:"The network is incompatible with bond" ();
error Api_errors.network_incompatible_with_tunnel ["network"]
~doc:"The network is incompatible with tunnel" ();
error Api_errors.pool_joining_host_has_network_sriovs []
~doc:"The host joining the pool must not have any network SR-IOVs." ();

(* PIF/VIF/Network errors *)
error Api_errors.network_unmanaged [ "network" ]
~doc:"The network is not managed by xapi." ();
Expand All @@ -129,9 +155,12 @@ let _ =
~doc:"You tried to add a purpose to a network but the new purpose is not compatible with an existing purpose of the network or other networks." ();
error Api_errors.pif_is_physical ["PIF"]
~doc:"You tried to destroy a PIF, but it represents an aspect of the physical host configuration, and so cannot be destroyed. The parameter echoes the PIF handle you gave." ();
error Api_errors.pif_is_not_physical ["PIF"]
~doc:"You tried to perform an operation which is only available on physical PIF" ();
error Api_errors.pif_is_vlan ["PIF"]
~doc:"You tried to create a VLAN on top of another VLAN - use the underlying physical PIF/bond instead" ();

error Api_errors.pif_is_sriov_logical ["PIF"]
~doc:"You tried to create a bond on top of a network SR-IOV logical PIF - use the underlying physical PIF instead" ();
error Api_errors.pif_vlan_exists ["PIF"]
~doc:"You tried to create a PIF, but it already exists." ();
error Api_errors.pif_vlan_still_exists [ "PIF" ]
Expand Down Expand Up @@ -164,20 +193,30 @@ let _ =
~doc:"The operation you requested cannot be performed because the specified PIF has FCoE SR in use." ();
error Api_errors.pif_unmanaged [ "PIF" ]
~doc:"The operation you requested cannot be performed because the specified PIF is not managed by xapi." ();
error Api_errors.pif_is_not_sriov_capable [ "PIF" ]
~doc:"The selected PIF is not capable of network SR-IOV" ();
error Api_errors.pif_has_no_network_configuration [ "PIF" ]
~doc:"PIF has no IP configuration (mode currently set to 'none')" ();
error Api_errors.pif_has_no_v6_network_configuration [ "PIF" ]
~doc:"PIF has no IPv6 configuration (mode currently set to 'none')" ();
error Api_errors.pif_incompatible_primary_address_type [ "PIF" ]
~doc:"The primary address types are not compatible" ();
error Api_errors.pif_sriov_still_exists [ "PIF" ]
~doc:"The PIF is still related with a network SR-IOV" ();
error Api_errors.cannot_plug_bond_slave ["PIF"]
~doc:"This PIF is a bond slave and cannot be plugged." ();
error Api_errors.cannot_add_vlan_to_bond_slave ["PIF"]
~doc:"This PIF is a bond slave and cannot have a VLAN on it." ();
error Api_errors.cannot_add_tunnel_to_bond_slave ["PIF"]
~doc:"This PIF is a bond slave and cannot have a tunnel on it." ();
error Api_errors.cannot_add_tunnel_to_sriov_logical ["PIF"]
~doc:"This is a network SR-IOV logical PIF and cannot have a tunnel on it." ();
error Api_errors.cannot_add_tunnel_to_vlan_on_sriov_logical ["PIF"]
~doc:"This is a vlan PIF on network SR-IOV and cannot have a tunnel on it." ();
error Api_errors.cannot_change_pif_properties ["PIF"]
~doc:"This properties of this PIF cannot be changed. Only the properties of non-bonded physical PIFs, or bond masters can be changed." ();
error Api_errors.cannot_forget_sriov_logical [ "PIF" ]
~doc:"This is a network SR-IOV logical PIF and cannot do forget on it" ();
error Api_errors.incompatible_pif_properties []
~doc:"These PIFs can not be bonded, because their properties are different." ();
error Api_errors.slave_requires_management_iface []
Expand Down Expand Up @@ -587,6 +626,8 @@ let _ =
~doc:"VM cannot be resumed because it has no suspend VDI" ();
error Api_errors.vm_migrate_failed [ "vm"; "source"; "destination"; "msg" ]
~doc:"An error occurred during the migration process." ();
error Api_errors.vm_migrate_contact_remote_service_failed []
~doc:"Failed to contact service on the destination host." ();
error Api_errors.vm_has_too_many_snapshots [ "vm" ]
~doc:"You attempted to migrate a VM with more than one snapshot." ();
error Api_errors.vm_has_checkpoint [ "vm" ]
Expand Down
Loading