vagrant-openstack-plugin 0.8.0 → 0.9.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +4 -0
- data/lib/vagrant-openstack-plugin/action/connect_openstack.rb +1 -1
- data/lib/vagrant-openstack-plugin/action/create_network_interfaces.rb +52 -0
- data/lib/vagrant-openstack-plugin/action/create_server.rb +36 -10
- data/lib/vagrant-openstack-plugin/action/delete_server.rb +10 -1
- data/lib/vagrant-openstack-plugin/action/sync_folders.rb +12 -1
- data/lib/vagrant-openstack-plugin/action.rb +2 -1
- data/lib/vagrant-openstack-plugin/config.rb +7 -0
- data/lib/vagrant-openstack-plugin/errors.rb +4 -0
- data/lib/vagrant-openstack-plugin/version.rb +1 -1
- data/locales/en.yml +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 185cf5b53b90cdb94e096aa21dabfc5cd4ed5f35
|
|
4
|
+
data.tar.gz: 462aa860376af1b3ab089eff34a63aa7dc2b4021
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 508389f7abc296939c73d4f7f52bbc4f079ed4cec7bc9ffe157c0e01e5632eff70a456dfe9c3a47cf12480340821d33c292ac5dbf6f818ce0bb3042c696a8bbc
|
|
7
|
+
data.tar.gz: 8ab048e2dcdb4e2e2cb420715024089d0ff0cb02ebdb345d123810eba60e3975e8edc0fa3b5db1880b22f99ec67fe7bcaba0d9625c13c6cab612aea0d2e63827
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog for vagrant-openstack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
- Merge pull request #80 from hawknewton/network_fix [view commit](http://github.com///commit/542e7a2e077d624df9cb56a53c24cf3450e11c71)
|
|
6
|
+
- Merge pull request #86 from ipoddar-ibm/master [view commit](http://github.com///commit/11fccb73264aa852df88825936026a9da4771580)
|
|
7
|
+
- Merge pull request #88 from chino/fix-rsync-identify-file-options [view commit](http://github.com///commit/9319af5216c8c65ba144154ddfba2c1d767c567d)
|
|
8
|
+
- Merge pull request #87 from arbrandes/master [view commit](http://github.com///commit/49839de94e1865eb88a25d5876f1698e2069a0be)
|
|
9
|
+
- sync_folders: should have space between ssh-i options [view commit](http://github.com///commit/07325bfe4c782043d7ecec32a64fa516344cebf8)
|
|
10
|
+
- Allocate IPs automatically [view commit](http://github.com///commit/84c311544d00286fc2c910f9147892e5ae6c0a5b)
|
|
11
|
+
- Adds support for static IPs and interface config [view commit](http://github.com///commit/a5fdb22e23687c9bcd540b37b65b8d478d3a5d94)
|
|
12
|
+
- remove extra line [view commit](http://github.com///commit/010e347acf403d6426fffac5ec01cb999dd9545f)
|
|
13
|
+
- fix typo [view commit](http://github.com///commit/08dda991121f7e2e2f5bb8f32e03432f69aec226)
|
|
14
|
+
- support cygwin [view commit](http://github.com///commit/62c2184906e444c22933d34b8b9054fca56df54f)
|
|
15
|
+
- Connect to openstack network resource when needed [view commit](http://github.com///commit/8515a9305f354963d8687077e203a35c902035ce)
|
|
16
|
+
|
|
3
17
|
## 0.8.0
|
|
4
18
|
|
|
5
19
|
- Merge pull request #67 from pradels/master [view commit](http://github.com///commit/15f5b5531622376df952bccc0512a6de50d7a92f)
|
data/README.md
CHANGED
|
@@ -77,6 +77,7 @@ Vagrant.configure("2") do |config|
|
|
|
77
77
|
os.security_groups = ['ssh', 'http'] # optional
|
|
78
78
|
os.tenant = "YOUR TENANT_NAME" # optional
|
|
79
79
|
os.floating_ip = "33.33.33.33" # optional (The floating IP to assign for this instance)
|
|
80
|
+
os.floating_ip_pool = "public" # optional (The floating IP pool to allocate addresses from, if floating_ip = :auto)
|
|
80
81
|
|
|
81
82
|
os.orchestration_stack_name = 'stack01' # optional
|
|
82
83
|
os.orchestration_cfn_template_file = '/tmp/cfn_heat_template.json' # optional
|
|
@@ -146,6 +147,9 @@ This provider exposes quite a few provider-specific configuration options:
|
|
|
146
147
|
* `ssl_verify_peer` - sets the ssl_verify_peer on the underlying excon connection - useful for self signed certs etc.
|
|
147
148
|
* `floating_ip` - Floating ip. The floating IP to assign for this instance. If
|
|
148
149
|
set to :auto, then this assigns any available floating IP to the instance.
|
|
150
|
+
* `floating_ip_pool` - Floating ip pool to allocate IP addresses from, if
|
|
151
|
+
floating_ip is set to :auto. Previously allocated addresses will not be
|
|
152
|
+
used, and addresses allocated here will be released when the VM is destroyed.
|
|
149
153
|
* `orchestration_stack_name` - Name for orchestration stack. Mandatory
|
|
150
154
|
parameter when creating new stack. One of parameters for template should be
|
|
151
155
|
set with this parameter.
|
|
@@ -46,7 +46,7 @@ module VagrantPlugins
|
|
|
46
46
|
env[:openstack_compute] = Fog::Compute.new(
|
|
47
47
|
env[:fog_openstack_params])
|
|
48
48
|
|
|
49
|
-
if config.networks && !config.networks.empty?
|
|
49
|
+
if config.network || (config.networks && !config.networks.empty?)
|
|
50
50
|
env[:openstack_network] = Fog::Network.new({
|
|
51
51
|
:provider => :openstack,
|
|
52
52
|
:connection_options => connection_options,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require "log4r"
|
|
2
|
+
|
|
3
|
+
require 'vagrant/util/scoped_hash_override'
|
|
4
|
+
|
|
5
|
+
module VagrantPlugins
|
|
6
|
+
module OpenStack
|
|
7
|
+
module Action
|
|
8
|
+
class CreateNetworkInterfaces
|
|
9
|
+
include Vagrant::Util::ScopedHashOverride
|
|
10
|
+
|
|
11
|
+
def initialize(app, env)
|
|
12
|
+
@app = app
|
|
13
|
+
@logger = Log4r::Logger.new("vagrant_openstack::action::create_network_interfaces")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call(env)
|
|
17
|
+
networks_to_configure = []
|
|
18
|
+
env[:machine].config.vm.networks.each_with_index do |network, slot_number|
|
|
19
|
+
type = network[0]
|
|
20
|
+
original_options = network[1]
|
|
21
|
+
next if type != :private_network
|
|
22
|
+
next if original_options[:auto_config] === false
|
|
23
|
+
next if slot_number == 0
|
|
24
|
+
|
|
25
|
+
options = scoped_hash_override(original_options, :openstack)
|
|
26
|
+
|
|
27
|
+
@logger.info "Configuring interface slot_number #{slot_number} options #{options}"
|
|
28
|
+
|
|
29
|
+
network_to_configure = {
|
|
30
|
+
:interface => slot_number,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if options[:ip]
|
|
34
|
+
network_to_configure = {
|
|
35
|
+
:type => :static,
|
|
36
|
+
:ip => options[:ip],
|
|
37
|
+
:netmask => "255.255.255.0",
|
|
38
|
+
}.merge(network_to_configure)
|
|
39
|
+
else
|
|
40
|
+
network_to_configure[:type] = :dhcp
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
networks_to_configure.push(network_to_configure)
|
|
44
|
+
end
|
|
45
|
+
env[:ui].info I18n.t('vagrant.actions.vm.network.configuring')
|
|
46
|
+
env[:machine].guest.capability(:configure_networks, networks_to_configure)
|
|
47
|
+
@app.call(env)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -58,9 +58,24 @@ module VagrantPlugins
|
|
|
58
58
|
unless config.networks.empty?
|
|
59
59
|
env[:ui].info(I18n.t("vagrant_openstack.finding_network"))
|
|
60
60
|
options[:nics] = Array.new
|
|
61
|
-
config.networks.
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
config.networks.each_with_index do |os_network_name, i|
|
|
62
|
+
|
|
63
|
+
# Use the configured OpenStack network, if it exists.
|
|
64
|
+
os_network = find_matching(env[:openstack_network].networks, os_network_name)
|
|
65
|
+
if os_network
|
|
66
|
+
current = { :net_id => os_network.id }
|
|
67
|
+
|
|
68
|
+
# Match the OpenStack network to a corresponding
|
|
69
|
+
# config.vm.network option. If there is one, use that for its
|
|
70
|
+
# IP address.
|
|
71
|
+
config_network = env[:machine].config.vm.networks[i]
|
|
72
|
+
if config_network
|
|
73
|
+
ip_address = config_network[1][:ip]
|
|
74
|
+
current[:v4_fixed_ip] = ip_address if ip_address
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
options[:nics] << current
|
|
78
|
+
end
|
|
64
79
|
end
|
|
65
80
|
env[:ui].info("options[:nics]: #{options[:nics]}")
|
|
66
81
|
end
|
|
@@ -98,15 +113,26 @@ module VagrantPlugins
|
|
|
98
113
|
server.wait_for(5) { ready? }
|
|
99
114
|
# Once the server is up and running assign a floating IP if we have one
|
|
100
115
|
floating_ip = config.floating_ip
|
|
101
|
-
# try to automatically
|
|
116
|
+
# try to automatically associate a floating IP
|
|
102
117
|
if floating_ip && floating_ip.to_sym == :auto
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
118
|
+
if config.floating_ip_pool
|
|
119
|
+
env[:ui].info("Allocating floating IP address from pool: #{config.floating_ip_pool}")
|
|
120
|
+
address = env[:openstack_compute].allocate_address(config.floating_ip_pool).body["floating_ip"]
|
|
121
|
+
if address["ip"].nil?
|
|
122
|
+
raise Errors::FloatingIPNotAllocated
|
|
123
|
+
else
|
|
124
|
+
floating_ip = address["ip"]
|
|
125
|
+
end
|
|
126
|
+
else
|
|
127
|
+
addresses = env[:openstack_compute].addresses
|
|
128
|
+
puts addresses
|
|
129
|
+
free_floating = addresses.find_index {|a| a.fixed_ip.nil?}
|
|
130
|
+
if free_floating.nil?
|
|
131
|
+
raise Errors::FloatingIPNotFound
|
|
132
|
+
else
|
|
133
|
+
floating_ip = addresses[free_floating].ip
|
|
134
|
+
end
|
|
108
135
|
end
|
|
109
|
-
floating_ip = addresses[free_floating].ip
|
|
110
136
|
end
|
|
111
137
|
|
|
112
138
|
if floating_ip
|
|
@@ -19,7 +19,16 @@ module VagrantPlugins
|
|
|
19
19
|
|
|
20
20
|
# TODO: Validate the fact that we get a server back from the API.
|
|
21
21
|
server = env[:openstack_compute].servers.get(id)
|
|
22
|
-
server
|
|
22
|
+
if server
|
|
23
|
+
ip = server.floating_ip_address
|
|
24
|
+
server.destroy
|
|
25
|
+
if machine.provider_config.floating_ip_pool
|
|
26
|
+
address = env[:openstack_compute].list_all_addresses.body["floating_ips"].find{|i| i["ip"] == ip}
|
|
27
|
+
if address
|
|
28
|
+
env[:openstack_compute].release_address(address["id"])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
23
32
|
end
|
|
24
33
|
|
|
25
34
|
@app.call(env)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "log4r"
|
|
2
2
|
|
|
3
3
|
require "vagrant/util/subprocess"
|
|
4
|
+
require "vagrant/util/which"
|
|
4
5
|
|
|
5
6
|
module VagrantPlugins
|
|
6
7
|
module OpenStack
|
|
@@ -25,7 +26,17 @@ module VagrantPlugins
|
|
|
25
26
|
next
|
|
26
27
|
end
|
|
27
28
|
|
|
29
|
+
unless Vagrant::Util::Which.which('rsync')
|
|
30
|
+
@logger.info "please install rsync first"
|
|
31
|
+
break
|
|
32
|
+
end
|
|
33
|
+
|
|
28
34
|
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
|
35
|
+
#rsync interprets paths with colons as remote locations.
|
|
36
|
+
# "cygdrive" path for cygwin on windows.
|
|
37
|
+
if Vagrant::Util::Platform.windows?
|
|
38
|
+
hostpath = Vagrant::Util::Subprocess.execute("cygpath", "-u", "-a", hostpath).stdout.chomp
|
|
39
|
+
end
|
|
29
40
|
guestpath = data[:guestpath]
|
|
30
41
|
|
|
31
42
|
# Make sure there is a trailing slash on the host path to
|
|
@@ -85,7 +96,7 @@ module VagrantPlugins
|
|
|
85
96
|
|
|
86
97
|
def ssh_key_options(ssh_info)
|
|
87
98
|
# Ensure that `private_key_path` is an Array (for Vagrant < 1.4)
|
|
88
|
-
Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}'" }
|
|
99
|
+
Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }
|
|
89
100
|
end
|
|
90
101
|
end
|
|
91
102
|
end
|
|
@@ -79,7 +79,6 @@ module VagrantPlugins
|
|
|
79
79
|
Vagrant::Action::Builder.new.tap do |b|
|
|
80
80
|
b.use Provision
|
|
81
81
|
b.use SyncFolders
|
|
82
|
-
b.use WarnNetworks
|
|
83
82
|
b.use SetHostname
|
|
84
83
|
end
|
|
85
84
|
end
|
|
@@ -95,6 +94,7 @@ module VagrantPlugins
|
|
|
95
94
|
b1.use ConnectOpenStack
|
|
96
95
|
b1.use CreateOrchestrationStack
|
|
97
96
|
b1.use CreateServer
|
|
97
|
+
b1.use CreateNetworkInterfaces
|
|
98
98
|
else
|
|
99
99
|
b1.use action_resume
|
|
100
100
|
end
|
|
@@ -230,6 +230,7 @@ module VagrantPlugins
|
|
|
230
230
|
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
|
231
231
|
autoload :ConnectOpenStack, action_root.join("connect_openstack")
|
|
232
232
|
autoload :CreateServer, action_root.join("create_server")
|
|
233
|
+
autoload :CreateNetworkInterfaces, action_root.join("create_network_interfaces")
|
|
233
234
|
autoload :DeleteServer, action_root.join("delete_server")
|
|
234
235
|
autoload :HardRebootServer, action_root.join("hard_reboot_server")
|
|
235
236
|
autoload :IsCreated, action_root.join("is_created")
|
|
@@ -89,6 +89,11 @@ module VagrantPlugins
|
|
|
89
89
|
# @return [String]
|
|
90
90
|
attr_accessor :floating_ip
|
|
91
91
|
|
|
92
|
+
# The floating IP pool from which IP addresses can be allocated
|
|
93
|
+
#
|
|
94
|
+
# @return [String]
|
|
95
|
+
attr_accessor :floating_ip_pool
|
|
96
|
+
|
|
92
97
|
# The region to specify when the OpenStack cloud has multiple regions
|
|
93
98
|
#
|
|
94
99
|
# @return [String]
|
|
@@ -130,6 +135,7 @@ module VagrantPlugins
|
|
|
130
135
|
@tenant = UNSET_VALUE
|
|
131
136
|
@user_data = UNSET_VALUE
|
|
132
137
|
@floating_ip = UNSET_VALUE
|
|
138
|
+
@floating_ip_pool = UNSET_VALUE
|
|
133
139
|
@region = UNSET_VALUE
|
|
134
140
|
@proxy = UNSET_VALUE
|
|
135
141
|
@ssl_verify_peer = UNSET_VALUE
|
|
@@ -167,6 +173,7 @@ module VagrantPlugins
|
|
|
167
173
|
@tenant = nil if @tenant == UNSET_VALUE
|
|
168
174
|
@user_data = "" if @user_data == UNSET_VALUE
|
|
169
175
|
@floating_ip = nil if @floating_ip == UNSET_VALUE
|
|
176
|
+
@floating_ip = nil if @floating_ip_pool == UNSET_VALUE
|
|
170
177
|
|
|
171
178
|
@region = nil if @region == UNSET_VALUE
|
|
172
179
|
@proxy = nil if @proxy == UNSET_VALUE
|
|
@@ -35,6 +35,10 @@ module VagrantPlugins
|
|
|
35
35
|
error_key(:floating_ip_not_found)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
class FloatingIPNotAllocated < VagrantOpenStackError
|
|
39
|
+
error_key(:floating_ip_not_allocated)
|
|
40
|
+
end
|
|
41
|
+
|
|
38
42
|
class OrchestrationTemplateError < VagrantOpenStackError
|
|
39
43
|
error_key(:orchestration_template_error)
|
|
40
44
|
end
|
data/locales/en.yml
CHANGED
|
@@ -93,6 +93,8 @@ en:
|
|
|
93
93
|
floating_ip_not_found: |-
|
|
94
94
|
A floating IP could not be allocated, as no available floating
|
|
95
95
|
IPs were found in OpenStack
|
|
96
|
+
floating_ip_not_allocated: |-
|
|
97
|
+
A floating IP could not be allocated from the pool.
|
|
96
98
|
orchestration_template_error: |-
|
|
97
99
|
There was an error while reading orchestration template.
|
|
98
100
|
Error: %{err}
|
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.
|
|
4
|
+
version: 0.9.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-
|
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fog
|
|
@@ -73,6 +73,7 @@ files:
|
|
|
73
73
|
- lib/vagrant-openstack-plugin.rb
|
|
74
74
|
- lib/vagrant-openstack-plugin/action.rb
|
|
75
75
|
- lib/vagrant-openstack-plugin/action/connect_openstack.rb
|
|
76
|
+
- lib/vagrant-openstack-plugin/action/create_network_interfaces.rb
|
|
76
77
|
- lib/vagrant-openstack-plugin/action/create_orchestration_stack.rb
|
|
77
78
|
- lib/vagrant-openstack-plugin/action/create_server.rb
|
|
78
79
|
- lib/vagrant-openstack-plugin/action/delete_orchestration_stack.rb
|