vagrant-openstack-plugin 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c685d66661ea243dc4d8c73b8f4c817c5d8c1661
4
- data.tar.gz: 2202e0c0a24bf6527c7cc5011aea420db83732c3
3
+ metadata.gz: c446b86835b0354be7f63cf8d9e61281681ac655
4
+ data.tar.gz: ed7c805fe05803e7c412d33e8ed36c0bdb2cb7af
5
5
  SHA512:
6
- metadata.gz: f637c987968a37910aafd222c466037f0eccbce39774693b95d8dc5fee3c47764f6caad178a5ba1ae4bfe68460d011e4a7357329889b9d1a840cbae5bba811b7
7
- data.tar.gz: cc0a8cfac02294cbb496844568b56b636013bf3c50517d00a18b8872251ff98177c23fb5b713809e55fabcffc906c13ea90472eb5672f5e22f035f1c1ac63803
6
+ metadata.gz: e394d3b39dc0d3020dec63beb7c27333c5e9507869c608193736c2acdfb9541e728d9a6c3b308781a5774df17484f935fa3cbf3fe38493a07ad25c961443666d
7
+ data.tar.gz: 9e34fdca9c3c9297b61416896354cb9c20aff52e71fd553d39d9d120f28a9b8d6640f06c3f92b289eab83d725b65c0d5b2dd173a98662cf106e5eca60c4ff3f9
@@ -1,5 +1,24 @@
1
1
  # Changelog for vagrant-openstack-plugin
2
2
 
