File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2010,6 +2010,9 @@ let _ =
2010
2010
2011
2011
error Api_errors. too_many_groups [] ~doc: " VM can only belong to one group." () ;
2012
2012
2013
+ error Api_errors. host_driver_no_hardware [" driver variant" ]
2014
+ ~doc: " No hardware present for this host driver variant" () ;
2015
+
2013
2016
message
2014
2017
(fst Api_messages. ha_pool_overcommitted)
2015
2018
~doc:
Original file line number Diff line number Diff line change @@ -1403,3 +1403,5 @@ let telemetry_next_collection_too_late =
1403
1403
let illegal_in_fips_mode = add_error " ILLEGAL_IN_FIPS_MODE"
1404
1404
1405
1405
let too_many_groups = add_error " TOO_MANY_GROUPS"
1406
+
1407
+ let host_driver_no_hardware = add_error " HOST_DRIVER_NO_HARDWARE"
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ module Tool = Xapi_host_driver_tool
21
21
let invalid_value field value =
22
22
raise Api_errors. (Server_error (invalid_value, [field; value]))
23
23
24
+ let no_hardware driver_variant =
25
+ raise Api_errors. (Server_error (host_driver_no_hardware, [driver_variant]))
26
+
24
27
module Variant = struct
25
28
let create ~__context ~name ~version ~driver ~hw_present ~priority ~dev_status
26
29
=
@@ -68,6 +71,8 @@ module Variant = struct
68
71
let drv = Db.Driver_variant. get_driver ~__context ~self in
69
72
let d = Db.Host_driver. get_record ~__context ~self: drv in
70
73
let v = Db.Driver_variant. get_record ~__context ~self in
74
+ if v.API. driver_variant_hardware_present = false then
75
+ no_hardware (Ref. string_of self) ;
71
76
let stdout =
72
77
Tool. call [" select" ; d.API. host_driver_name; v.API. driver_variant_name]
73
78
in
@@ -133,6 +138,8 @@ let select ~__context ~self ~variant =
133
138
D. debug " %s selecting driver %s variant %s" __FUNCTION__ drv var ;
134
139
let d = Db.Host_driver. get_record ~__context ~self in
135
140
let v = Db.Driver_variant. get_record ~__context ~self: variant in
141
+ if v.API. driver_variant_hardware_present = false then
142
+ no_hardware (Ref. string_of variant) ;
136
143
let stdout =
137
144
Tool. call [" select" ; d.API. host_driver_name; v.API. driver_variant_name]
138
145
in
You can’t perform that action at this time.
0 commit comments