bosh_openstack_cpi 1.3016.0 → 1.3022.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/lib/cloud/openstack/cloud.rb +45 -18
- data/lib/cloud/openstack/helpers.rb +16 -4
- data/lib/cloud/openstack/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fce52580bbf8ebe362d5ac6a5bd24d265c61604e
|
|
4
|
+
data.tar.gz: 20678c5e476b29b4f0f934530e3cdf5455d69f52
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0426193fa3cd30fb97e79293bae060a73a31989faaad498e5bc105f8f91354d739edf1ae0711d6dc8127b8f9b847466385f4d8bbbb178e0d154b42db114edc48
|
|
7
|
+
data.tar.gz: f0efe00cb7da5a25493be3ee4d27789346f2c4edac5899f95fedda0661b12528efb3be6b8230699421175f78f939344ee6aec9f19a2b675beb764417a9e8a178
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
# Copyright (c) 2012 Piston Cloud Computing, Inc.
|
|
1
|
+
require 'common/common'
|
|
3
2
|
|
|
4
3
|
module Bosh::OpenStackCloud
|
|
5
4
|
##
|
|
@@ -7,11 +6,14 @@ module Bosh::OpenStackCloud
|
|
|
7
6
|
class Cloud < Bosh::Cloud
|
|
8
7
|
include Helpers
|
|
9
8
|
|
|
10
|
-
OPTION_KEYS = ['openstack', 'registry', 'agent']
|
|
9
|
+
OPTION_KEYS = ['openstack', 'registry', 'agent', 'use_dhcp']
|
|
11
10
|
|
|
12
11
|
BOSH_APP_DIR = '/var/vcap/bosh'
|
|
13
12
|
FIRST_DEVICE_NAME_LETTER = 'b'
|
|
14
13
|
|
|
14
|
+
CONNECT_RETRY_DELAY = 1
|
|
15
|
+
CONNECT_RETRY_COUNT = 5
|
|
16
|
+
|
|
15
17
|
attr_reader :openstack
|
|
16
18
|
attr_reader :registry
|
|
17
19
|
attr_reader :glance
|
|
@@ -44,6 +46,7 @@ module Bosh::OpenStackCloud
|
|
|
44
46
|
@wait_resource_poll_interval = @openstack_properties["wait_resource_poll_interval"]
|
|
45
47
|
@boot_from_volume = @openstack_properties["boot_from_volume"]
|
|
46
48
|
@boot_volume_cloud_properties = @openstack_properties["boot_volume_cloud_properties"] || {}
|
|
49
|
+
@use_dhcp = @openstack_properties.fetch('use_dhcp', true)
|
|
47
50
|
|
|
48
51
|
unless @openstack_properties['auth_url'].match(/\/tokens$/)
|
|
49
52
|
@openstack_properties['auth_url'] = @openstack_properties['auth_url'] + '/tokens'
|
|
@@ -63,10 +66,21 @@ module Bosh::OpenStackCloud
|
|
|
63
66
|
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
|
64
67
|
:connection_options => @openstack_properties['connection_options'].merge(extra_connection_options)
|
|
65
68
|
}
|
|
69
|
+
|
|
70
|
+
connect_retry_errors = [Excon::Errors::GatewayTimeout]
|
|
71
|
+
|
|
72
|
+
connect_retry_options = {
|
|
73
|
+
sleep: CONNECT_RETRY_DELAY,
|
|
74
|
+
tries: CONNECT_RETRY_COUNT,
|
|
75
|
+
on: connect_retry_errors,
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
begin
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
Bosh::Common.retryable(connect_retry_options) do |tries, error|
|
|
80
|
+
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
|
81
|
+
@openstack = Fog::Compute.new(openstack_params)
|
|
82
|
+
end
|
|
83
|
+
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError
|
|
70
84
|
cloud_error('Unable to connect to the OpenStack Compute API. Check task debug log for details.')
|
|
71
85
|
end
|
|
72
86
|
|
|
@@ -84,10 +98,13 @@ module Bosh::OpenStackCloud
|
|
|
84
98
|
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
|
85
99
|
:connection_options => @openstack_properties['connection_options'].merge(extra_connection_options)
|
|
86
100
|
}
|
|
101
|
+
|
|
87
102
|
begin
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
Bosh::Common.retryable(connect_retry_options) do |tries, error|
|
|
104
|
+
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
|
105
|
+
@glance = Fog::Image.new(glance_params)
|
|
106
|
+
end
|
|
107
|
+
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError
|
|
91
108
|
cloud_error('Unable to connect to the OpenStack Image Service API. Check task debug log for details.')
|
|
92
109
|
end
|
|
93
110
|
|
|
@@ -101,11 +118,14 @@ module Bosh::OpenStackCloud
|
|
|
101
118
|
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
|
102
119
|
:connection_options => @openstack_properties['connection_options'].merge(extra_connection_options)
|
|
103
120
|
}
|
|
121
|
+
|
|
104
122
|
begin
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
123
|
+
Bosh::Common.retryable(connect_retry_options) do |tries, error|
|
|
124
|
+
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
|
125
|
+
@volume = Fog::Volume.new(volume_params)
|
|
126
|
+
end
|
|
127
|
+
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError
|
|
128
|
+
cloud_error('Unable to connect to the OpenStack Volume API. Check task debug log for details.')
|
|
109
129
|
end
|
|
110
130
|
|
|
111
131
|
@metadata_lock = Mutex.new
|
|
@@ -300,7 +320,7 @@ module Bosh::OpenStackCloud
|
|
|
300
320
|
|
|
301
321
|
@logger.info("Configuring network for server `#{server.id}'...")
|
|
302
322
|
network_configurator.configure(@openstack, server)
|
|
303
|
-
rescue
|
|
323
|
+
rescue => e
|
|
304
324
|
@logger.warn("Failed to create server: #{e.message}")
|
|
305
325
|
destroy_server(server)
|
|
306
326
|
raise Bosh::Clouds::VMCreationFailed.new(true), e.message
|
|
@@ -311,7 +331,7 @@ module Bosh::OpenStackCloud
|
|
|
311
331
|
settings = initial_agent_settings(server_name, agent_id, network_spec, environment,
|
|
312
332
|
flavor_has_ephemeral_disk?(flavor))
|
|
313
333
|
@registry.update_settings(server.name, settings)
|
|
314
|
-
rescue
|
|
334
|
+
rescue => e
|
|
315
335
|
@logger.warn("Failed to register server: #{e.message}")
|
|
316
336
|
destroy_server(server)
|
|
317
337
|
raise Bosh::Clouds::VMCreationFailed.new(false), e.message
|
|
@@ -391,7 +411,7 @@ module Bosh::OpenStackCloud
|
|
|
391
411
|
network_configurator.configure(@openstack, server)
|
|
392
412
|
|
|
393
413
|
update_agent_settings(server) do |settings|
|
|
394
|
-
settings['networks'] = network_spec
|
|
414
|
+
settings['networks'] = agent_network_spec(network_spec)
|
|
395
415
|
end
|
|
396
416
|
end
|
|
397
417
|
end
|
|
@@ -656,7 +676,7 @@ module Bosh::OpenStackCloud
|
|
|
656
676
|
data['registry'] = { 'endpoint' => @registry.endpoint }
|
|
657
677
|
data['server'] = { 'name' => server_name }
|
|
658
678
|
data['openssh'] = { 'public_key' => public_key } if public_key
|
|
659
|
-
data['networks'] = network_spec
|
|
679
|
+
data['networks'] = agent_network_spec(network_spec)
|
|
660
680
|
|
|
661
681
|
with_dns(network_spec) do |servers|
|
|
662
682
|
data['dns'] = { 'nameserver' => servers }
|
|
@@ -701,7 +721,7 @@ module Bosh::OpenStackCloud
|
|
|
701
721
|
'name' => server_name
|
|
702
722
|
},
|
|
703
723
|
'agent_id' => agent_id,
|
|
704
|
-
'networks' => network_spec,
|
|
724
|
+
'networks' => agent_network_spec(network_spec),
|
|
705
725
|
'disks' => {
|
|
706
726
|
'system' => '/dev/sda',
|
|
707
727
|
'persistent' => {}
|
|
@@ -713,6 +733,13 @@ module Bosh::OpenStackCloud
|
|
|
713
733
|
settings.merge(@agent_properties)
|
|
714
734
|
end
|
|
715
735
|
|
|
736
|
+
def agent_network_spec(network_spec)
|
|
737
|
+
Hash[*network_spec.map do |name, settings|
|
|
738
|
+
settings['use_dhcp'] = @use_dhcp
|
|
739
|
+
[name, settings]
|
|
740
|
+
end.flatten]
|
|
741
|
+
end
|
|
742
|
+
|
|
716
743
|
##
|
|
717
744
|
# Updates the agent settings
|
|
718
745
|
#
|
|
@@ -24,6 +24,7 @@ module Bosh::OpenStackCloud
|
|
|
24
24
|
retries = 0
|
|
25
25
|
begin
|
|
26
26
|
yield
|
|
27
|
+
|
|
27
28
|
rescue Excon::Errors::RequestEntityTooLarge => e
|
|
28
29
|
# If we find a rate limit error, parse message, wait, and retry
|
|
29
30
|
overlimit = parse_openstack_response(e.response, "overLimit", "overLimitFault")
|
|
@@ -37,10 +38,21 @@ module Bosh::OpenStackCloud
|
|
|
37
38
|
retry
|
|
38
39
|
end
|
|
39
40
|
cloud_error("OpenStack API Request Entity Too Large error. Check task debug log for details.", e)
|
|
41
|
+
|
|
42
|
+
rescue Excon::Errors::ServiceUnavailable => e
|
|
43
|
+
unless retries >= MAX_RETRIES
|
|
44
|
+
retries += 1
|
|
45
|
+
@logger.debug("OpenStack API Service Unavailable error, retrying (#{retries})") if @logger
|
|
46
|
+
sleep(DEFAULT_RETRY_TIMEOUT)
|
|
47
|
+
retry
|
|
48
|
+
end
|
|
49
|
+
cloud_error("OpenStack API Service Unavailable error. Check task debug log for details.", e)
|
|
50
|
+
|
|
40
51
|
rescue Excon::Errors::BadRequest => e
|
|
41
52
|
badrequest = parse_openstack_response(e.response, "badRequest")
|
|
42
|
-
details = badrequest.nil? ? "" : " (#{badrequest["message"]})"
|
|
53
|
+
details = badrequest.nil? ? "" : " (#{badrequest["message"]})"
|
|
43
54
|
cloud_error("OpenStack API Bad Request#{details}. Check task debug log for details.", e)
|
|
55
|
+
|
|
44
56
|
rescue Excon::Errors::InternalServerError => e
|
|
45
57
|
unless retries >= MAX_RETRIES
|
|
46
58
|
retries += 1
|
|
@@ -51,9 +63,9 @@ module Bosh::OpenStackCloud
|
|
|
51
63
|
cloud_error("OpenStack API Internal Server error. Check task debug log for details.", e)
|
|
52
64
|
end
|
|
53
65
|
end
|
|
54
|
-
|
|
66
|
+
|
|
55
67
|
##
|
|
56
|
-
# Parses and look ups for keys in an OpenStack response
|
|
68
|
+
# Parses and look ups for keys in an OpenStack response
|
|
57
69
|
#
|
|
58
70
|
# @param [Excon::Response] response Response from OpenStack API
|
|
59
71
|
# @param [Array<String>] keys Keys to look up in response
|
|
@@ -120,7 +132,7 @@ module Bosh::OpenStackCloud
|
|
|
120
132
|
break if target_state.include?(state)
|
|
121
133
|
|
|
122
134
|
sleep(@wait_resource_poll_interval)
|
|
123
|
-
|
|
135
|
+
|
|
124
136
|
end
|
|
125
137
|
|
|
126
138
|
if @logger
|
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.
|
|
4
|
+
version: 1.3022.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: 2015-07-
|
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fog-aws
|
|
@@ -44,42 +44,42 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 1.
|
|
47
|
+
version: 1.3022.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.
|
|
54
|
+
version: 1.3022.0
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: bosh_cpi
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 1.
|
|
61
|
+
version: 1.3022.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.
|
|
68
|
+
version: 1.3022.0
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: bosh-registry
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 1.
|
|
75
|
+
version: 1.3022.0
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 1.
|
|
82
|
+
version: 1.3022.0
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: httpclient
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -180,7 +180,7 @@ dependencies:
|
|
|
180
180
|
version: '0'
|
|
181
181
|
description: |-
|
|
182
182
|
BOSH OpenStack CPI
|
|
183
|
-
|
|
183
|
+
6073a7
|
|
184
184
|
email: support@cloudfoundry.com
|
|
185
185
|
executables:
|
|
186
186
|
- bosh_openstack_console
|