bosh_openstack_cpi 1.2739.0 → 1.2743.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee4017a97b49dc2f34ddd078fc99feaa345f6cc3
4
- data.tar.gz: 9e0d98ca439ee06d5dcb46482eaa6af6a7d9ad67
3
+ metadata.gz: 6a1bc8f7f331dd2ee6a73be9ef2941587e31f709
4
+ data.tar.gz: 08b4aa714a1ae17ced573d62f80c2cf5d9144ed1
5
5
  SHA512:
6
- metadata.gz: 17da6ca3cc2b06ba342604dea03121cf17ca00a00ce834fc606c06b369a6525b86815b4e42a85b2a65461fd97dca17c56465a1781650c324f1b87c2a937c7d08
7
- data.tar.gz: ae55d354e839c650c4d074e53221c4c789c361c12dcca851b4578837db969698a4e2e8ad44a87b7eb70dcb4822c84b6f54430d7378884e0500ee347c4c37f870
6
+ metadata.gz: cb86c810da3eebf9cd898d58f8d36f046a4cbf943bb031631e2f0faa122a23c53662c51847f582334f0bca07a1e7f37ac1a2d81bb6615359edc75b9c3bce7863
7
+ data.tar.gz: 6c0b429b35489c48f629bb85fed2d22e3a47f31458f97c4b2b4acb684814ab0ac7ded60c8a62dd9464d174d2f2bb47498472d1b815234838b1e037888a8ee4c5
@@ -371,7 +371,7 @@ module Bosh::OpenStackCloud
371
371
 
372
372
  compare_security_groups(server, network_configurator.security_groups(@default_security_groups))
373
373
 
374
- compare_private_ip_addresses(server, network_configurator.private_ip)
374
+ compare_private_ip_addresses(server, network_configurator.private_ips)
375
375
 
376
376
  network_configurator.configure(@openstack, server)
377
377
 
@@ -845,17 +845,17 @@ module Bosh::OpenStackCloud
845
845
  # Compares actual server private IP addresses with the IP address specified at the network spec
846
846
  #
847
847
  # @param [Fog::Compute::OpenStack::Server] server OpenStack server
848
- # @param [String] specified_ip_address IP address specified at the network spec (if Manual network)
848
+ # @param [Array] specified_ip_addresses IP addresses specified at the network spec (if Manual network)
849
849
  # @return [void]
850
850
  # @raise [Bosh::Clouds:NotSupported] If the IP address change, we need to recreate the VM as you can't
851
851
  # change the IP address of a running server, so we need to send the InstanceUpdater a request to do it for us
852
- def compare_private_ip_addresses(server, specified_ip_address)
852
+ def compare_private_ip_addresses(server, specified_ip_addresses)
853
853
  actual_ip_addresses = with_openstack { server.private_ip_addresses }
854
854
 
855
- unless specified_ip_address.nil? || actual_ip_addresses.include?(specified_ip_address)
855
+ unless specified_ip_addresses.empty? || actual_ip_addresses.sort == specified_ip_addresses.sort
856
856
  raise Bosh::Clouds::NotSupported,
857
857
  'IP address change requires VM recreation: %s to %s' %
858
- [actual_ip_addresses.join(', '), specified_ip_address]
858
+ [actual_ip_addresses.join(', '), specified_ip_addresses.join(', ')]
859
859
  end
860
860
  end
861
861
 
@@ -22,41 +22,55 @@ module Bosh::OpenStackCloud
22
22
  end
23
23
 
24
24
  @logger = Bosh::Clouds::Config.logger
25
- @network = nil
25
+ @networks = []
26
26
  @vip_network = nil
27
27
  @security_groups = []
28
- @net_id = nil
28
+ @net_ids = []
29
+ @dynamic_network = nil
29
30
 
30
31
  spec.each_pair do |name, network_spec|
31
- network_type = network_spec["type"] || "manual"
32
-
33
- case network_type
34
- when "dynamic"
35
- cloud_error("Must have exactly one dynamic or manual network per instance") if @network
36
- @network = DynamicNetwork.new(name, network_spec)
37
- @security_groups += extract_security_groups(network_spec)
38
- @net_id = extract_net_id(network_spec)
39
-
40
- when "manual"
41
- cloud_error("Must have exactly one dynamic or manual network per instance") if @network
42
- @network = ManualNetwork.new(name, network_spec)
43
- @security_groups += extract_security_groups(network_spec)
44
- @net_id = extract_net_id(network_spec)
45
- cloud_error("Manual network must have net_id") if @net_id.nil?
46
-
47
- when "vip"
48
- cloud_error("More than one vip network") if @vip_network
49
- @vip_network = VipNetwork.new(name, network_spec)
50
- @security_groups += extract_security_groups(network_spec)
51
-
52
- else
53
- cloud_error("Invalid network type `#{network_type}': OpenStack " \
54
- "CPI can only handle `dynamic', 'manual' or `vip' " \
55
- "network types")
56
- end
32
+ initialize_network(name, network_spec)
57
33
  end
58
34
 
