File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,20 @@ If your vms require config drive.
204204 config_drive: true
205205```
206206
207+ ### scheduler\_hints
208+
209+ If you wish to pass any scheduler hints.
210+
211+ ```
212+ scheduler_hints:
213+ group: b0f6f534-3a02-4dfa-9165-605446799cc0
214+ query: >-
215+ ["or",
216+ ["=", "$host", "cmp123.example.com"],
217+ ["=", "$host", "cmp456.example.com"]
218+ ]
219+ ```
220+
207221### network\_ref
208222
209223**Deprecated** A list of network names to create instances with.
Original file line number Diff line number Diff line change @@ -200,6 +200,10 @@ def create_server
200200 server_def [ c ] = optional_config ( c ) if config [ c ]
201201 end
202202
203+ if config [ :scheduler_hints ]
204+ server_def [ "os:scheduler_hints" ] = optional_config ( :scheduler_hints )
205+ end
206+
203207 # Can't use the Fog bootstrap and/or setup methods here; they require a
204208 # public IP address that can't be guaranteed to exist across all
205209 # OpenStack deployments (e.g. TryStack ARM only has private IPs).
@@ -224,6 +228,8 @@ def optional_config(c)
224228 config [ c ] if config [ c ] . is_a? ( Array )
225229 when :user_data
226230 File . open ( config [ c ] , &:read ) if File . exist? ( config [ c ] )
231+ when :scheduler_hints
232+ config [ c ] if config [ c ] . is_a? ( Hash )
227233 else
228234 config [ c ]
229235 end
Original file line number Diff line number Diff line change 534534 end
535535 end
536536
537+ context "scheduler_hints specified" do
538+ let ( :config ) do
539+ {
540+ server_name : "hello" ,
541+ image_ref : "111" ,
542+ flavor_ref : "1" ,
543+ scheduler_hints : {
544+ group : "3df3519e-0e22-4d14-8c6a-afd8e4467b4b" ,
545+ } ,
546+ }
547+ end
548+ let ( :data ) do
549+ {
550+ group : "3df3519e-0e22-4d14-8c6a-afd8e4467b4b" ,
551+ }
552+ end
553+
554+ it "passes scheduler_hints contents" do
555+ expect ( servers ) . to receive ( :create ) . with (
556+ name : "hello" ,
557+ image_ref : "111" ,
558+ flavor_ref : "1" ,
559+ availability_zone : nil ,
560+ "os:scheduler_hints" => data
561+ )
562+ driver . send ( :create_server )
563+ end
564+ end
565+
537566 context "image_id specified" do
538567 let ( :config ) do
539568 {
You can’t perform that action at this time.
0 commit comments