bosh_aws_cpi 1.2905.0 → 1.2915.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloud/aws/cloud.rb +36 -7
- data/lib/cloud/aws/resource_wait.rb +19 -6
- data/lib/cloud/aws/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: c22ae9747a085884024355d95211b787433c092b
|
4
|
+
data.tar.gz: 0d2512c06b0de933e4a9eb2ad2986c63db30998b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d5476682f1ab3435ce1c31184b43614cd581ec48235c661502ce0beecc43264fddd7b27a19c4c9810c4d2adf71c6fb004fcb8909c8b32654f914445c34aa8ed
|
7
|
+
data.tar.gz: 8d75ae99b097651d136dd3c24fa92eaabba49a12731e8c3263f2c7ca7ca205b08fb78d404319c9dacec1f2da5601e6e51e88f0178f16f70a8ed0f8fd61380f38
|
data/lib/cloud/aws/cloud.rb
CHANGED
@@ -205,14 +205,20 @@ module Bosh::AwsCloud
|
|
205
205
|
|
206
206
|
logger.info("Deleting volume `#{volume.id}'")
|
207
207
|
|
208
|
-
|
209
|
-
|
208
|
+
# Retry 1, 6, 11, 15, 15, 15.. seconds. The total time is ~10 min.
|
209
|
+
# VolumeInUse can be returned by AWS if disk was attached to VM
|
210
|
+
# that was recently removed.
|
211
|
+
tries = ResourceWait::DEFAULT_WAIT_ATTEMPTS
|
212
|
+
sleep_cb = ResourceWait.sleep_callback(
|
213
|
+
"Waiting for volume `#{volume.id}' to be deleted",
|
214
|
+
{ interval: 5, total: tries }
|
215
|
+
)
|
210
216
|
ensure_cb = Proc.new do |retries|
|
211
217
|
cloud_error("Timed out waiting to delete volume `#{volume.id}'") if retries == tries
|
212
218
|
end
|
213
|
-
|
219
|
+
errors = [AWS::EC2::Errors::VolumeInUse, AWS::EC2::Errors::RequestLimitExceeded]
|
214
220
|
|
215
|
-
Bosh::Common.retryable(tries: tries, sleep: sleep_cb, on:
|
221
|
+
Bosh::Common.retryable(tries: tries, sleep: sleep_cb, on: errors, ensure: ensure_cb) do
|
216
222
|
volume.delete
|
217
223
|
true # return true to only retry on Exceptions
|
218
224
|
end
|
@@ -484,7 +490,6 @@ module Bosh::AwsCloud
|
|
484
490
|
cloud_error("Cannot find EBS volume on current instance")
|
485
491
|
end
|
486
492
|
|
487
|
-
|
488
493
|
private
|
489
494
|
|
490
495
|
attr_reader :az_selector
|
@@ -573,11 +578,35 @@ module Bosh::AwsCloud
|
|
573
578
|
# AWS might still lie and say that the disk isn't ready yet, so
|
574
579
|
# we try again just to be really sure it is telling the truth
|
575
580
|
attachment = nil
|
576
|
-
|
581
|
+
|
582
|
+
logger.debug("Attaching '#{volume.id}' to '#{instance.id}' as '#{device_name}'")
|
583
|
+
|
584
|
+
# Retry every 1 sec for 15 sec, then every 15 sec for ~10 min
|
585
|
+
# VolumeInUse can be returned by AWS if disk was attached to VM
|
586
|
+
# that was recently removed.
|
587
|
+
tries = ResourceWait::DEFAULT_WAIT_ATTEMPTS
|
588
|
+
sleep_cb = ResourceWait.sleep_callback(
|
589
|
+
"Attaching volume `#{volume.id}' to #{instance.id}",
|
590
|
+
{ interval: 0, tries_before_max: 15, total: tries }
|
591
|
+
)
|
592
|
+
|
593
|
+
Bosh::Common.retryable(
|
594
|
+
on: [
|
595
|
+
AWS::EC2::Errors::IncorrectState,
|
596
|
+
AWS::EC2::Errors::VolumeInUse,
|
597
|
+
AWS::EC2::Errors::RequestLimitExceeded
|
598
|
+
],
|
599
|
+
sleep: sleep_cb,
|
600
|
+
tries: tries
|
601
|
+
) do |retries, error|
|
602
|
+
# Continue to retry after 15 attempts only for VolumeInUse
|
603
|
+
if retries > 15 && error.instance_of?(AWS::EC2::Errors::IncorrectState)
|
604
|
+
cloud_error("Failed to attach disk: #{error.message}")
|
605
|
+
end
|
606
|
+
|
577
607
|
attachment = volume.attach_to(instance, device_name)
|
578
608
|
end
|
579
609
|
|
580
|
-
logger.info("Attaching '#{volume.id}' to '#{instance.id}' as '#{device_name}'")
|
581
610
|
ResourceWait.for_attachment(attachment: attachment, state: :attached)
|
582
611
|
|
583
612
|
device_name = attachment.device
|
@@ -7,7 +7,8 @@ module Bosh::AwsCloud
|
|
7
7
|
# a sane amount of retries on AWS (~25 minutes),
|
8
8
|
# as things can take anywhere between a minute and forever
|
9
9
|
DEFAULT_TRIES = 54
|
10
|
-
|
10
|
+
MAX_SLEEP_TIME = 15
|
11
|
+
DEFAULT_WAIT_ATTEMPTS = 600 / MAX_SLEEP_TIME # 10 minutes
|
11
12
|
|
12
13
|
def self.for_instance(args)
|
13
14
|
raise ArgumentError, "args should be a Hash, but `#{args.class}' given" unless args.is_a?(Hash)
|
@@ -134,12 +135,21 @@ module Bosh::AwsCloud
|
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
137
|
-
def self.sleep_callback(description,
|
138
|
+
def self.sleep_callback(description, options)
|
139
|
+
max_sleep_time = options.fetch(:max, MAX_SLEEP_TIME)
|
138
140
|
lambda do |num_tries, error|
|
139
|
-
|
141
|
+
if options[:tries_before_max] && num_tries >= options[:tries_before_max]
|
142
|
+
time = max_sleep_time
|
143
|
+
else
|
144
|
+
if options[:exponential]
|
145
|
+
time = [options[:interval] ** num_tries, max_sleep_time].min
|
146
|
+
else
|
147
|
+
time = [1 + options[:interval] * num_tries, max_sleep_time].min
|
148
|
+
end
|
149
|
+
end
|
140
150
|
Bosh::AwsCloud::ResourceWait.logger.debug("#{error.class}: `#{error.message}'") if error
|
141
|
-
Bosh::AwsCloud::ResourceWait.logger.debug("#{description}, retrying in #{
|
142
|
-
|
151
|
+
Bosh::AwsCloud::ResourceWait.logger.debug("#{description}, retrying in #{time} seconds (#{num_tries}/#{options[:total]})")
|
152
|
+
time
|
143
153
|
end
|
144
154
|
end
|
145
155
|
|
@@ -163,7 +173,10 @@ module Bosh::AwsCloud
|
|
163
173
|
tries = args.fetch(:tries, DEFAULT_TRIES).to_i
|
164
174
|
target_state = args.fetch(:target_state)
|
165
175
|
|
166
|
-
sleep_cb = self.class.sleep_callback(
|
176
|
+
sleep_cb = self.class.sleep_callback(
|
177
|
+
"Waiting for #{desc} to be #{target_state}",
|
178
|
+
{ interval: 2, total: tries, max: 32, exponential: true }
|
179
|
+
)
|
167
180
|
errors << AWS::EC2::Errors::RequestLimitExceeded
|
168
181
|
ensure_cb = Proc.new do |retries|
|
169
182
|
cloud_error("Timed out waiting for #{desc} to be #{target_state}, took #{time_passed}s") if retries == tries
|
data/lib/cloud/aws/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_aws_cpi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2915.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2915.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.
|
40
|
+
version: 1.2915.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.
|
47
|
+
version: 1.2915.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.2915.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.
|
61
|
+
version: 1.2915.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.2915.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: httpclient
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
version: '0'
|
139
139
|
description: |-
|
140
140
|
BOSH AWS CPI
|
141
|
-
|
141
|
+
5653ce
|
142
142
|
email: support@cloudfoundry.com
|
143
143
|
executables:
|
144
144
|
- aws_cpi
|