59
- cloud_error("At least one dynamic or manual network should be defined") if @network.nil?
35
+ cloud_error("At least one dynamic or manual network should be defined") if @networks.empty?
36
+ end
37
+
38
+ ##
39
+ # Setup network configuration for one network spec.
40
+ #
41
+ # @param [String] network spec name
42
+ # @param [Hash] network spec
43
+ # configure
44
+ def initialize_network(name, network_spec)
45
+ network_type = network_spec["type"] || "manual"
46
+
47
+ case network_type
48
+ when "dynamic"
49
+ cloud_error("Only one dynamic network per instance should be defined") if @dynamic_network
50
+ net_id = extract_net_id(network_spec)
51
+ cloud_error("Dynamic network with id #{net_id} is already defined") if @net_ids.include?(net_id)
52
+ network = DynamicNetwork.new(name, network_spec)
53
+ @security_groups += extract_security_groups(network_spec)
54
+ @networks << {"network" => network, "net_id" => net_id}
55
+ @net_ids << net_id
56
+ @dynamic_network = network
57
+ when "manual"
58
+ net_id = extract_net_id(network_spec)
59
+ cloud_error("Manual network must have net_id") if net_id.nil?
60
+ cloud_error("Manual network with id #{net_id} is already defined") if @net_ids.include?(net_id)
61
+ network = ManualNetwork.new(name, network_spec)
62
+ @security_groups += extract_security_groups(network_spec)
63
+ @networks << {"network" => network, "net_id" => net_id}
64
+ @net_ids << net_id
65
+ when "vip"
66
+ cloud_error("Only one VIP network per instance should be defined") if @vip_network
67
+ @vip_network = VipNetwork.new(name, network_spec)
68
+ @security_groups += extract_security_groups(network_spec)
69
+ else
70
+ cloud_error("Invalid network type `#{network_type}': OpenStack " \
71
+ "CPI can only handle `dynamic', 'manual' or `vip' " \
72
+ "network types")
73
+ end
60
74
  end
61
75
 
62
76
  ##
@@ -66,7 +80,10 @@ module Bosh::OpenStackCloud
66
80
  # @param [Fog::Compute::OpenStack::Server] server OpenStack server to
67
81
  # configure
68
82
  def configure(openstack, server)
69
- @network.configure(openstack, server)
83
+ @networks.each do |network_info|
84
+ network = network_info["network"]
85
+ network.configure(openstack, server)
86
+ end
70
87
 
71
88
  if @vip_network
72
89
  @vip_network.configure(openstack, server)
@@ -102,11 +119,15 @@ module Bosh::OpenStackCloud
102
119
  end
103
120
 
104
121
  ##
105
- # Returns the private IP address for this network configuration
122
+ # Returns the private IP addresses for this network configuration
106
123
  #
107
- # @return [String] private ip address
108
- def private_ip
109
- @network.is_a?(ManualNetwork) ? @network.private_ip : nil
124
+ # @return [Array<String>] private ip addresses
125
+ def private_ips
126
+ @networks.inject([]) do |memo, network_info|
127
+ network = network_info["network"]
128
+ memo << network.private_ip if network.is_a?(ManualNetwork)
129
+ memo
130
+ end
110
131
  end
111
132
 
112
133
  ##
@@ -114,10 +135,15 @@ module Bosh::OpenStackCloud
114
135
  #
115
136
  # @return [Array] nics
116
137
  def nics
117
- nic = {}
118
- nic["net_id"] = @net_id if @net_id
119
- nic["v4_fixed_ip"] = @network.private_ip if @network.is_a? ManualNetwork
120
- nic.any? ? [nic] : []
138
+ @networks.inject([]) do |memo, network_info|
139
+ net_id = network_info["net_id"]
140
+ network = network_info["network"]
141
+ nic = {}
142
+ nic["net_id"] = net_id if net_id
143
+ nic["v4_fixed_ip"] = network.private_ip if network.is_a?(ManualNetwork)
144
+ memo << nic if nic.any?
145
+ memo
146
+ end
121
147
  end
122
148
 
123
149
  private
@@ -157,4 +183,4 @@ module Bosh::OpenStackCloud
157
183
  end
158
184
 
159
185
  end
160
- end
186
+ end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Bosh
5
5
  module OpenStackCloud
6
- VERSION = '1.2739.0'
6
+ VERSION = '1.2743.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_openstack_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2739.0
4
+ version: 1.2743.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piston Cloud Computing / VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-09 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2739.0
33
+ version: 1.2743.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2739.0
40
+ version: 1.2743.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bosh_cpi
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2739.0
47
+ version: 1.2743.0
48
48
  type: :runtime
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: 1.2739.0
54
+ version: 1.2743.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bosh-registry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2739.0
61
+ version: 1.2743.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.2739.0
68
+ version: 1.2743.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: httpclient
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,17 +100,17 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.0.2
103
+ version: 1.1.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.0.2
110
+ version: 1.1.0
111
111
  description: |-
112
112
  BOSH OpenStack CPI
113
- 0d77bd
113
+ 01851c
114
114
  email: support@cloudfoundry.com
115
115
  executables:
116
116
  - bosh_openstack_console