File tree Expand file tree Collapse file tree
lib/vagrant-openstack-cloud-provider
spec/vagrant-openstack-cloud-provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ This provider exposes quite a few provider-specific configuration options:
7070* ` image ` - The server image to boot. This can be a string matching the
7171 exact ID or name of the image, or this can be a regular expression to
7272 partially match some image.
73+ * ` availability_zone ` - The availability zone to use with nova,
74+ this allows to choose which zone your instance will exist on.
7375* ` endpoint ` - The keystone authentication URL of your OpenStack installation.
7476* ` server_name ` - The name of the server within the OpenStack Cloud. This
7577 defaults to the name of the Vagrant machine (via ` config.vm.define ` ), but
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ def call(env)
6464 env [ :ui ] . info ( " - #{ net [ 'name' ] } " )
6565 end
6666 end
67+
68+ unless config . availability_zone . nil?
69+ env [ :ui ] . info ( " -- Availability Zone: #{ config . availability_zone } " )
70+ end
71+
6772 env [ :ui ] . info ( " -- Name: #{ server_name } " )
6873
6974 openstack_nics = [ ]
@@ -83,6 +88,10 @@ def call(env)
8388 :os_scheduler_hints => config . scheduler_hints
8489 }
8590
91+ unless config . availability_zone . nil?
92+ options [ :availability_zone ] = config . availability_zone
93+ end
94+
8695 if openstack_nics . any?
8796 options [ :nics ] = openstack_nics
8897 end
Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ class Config < Vagrant.plugin("2", :config)
9494 # @return [String]
9595 attr_accessor :user_domain_id
9696
97+ # @return [String]
98+ attr_accessor :availability_zone
99+
97100 # Version to use for keystone authentication
98101 # Not used for now, will be supported in the next version.
99102 # Known version are 'v2.0', 'v3'
@@ -141,6 +144,7 @@ def initialize
141144 @instance_ssh_timeout = UNSET_VALUE
142145 @instance_ssh_check_interval = UNSET_VALUE
143146 @report_progress = UNSET_VALUE
147+ @availability_zone = UNSET_VALUE
144148
145149 @project_name = UNSET_VALUE
146150 @project_id = UNSET_VALUE
@@ -194,6 +198,7 @@ def finalize!
194198 @instance_ssh_timeout = 120 if @instance_ssh_timeout == UNSET_VALUE
195199 @instance_ssh_check_interval = 2 if @instance_ssh_check_interval == UNSET_VALUE
196200
201+ @availability_zone = nil if @availability_zone == UNSET_VALUE
197202 @report_progress = true if @report_progress == UNSET_VALUE
198203 end
199204
Original file line number Diff line number Diff line change 4040 it { is_expected . to have_attributes ( identity_api_version : nil ) }
4141
4242 it { is_expected . to have_attributes ( scheduler_hints : { } ) }
43+ it { is_expected . to have_attributes ( availability_zone : nil ) }
4344 it { is_expected . to have_attributes ( instance_build_timeout : 120 ) }
4445 it { is_expected . to have_attributes ( instance_build_status_check_interval : 1 ) }
4546 it { is_expected . to have_attributes ( instance_ssh_timeout : 120 ) }
7172 :user_domain_id ,
7273 :identity_api_version ,
7374 :scheduler_hints ,
75+ :availability_zone ,
7476 :report_progress ] . each do |attribute |
7577 it "should not default #{ attribute } if overridden" do
7678 subject . send ( "#{ attribute } =" , "foo" )
You can’t perform that action at this time.
0 commit comments