File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,10 @@ let make_pif_metrics ~__context =
280280 ~other_config: [] in
281281 metrics
282282
283+ let property_names_and_values = [
284+ " gro" , [" on" ; " off" ]
285+ ]
286+
283287let default_properties = [
284288 " gro" , " on"
285289]
@@ -653,6 +657,14 @@ let set_primary_address_type ~__context ~self ~primary_address_type =
653657 Monitor_dbcalls. clear_cache_for_pif ~pif_name: (Db.PIF. get_device ~__context ~self )
654658
655659let set_property ~__context ~self ~name ~value =
660+ let fail () = raise (Api_errors. Server_error
661+ (Api_errors. invalid_value, [" properties" ; Printf. sprintf " %s = %s" name value]))
662+ in
663+ if not (List. mem_assoc name property_names_and_values) then
664+ fail ()
665+ else if not (List. mem value (List. assoc name property_names_and_values)) then
666+ fail () ;
667+
656668 (* Remove the existing property with this name, then add the new value. *)
657669 let properties = List. filter
658670 (fun (property_name , _ ) -> property_name <> name)
You can’t perform that action at this time.
0 commit comments