3
+ ## 0.12.0 (2015/08/27)
4
+
5
+ - be more specific on using symbols in the config. fixes cloudbau/vagrant-openstack-plugin#106 [view commit](http://github.com///commit/0ef0865c6e38debd77982310073fe09cd99c6054)
6
+ - Merge pull request #103 from corpix/ssh_ip_family [view commit](http://github.com///commit/6ca314cc0cdbbe62bd4b80e65e518103ce73b027)
7
+ - Merge pull request #109 from joelanford/floating-ip-fix [view commit](http://github.com///commit/2bf8a08494a8aa4a5a5eae677691c56b9748208b)
8
+ - Merge pull request #118 from maxx/master [view commit](http://github.com///commit/eadeaa992ad7f2b1e43d35843fdfdc2fda661e3d)
9
+ - allows an alternative to os.floating_ip :auto, called os.floating_ip :associate_unassigned. This pulls an unassigned IP address from an existing pool with pre-allocated IP's, and will not try to allocate a new IP. If an IP is not available, no floating IP is assigned. Relevant errors and documentation added as well [view commit](http://github.com///commit/adc708405c47c44ef60ccdc5df4d9f6f04cd5a1f)
10
+ - Fixes issue #100, where config.rb incorrectly handled floating_ip and floating_ip_pool configurations [view commit](http://github.com///commit/21f8532e726d21d75788dcd3d6cdd0ec84acc633)
11
+ - Merge pull request #107 from Chealion/handleEphemeralDisks [view commit](http://github.com///commit/338e0525397bd710e351cb7a6eadcb801b2255f6)
12
+ - Merge pull request #104 from cshaffer/upgrade_rsepc [view commit](http://github.com///commit/533c0ac004be755e973098c6589b4cf6b1fdc696)
13
+ - Add ability to handle swap and ephemeral disks to disks feature [view commit](http://github.com///commit/c4f7acea6e2d97d040184534403fee2262671176)
14
+ - Convert specs to RSpec 3.1.7 syntax with Transpec [view commit](http://github.com///commit/6115ccb73c8e28704bbe8efb5d079d35b1d0d844)
15
+ - Upgrade rspec to 3.1.0 [view commit](http://github.com///commit/c0dfe22fdd7c9d2e72c02187491acea7b9e1b013)
16
+ - Convert specs to RSpec 2.14.8 syntax with Transpec [view commit](http://github.com///commit/dd34a0eed957e190fec369f43514c8a5d4549833)
17
+ - Upgrade rspec to 2.14 first [view commit](http://github.com///commit/332c537e4f028bc8ab4ffd630c75a32ca93a681f)
18
+ - Removed debug printing [view commit](http://github.com///commit/59a8f024d090fff5ae28d30ef72a24d2f58044c3)
19
+ - Updated readme [view commit](http://github.com///commit/815f05d770f9991fa5e333ae24e15fde801643d7)
20
+ - IP address family match support [view commit](http://github.com///commit/5aa125c0e741496c60927cff9a413e942d9f2720)
21
+
3
22
  ## 0.11.1
4
23
 
5
24
  - Merge pull request #99 from jtopjian/master [view commit](http://github.com///commit/1c2667532e408f239761882a367c11d948610f37)
data/README.md CHANGED
@@ -66,6 +66,8 @@ Vagrant.configure("2") do |config|
66
66
  os.keypair_name = "YOUR KEYPAIR NAME" # as stored in Nova
67
67
  os.ssh_username = "SSH USERNAME" # login for the VM
68
68
 
69
+ os.ssh_ip_family = "ipv6" # IP address family
70
+
69
71
  os.metadata = {"key" => "value"} # optional
70
72
  os.user_data = "#cloud-config\nmanage_etc_hosts: True" # optional
71
73
  os.network = "YOUR NETWORK_NAME" # optional
@@ -77,8 +79,8 @@ Vagrant.configure("2") do |config|
77
79
  os.availability_zone = "az0001" # optional
78
80
  os.security_groups = ['ssh', 'http'] # optional
79
81
  os.tenant = "YOUR TENANT_NAME" # optional
80
- os.floating_ip = "33.33.33.33" # optional (The floating IP to assign for this instance, or set to :auto)
81
- os.floating_ip_pool = "public" # optional (The floating IP pool to allocate addresses from, if floating_ip = :auto)
82
+ os.floating_ip = "33.33.33.33" # optional (The floating IP to assign for this instance, or set to :auto or :associate_unassigned (ruby symbol, no quotes!))
83
+ os.floating_ip_pool = "public" # optional (The floating IP pool to allocate addresses to, if floating_ip = :auto, or the pool to pull the next available IP from if floating_ip = :associate_unassigned (ruby symbol, no quotes!))
82
84
 
83
85
  os.disks = [ # optional
84
86
  {"name" => "volume_name_here", "description" => "A 10GB Volume", "size" => 10},
@@ -89,7 +91,7 @@ Vagrant.configure("2") do |config|
89
91
  os.orchestration_cfn_template_file = '/tmp/cfn_heat_template.json' # optional
90
92
  os.orchestration_cfn_template_parameters = { # optional
91
93
  'NetworkName' => 'net_01'
92
- }
94
+ }
93
95
  end
94
96
  end
95
97
  ```
@@ -133,7 +135,9 @@ This provider exposes quite a few provider-specific configuration options:
133
135
  * `username` - The username with which to access OpenStack.
134
136
  * `keypair_name` - The name of the keypair to access the machine.
135
137
  * `ssh_username` - The username to access the machine. This can also be
136
- configured using the standard config.ssh.username configuration value.
138
+ configured using the standard config.ssh.username configuration value.
139
+ * `ssh_ip_family` - The IP address family to use for SSH connection. It could be `ipv6` or `ipv4`.
140
+ This option takes effect only if virtual machine have multiple addresses.
137
141
  * `metadata` - A set of key pair values that will be passed to the instance
138
142
  for configuration.
139
143
  * `network` - A name or id that will be used to fetch network configuration
@@ -141,8 +145,8 @@ This provider exposes quite a few provider-specific configuration options:
141
145
  vagrant network configurations.
142
146
  * `networks` - An array of names or ids to create a server with multiple network interfaces. This overrides the `network` setting.
143
147
  * `address_id` - A specific address identifier to use when connecting to the
144
- instance. `network` has higher precedence. If set to :floating_ip, then
145
- the floating IP address will be used.
148
+ instance. `network` has higher precedence. If set to :floating_ip, then
149
+ the floating IP address will be used.
146
150
  * `scheduler_hints` - Pass hints to the open stack scheduler, see `--hint` flag in [OpenStack filters doc](http://docs.openstack.org/trunk/openstack-compute/admin/content/scheduler-filters.html)
147
151
  * `availability_zone` - Specify the availability zone in which the instance
148
152
  must be created.
@@ -152,7 +156,7 @@ This provider exposes quite a few provider-specific configuration options:
152
156
  * `proxy` - HTTP proxy. When behind a firewall override this value for API access.
153
157
  * `ssl_verify_peer` - sets the ssl_verify_peer on the underlying excon connection - useful for self signed certs etc.
154
158
  * `floating_ip` - Floating ip. The floating IP to assign for this instance. If
155
- set to :auto, then this assigns any available floating IP to the instance.
159
+ set to :auto, then this assigns any available floating IP to the instance. If set to :associate_unassigned, then it will use the next IP address which is unasssigned in the pool specified in floating_ip_pool.
156
160
  * `floating_ip_pool` - Floating ip pool to allocate IP addresses from, if
157
161
  floating_ip is set to :auto. Previously allocated addresses will not be
158
162
  used, and addresses allocated here will be released when the VM is destroyed.
@@ -113,7 +113,7 @@ module VagrantPlugins
113
113
  server.wait_for(5) { ready? }
114
114
  # Once the server is up and running assign a floating IP if we have one
115
115
  floating_ip = config.floating_ip
116
- # try to automatically associate a floating IP
116
+ # try to automatically allocate and associate a floating IP
117
117
  if floating_ip && floating_ip.to_sym == :auto
118
118
  if config.floating_ip_pool
119
119
  env[:ui].info("Allocating floating IP address from pool: #{config.floating_ip_pool}")
@@ -125,7 +125,6 @@ module VagrantPlugins
125
125
  end
126
126
  else
127
127
  addresses = env[:openstack_compute].addresses
128
- puts addresses
129
128
  free_floating = addresses.find_index {|a| a.fixed_ip.nil?}
130
129
  if free_floating.nil?
131
130
  raise Errors::FloatingIPNotFound
@@ -134,9 +133,35 @@ module VagrantPlugins
134
133
  end
135
134
  end
136
135
  end
136
+
137
+ # try to automatically associate the next available unassigned ip in the given pool
138
+ if floating_ip && floating_ip.to_sym == :associate_unassigned
139
+ if config.floating_ip_pool
140
+ env[:ui].info("Associating floating IP address from pool: #{config.floating_ip_pool}")
141
+ addresses = env[:openstack_compute].addresses
142
+
143
+ # grab the next available IP in this pool which is not currently allocated:
144
+ address = env[:openstack_compute].addresses.find { |thisone|
145
+ (thisone.attributes[:pool].eql? config.floating_ip_pool and thisone.attributes[:instance_id].nil?)
146
+ }
147
+
148
+ if address.nil?
149
+ raise Errors::FloatingUnassignedIPNotFound
150
+ else
151
+ floating_ip = address.attributes[:ip]
152
+ end
153
+ result = env[:openstack_compute].associate_address(server.id,floating_ip)
154
+ if result[:status] != 202
155
+ raise Errors::FloatingIPFailedAssociate
156
+ else
157
+ env[:ui].info("Found and Associated floating IP address #{address.attributes[:ip]} from pool #{config.floating_ip_pool}")
158
+ end
159
+ else
160
+ raise Errors::FloatingUnassignedRequiresPool
161
+ end
162
+ end
137
163
 
138
164
  if floating_ip
139
- env[:ui].info( "Using floating IP #{floating_ip}")
140
165
  floater = env[:openstack_compute].addresses.find { |thisone| thisone.ip.eql? floating_ip }
141
166
  floater.server = server
142
167
  end
@@ -167,7 +192,16 @@ module VagrantPlugins
167
192
  # mount points are not expected to be meaningful
168
193
  # add useful support if your cloud respects them
169
194
  begin
170
- server.attach_volume(disk["volume_id"], "/dev/vd#{("a".."z").to_a[server.volume_attachments.length + 1]}")
195
+ # Assume instance has only one disk
196
+ nova_offset = 1
197
+ # Increase counter in case we have swap or ephemeral disks.
198
+ if flavor.swap != 0
199
+ nova_offset += 1
200
+ end
201
+ if flavor.ephemeral != 0
202
+ nova_offset += 1
203
+ end
204
+ server.attach_volume(disk["volume_id"], "/dev/vd#{("c".."z").to_a[server.volume_attachments.length + nova_offset]}")
171
205
  server.wait_for{ volume_attachments.any?{|vol| vol["id"]==disk["volume_id"]} }
172
206
  rescue Excon::Errors::Error => e
173
207
  raise Errors::VolumeBadState, :volume => disk["name"], :state => e.message
@@ -1,4 +1,5 @@
1
1
  require "log4r"
2
+ require "ipaddr"
2
3
 
3
4
  module VagrantPlugins
4
5
  module OpenStack
@@ -64,8 +65,19 @@ module VagrantPlugins
64
65
  end
65
66
  elsif server.private_ip_addresses.length > 0
66
67
  @logger.debug("Private IP addresses available: #{server.private_ip_addresses}")
67
- host = server.private_ip_address
68
- @logger.debug("Using the first available private IP address: #{host}.")
68
+ if config.ssh_ip_family.nil?
69
+ host = server.private_ip_address
70
+ @logger.debug("Using the first available private IP address: #{host}.")
71
+ else
72
+ for ip in server.private_ip_addresses
73
+ addr = IPAddr.new ip
74
+ if addr.send("#{config.ssh_ip_family}?".to_sym)
75
+ host = ip.to_s
76
+ @logger.debug("Using the first available #{config.ssh_ip_family} IP address: #{host}.")
77
+ break
78
+ end
79
+ end
80
+ end
69
81
  end
70
82
  end
71
83
 
@@ -68,6 +68,11 @@ module VagrantPlugins
68
68
  # @return [String]
69
69
  attr_accessor :ssh_username
70
70
 
71
+ # The IP address family that will be used to connect to the instance
72
+ #
73
+ # @return [String]
74
+ attr_accessor :ssh_ip_family
75
+
71
76
  # A Hash of metadata that will be sent to the instance for configuration
72
77
  #
73
78
  # @return [Hash]
@@ -137,6 +142,7 @@ module VagrantPlugins
137
142
  @availability_zone = UNSET_VALUE
138
143
  @security_groups = UNSET_VALUE
139
144
  @ssh_username = UNSET_VALUE
145
+ @ssh_ip_family = UNSET_VALUE
140
146
  @tenant = UNSET_VALUE
141
147
  @user_data = UNSET_VALUE
142
148
  @floating_ip = UNSET_VALUE
@@ -175,11 +181,12 @@ module VagrantPlugins
175
181
  # The SSH values by default are nil, and the top-level config
176
182
  # `config.ssh` values are used.
177
183
  @ssh_username = nil if @ssh_username == UNSET_VALUE
184
+ @ssh_ip_family = nil if @ssh_ip_family == UNSET_VALUE
178
185
 
179
186
  @tenant = nil if @tenant == UNSET_VALUE
180
187
  @user_data = "" if @user_data == UNSET_VALUE
181
188
  @floating_ip = nil if @floating_ip == UNSET_VALUE
182
- @floating_ip = nil if @floating_ip_pool == UNSET_VALUE
189
+ @floating_ip_pool = nil if @floating_ip_pool == UNSET_VALUE
183
190
 
184
191
  @disks = nil if @disks == UNSET_VALUE
185
192
 
@@ -43,6 +43,18 @@ module VagrantPlugins
43
43
  error_key(:floating_ip_not_allocated)
44
44
  end
45
45
 
46
+ class FloatingUnassignedIPNotFound < VagrantOpenStackError
47
+ error_key(:floating_unassigned_ip_not_found)
48
+ end
49
+
50
+ class FloatingIPFailedAssociate < VagrantOpenStackError
51
+ error_key(:floating_ip_failed_associate)
52
+ end
53
+
54
+ class FloatingUnassignedRequiresPool < VagrantOpenStackError
55
+ error_key(:floating_unassigned_requires_pool)
56
+ end
57
+
46
58
  class OrchestrationTemplateError < VagrantOpenStackError
47
59
  error_key(:orchestration_template_error)
48
60
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module OpenStack
3
- VERSION = '0.11.1'
3
+ VERSION = '0.12.0'
4
4
  end
5
5
  end
@@ -112,6 +112,12 @@ en:
112
112
  IPs were found in OpenStack
113
113
  floating_ip_not_allocated: |-
114
114
  A floating IP could not be allocated from the pool.
115
+ floating_unassigned_ip_not_found: |-
116
+ An unassigned floating IP could not be found in the specified pool.
117
+ floating_ip_failed_associate: |-
118
+ The selected IP failed to associate
119
+ floating_unassigned_requires_pool: |-
120
+ You must specifiy a pool in floating_ip_pool when using associate_unassigned
115
121
  orchestration_template_error: |-
116
122
  There was an error while reading orchestration template.
117
123
  Error: %{err}
@@ -10,21 +10,80 @@ describe VagrantPlugins::OpenStack::Config do
10
10
  end
11
11
  end
12
12
 
13
- its(:api_key) { should be_nil }
14
- its(:endpoint) { should be_nil }
15
- its(:flavor) { should eq(/m1.tiny/) }
16
- its(:image) { should eq(/cirros/) }
17
- its(:server_name) { should be_nil }
18
- its(:username) { should be_nil }
19
- its(:keypair_name) { should be_nil }
20
- its(:ssh_username) { should be_nil }
21
- its(:network) { should be_nil }
22
- its(:security_groups) { should be_nil }
23
- its(:scheduler_hints) { should be_nil }
24
- its(:tenant) { should be_nil }
25
- its(:proxy) { should be_nil }
26
- its(:disks) { should be_nil }
27
- its(:ssl_verify_peer) { should be_nil }
13
+ describe '#api_key' do
14
+ subject { super().api_key }
15
+ it { is_expected.to be_nil }
16
+ end
17
+
18
+ describe '#endpoint' do
19
+ subject { super().endpoint }
20
+ it { is_expected.to be_nil }
21
+ end
22
+
23
+ describe '#flavor' do
24
+ subject { super().flavor }
25
+ it { is_expected.to eq(/m1.tiny/) }
26
+ end
27
+
28
+ describe '#image' do
29
+ subject { super().image }
30
+ it { is_expected.to eq(/cirros/) }
31
+ end
32
+
33
+ describe '#server_name' do
34
+ subject { super().server_name }
35
+ it { is_expected.to be_nil }
36
+ end
37
+
38
+ describe '#username' do
39
+ subject { super().username }
40
+ it { is_expected.to be_nil }
41
+ end
42
+
43
+ describe '#keypair_name' do
44
+ subject { super().keypair_name }
45
+ it { is_expected.to be_nil }
46
+ end
47
+
48
+ describe '#ssh_username' do
49
+ subject { super().ssh_username }
50
+ it { is_expected.to be_nil }
51
+ end
52
+
53
+ describe '#network' do
54
+ subject { super().network }
55
+ it { is_expected.to be_nil }
56
+ end
57
+
58
+ describe '#security_groups' do
59
+ subject { super().security_groups }
60
+ it { is_expected.to be_nil }
61
+ end
62
+
63
+ describe '#scheduler_hints' do
64
+ subject { super().scheduler_hints }
65
+ it { is_expected.to be_nil }
66
+ end
67
+
68
+ describe '#tenant' do
69
+ subject { super().tenant }
70
+ it { is_expected.to be_nil }
71
+ end
72
+
73
+ describe '#proxy' do
74
+ subject { super().proxy }
75
+ it { is_expected.to be_nil }
76
+ end
77
+
78
+ describe '#disks' do
79
+ subject { super().disks }
80
+ it { is_expected.to be_nil }
81
+ end
82
+
83
+ describe '#ssl_verify_peer' do
84
+ subject { super().ssl_verify_peer }
85
+ it { is_expected.to be_nil }
86
+ end
28
87
  end
29
88
 
30
89
  describe "overriding defaults" do
@@ -45,13 +104,13 @@ describe VagrantPlugins::OpenStack::Config do
45
104
  it "should not default #{attribute} if overridden" do
46
105
  subject.send("#{attribute}=".to_sym, "foo")
47
106
  subject.finalize!
48
- subject.send(attribute).should == "foo"
107
+ expect(subject.send(attribute)).to eq("foo")
49
108
  end
50
109
  end
51
110
  it "should not default disks if overridden" do
52
111
  subject.send("disks=".to_sym, {"name" => "foo", "size" => 10, "description" => "bar"})
53
112
  subject.finalize!
54
- subject.send("disks").should == {"name" => "foo", "size" => 10, "description" => "bar"}
113
+ expect(subject.send("disks")).to eq({"name" => "foo", "size" => 10, "description" => "bar"})
55
114
  end
56
115
  end
57
116
 
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.add_runtime_dependency "fog", ">= 1.16.0"
16
16
 
17
17
  gem.add_development_dependency "rake"
18
- gem.add_development_dependency "rspec", "~> 2.13.0"
18
+ gem.add_development_dependency "rspec", "~> 3.1.0"
19
19
 
20
20
  gem.files = `git ls-files`.split($/)
21
21
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-openstack-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Haselwanter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-05 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.13.0
47
+ version: 3.1.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.13.0
54
+ version: 3.1.0
55
55
  description: Enables Vagrant to manage machines in OpenStack Cloud.
56
56
  email:
57
57
  - me@ehaselwanter.com
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.2.2
134
+ rubygems_version: 2.4.3
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Enables Vagrant to manage machines in OpenStack Cloud.