From 4c01db60f6f9de618dd284332e4aad0a3cc8654e Mon Sep 17 00:00:00 2001 From: Xavier Antoviaque Date: Wed, 24 Jul 2013 18:01:52 -0300 Subject: [PATCH] Adds `availability_zone` option to specify instance zone --- lib/vagrant-openstack-plugin/action/create_server.rb | 3 ++- lib/vagrant-openstack-plugin/config.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-openstack-plugin/action/create_server.rb b/lib/vagrant-openstack-plugin/action/create_server.rb index 8b60ec2..a05bfaa 100644 --- a/lib/vagrant-openstack-plugin/action/create_server.rb +++ b/lib/vagrant-openstack-plugin/action/create_server.rb @@ -41,7 +41,8 @@ def call(env) :metadata => config.metadata, :user_data => config.user_data, :security_groups => config.security_groups, - :os_scheduler_hints => config.scheduler_hints + :os_scheduler_hints => config.scheduler_hints, + :availability_zone => config.availability_zone } # Find a network if provided diff --git a/lib/vagrant-openstack-plugin/config.rb b/lib/vagrant-openstack-plugin/config.rb index d5a0975..74508a6 100644 --- a/lib/vagrant-openstack-plugin/config.rb +++ b/lib/vagrant-openstack-plugin/config.rb @@ -50,6 +50,9 @@ class Config < Vagrant.plugin("2", :config) # Pass hints to the OpenStack scheduler, e.g. { "cell": "some cell name" } attr_accessor :scheduler_hints + # Specify the availability zone in which to create the instance + attr_accessor :availability_zone + # List of strings representing the security groups to apply. # e.g. ['ssh', 'http'] # @@ -94,6 +97,7 @@ def initialize @network = UNSET_VALUE @address_id = UNSET_VALUE @scheduler_hints = UNSET_VALUE + @availability_zone = UNSET_VALUE @security_groups = UNSET_VALUE @ssh_username = UNSET_VALUE @tenant = UNSET_VALUE @@ -116,6 +120,7 @@ def finalize! @keypair_name = nil if @keypair_name == UNSET_VALUE @scheduler_hints = nil if @scheduler_hints == UNSET_VALUE + @availability_zone = nil if @availability_zone == UNSET_VALUE @security_groups = nil if @security_groups == UNSET_VALUE # The SSH values by default are nil, and the top-level config