bosh-director 1.3165.0 → 1.3167.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bosh/director/api/controllers/deployments_controller.rb +5 -19
- data/lib/bosh/director/cloudcheck_helper.rb +1 -1
- data/lib/bosh/director/deployment_plan/assembler.rb +0 -19
- data/lib/bosh/director/deployment_plan/deployment_spec_parser.rb +0 -4
- data/lib/bosh/director/deployment_plan/planner.rb +0 -15
- data/lib/bosh/director/deployment_plan/planner_factory.rb +0 -1
- data/lib/bosh/director/errors.rb +0 -1
- data/lib/bosh/director/instance_updater.rb +7 -58
- data/lib/bosh/director/instance_updater/state_applier.rb +59 -1
- data/lib/bosh/director/problem_handlers/missing_disk.rb +1 -1
- data/lib/bosh/director/problem_handlers/missing_vm.rb +1 -1
- data/lib/bosh/director/problem_handlers/unresponsive_agent.rb +1 -1
- data/lib/bosh/director/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41dc4755ce67d81901fae275b7f2415ed8a3c32f
|
4
|
+
data.tar.gz: 7b30981be831221a4e03f67e348858d1927ab804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 689d1da648a11d284bf9b38dfd87c9d58d4f5071d87668c9ab0157d267f924803b353786fd1335716a0905f103e6f329a6960ea9572915d65c648606df5dd95a
|
7
|
+
data.tar.gz: 19ee2fc7f6ebad795f8e5f61821e5266c4bbf2281653975de3598c3fab3a59b854f1ad7413794596431e8f01a714dc67b9d8096722e6a8038475f1a2673d6b4e
|
@@ -18,28 +18,14 @@ module Bosh::Director
|
|
18
18
|
json_encode(response)
|
19
19
|
end
|
20
20
|
|
21
|
-
# PUT /deployments/foo/jobs/dea?new_name=dea_new
|
22
21
|
put '/:deployment/jobs/:job', :consumes => :yaml do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
params[
|
27
|
-
'state' => params['state']
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
else
|
32
|
-
unless params['new_name']
|
33
|
-
raise DirectorError, "Missing operation on job `#{params[:job]}'"
|
34
|
-
end
|
35
|
-
options = {
|
36
|
-
'job_rename' => {
|
37
|
-
'old_name' => params[:job],
|
38
|
-
'new_name' => params['new_name']
|
22
|
+
options = {
|
23
|
+
'job_states' => {
|
24
|
+
params[:job] => {
|
25
|
+
'state' => params['state']
|
39
26
|
}
|
40
27
|
}
|
41
|
-
|
42
|
-
end
|
28
|
+
}
|
43
29
|
|
44
30
|
deployment = @deployment_manager.find_by_name(params[:deployment])
|
45
31
|
manifest = ((request.content_length.nil? || request.content_length.to_i == 0) && (params['state'])) ? StringIO.new(deployment.manifest) : request.body
|
@@ -97,7 +97,7 @@ module Bosh::Director
|
|
97
97
|
dns_manager.flush_dns_cache
|
98
98
|
|
99
99
|
cleaner = RenderedJobTemplatesCleaner.new(instance_model, App.instance.blobstores.blobstore, @logger)
|
100
|
-
InstanceUpdater::StateApplier.new(instance_plan_to_create, agent_client(instance_model.vm), cleaner).apply
|
100
|
+
InstanceUpdater::StateApplier.new(instance_plan_to_create, agent_client(instance_model.vm), cleaner, @logger).apply
|
101
101
|
end
|
102
102
|
|
103
103
|
private
|
@@ -18,7 +18,6 @@ module Bosh::Director
|
|
18
18
|
bind_releases
|
19
19
|
|
20
20
|
migrate_legacy_dns_records
|
21
|
-
bind_job_renames
|
22
21
|
|
23
22
|
instance_repo = Bosh::Director::DeploymentPlan::InstanceRepository.new(@logger)
|
24
23
|
states_by_existing_instance = current_states_by_instance(@deployment_plan.candidate_existing_instances)
|
@@ -167,28 +166,10 @@ module Bosh::Director
|
|
167
166
|
@dns_manager.configure_nameserver
|
168
167
|
end
|
169
168
|
|
170
|
-
def bind_job_renames
|
171
|
-
@deployment_plan.instance_models.each do |instance_model|
|
172
|
-
update_instance_if_rename(instance_model)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
169
|
def migrate_legacy_dns_records
|
177
170
|
@deployment_plan.instance_models.each do |instance_model|
|
178
171
|
@dns_manager.migrate_legacy_records(instance_model)
|
179
172
|
end
|
180
173
|
end
|
181
|
-
|
182
|
-
def update_instance_if_rename(instance_model)
|
183
|
-
if @deployment_plan.rename_in_progress?
|
184
|
-
old_name = @deployment_plan.job_rename['old_name']
|
185
|
-
new_name = @deployment_plan.job_rename['new_name']
|
186
|
-
|
187
|
-
if instance_model.job == old_name
|
188
|
-
@logger.info("Renaming `#{old_name}' to `#{new_name}'")
|
189
|
-
instance_model.update(:job => new_name)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
174
|
end
|
194
175
|
end
|
@@ -38,10 +38,6 @@ module Bosh::Director
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
def parse_name
|
42
|
-
safe_property(@deployment_manifest, 'name', :class => String)
|
43
|
-
end
|
44
|
-
|
45
41
|
def parse_properties
|
46
42
|
@deployment.properties = safe_property(@deployment_manifest, 'properties',
|
47
43
|
:class => Hash, :default => {})
|
@@ -46,8 +46,6 @@ module Bosh::Director
|
|
46
46
|
# VMs from the old manifest that are not in the new manifest
|
47
47
|
attr_accessor :unneeded_vms
|
48
48
|
|
49
|
-
attr_reader :job_rename
|
50
|
-
|
51
49
|
# @return [Boolean] Indicates whether VMs should be recreated
|
52
50
|
attr_reader :recreate
|
53
51
|
|
@@ -75,9 +73,6 @@ module Bosh::Director
|
|
75
73
|
@unneeded_vms = []
|
76
74
|
@unneeded_instances = []
|
77
75
|
|
78
|
-
@job_rename = safe_property(options, 'job_rename',
|
79
|
-
:class => Hash, :default => {})
|
80
|
-
|
81
76
|
@recreate = !!options['recreate']
|
82
77
|
|
83
78
|
@link_spec = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) }
|
@@ -221,12 +216,6 @@ module Bosh::Director
|
|
221
216
|
# Adds a job by name
|
222
217
|
# @param [Bosh::Director::DeploymentPlan::Job] job
|
223
218
|
def add_job(job)
|
224
|
-
if rename_in_progress? && @job_rename['old_name'] == job.name
|
225
|
-
raise DeploymentRenamedJobNameStillUsed,
|
226
|
-
"Renamed job `#{job.name}' is still referenced in " +
|
227
|
-
'deployment manifest'
|
228
|
-
end
|
229
|
-
|
230
219
|
if @jobs_canonical_name_index.include?(job.canonical_name)
|
231
220
|
raise DeploymentCanonicalJobNameTaken,
|
232
221
|
"Invalid job name `#{job.name}', canonical name already taken"
|
@@ -248,10 +237,6 @@ module Bosh::Director
|
|
248
237
|
@jobs.select(&:starts_on_deploy?)
|
249
238
|
end
|
250
239
|
|
251
|
-
def rename_in_progress?
|
252
|
-
@job_rename['old_name'] && @job_rename['new_name']
|
253
|
-
end
|
254
|
-
|
255
240
|
def persist_updates!
|
256
241
|
#prior updates may have had release versions that we no longer use.
|
257
242
|
#remove the references to these stale releases.
|
data/lib/bosh/director/errors.rb
CHANGED
@@ -207,7 +207,6 @@ module Bosh::Director
|
|
207
207
|
DeploymentDuplicateReleaseName = err(190002)
|
208
208
|
DeploymentDuplicateResourcePoolName = err(190003)
|
209
209
|
DeploymentDuplicateVmTypeName = err(190004)
|
210
|
-
DeploymentRenamedJobNameStillUsed = err(190005)
|
211
210
|
DeploymentCanonicalJobNameTaken = err(190006)
|
212
211
|
DeploymentCanonicalNetworkNameTaken = err(190007)
|
213
212
|
DeploymentNoNetworks = err(190008)
|
@@ -2,11 +2,8 @@ require 'bosh/director/rendered_job_templates_cleaner'
|
|
2
2
|
|
3
3
|
module Bosh::Director
|
4
4
|
class InstanceUpdater
|
5
|
-
WATCH_INTERVALS = 10
|
6
5
|
MAX_RECREATE_ATTEMPTS = 3
|
7
6
|
|
8
|
-
attr_reader :current_state
|
9
|
-
|
10
7
|
def self.new_instance_updater(ip_provider)
|
11
8
|
logger = Config.logger
|
12
9
|
cloud = Config.cloud
|
@@ -38,8 +35,8 @@ module Bosh::Director
|
|
38
35
|
@dns_manager = dns_manager
|
39
36
|
@disk_manager = disk_manager
|
40
37
|
@ip_provider = ip_provider
|
41
|
-
@current_state = {}
|
42
38
|
@vm_recreator = vm_recreator
|
39
|
+
@current_state = {}
|
43
40
|
end
|
44
41
|
|
45
42
|
def update(instance_plan, options = {})
|
@@ -94,19 +91,13 @@ module Bosh::Director
|
|
94
91
|
end
|
95
92
|
|
96
93
|
cleaner = RenderedJobTemplatesCleaner.new(instance.model, @blobstore, @logger)
|
97
|
-
InstanceUpdater::StateApplier.new(instance_plan, agent(instance), cleaner)
|
94
|
+
state_applier = InstanceUpdater::StateApplier.new(instance_plan, agent(instance), cleaner, @logger)
|
95
|
+
state_applier.apply
|
98
96
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
if instance.state == "started" && current_state["job_state"] != "running"
|
104
|
-
raise AgentJobNotRunning, "`#{instance}' is not running after update"
|
105
|
-
end
|
106
|
-
|
107
|
-
if instance.state == "stopped" && current_state["job_state"] == "running"
|
108
|
-
raise AgentJobNotStopped, "`#{instance}' is still running despite the stop command"
|
109
|
-
end
|
97
|
+
job = instance_plan.desired_instance.job
|
98
|
+
min_watch_time = get_min_watch_time(job.update)
|
99
|
+
max_watch_time = get_max_watch_time(job.update)
|
100
|
+
state_applier.post_start(min_watch_time, max_watch_time)
|
110
101
|
end
|
111
102
|
|
112
103
|
private
|
@@ -140,24 +131,6 @@ module Bosh::Director
|
|
140
131
|
@dns_manager.flush_dns_cache
|
141
132
|
end
|
142
133
|
|
143
|
-
# Returns an array of wait times distributed
|
144
|
-
# on the [min_watch_time..max_watch_time] interval.
|
145
|
-
#
|
146
|
-
# Tries to respect intervals but doesn't allow an interval to
|
147
|
-
# fall under 1 second.
|
148
|
-
# All times are in milliseconds.
|
149
|
-
# @param [Numeric] min_watch_time minimum time to watch the jobs
|
150
|
-
# @param [Numeric] max_watch_time maximum time to watch the jobs
|
151
|
-
# @param [Numeric] intervals number of intervals between polling
|
152
|
-
# the state of the jobs
|
153
|
-
# @return [Array<Numeric>] watch schedule
|
154
|
-
def watch_schedule(min_watch_time, max_watch_time, intervals = WATCH_INTERVALS)
|
155
|
-
delta = (max_watch_time - min_watch_time).to_f
|
156
|
-
step = [1000, delta / (intervals - 1)].max
|
157
|
-
|
158
|
-
[min_watch_time] + ([step] * (delta / step).floor)
|
159
|
-
end
|
160
|
-
|
161
134
|
def get_min_watch_time(update_config)
|
162
135
|
canary? ? update_config.min_canary_watch_time : update_config.min_update_watch_time
|
163
136
|
end
|
@@ -174,30 +147,6 @@ module Bosh::Director
|
|
174
147
|
instance_plan.changes.include?(:dns) && instance_plan.changes.size == 1
|
175
148
|
end
|
176
149
|
|
177
|
-
# Watch times don't include the get_state roundtrip time, so effective
|
178
|
-
# max watch time is roughly:
|
179
|
-
# max_watch_time + N_WATCH_INTERVALS * avg_roundtrip_time
|
180
|
-
def wait_until_running(instance_plan)
|
181
|
-
instance = instance_plan.instance
|
182
|
-
job = instance_plan.desired_instance.job
|
183
|
-
min_watch_time = get_min_watch_time(job.update)
|
184
|
-
max_watch_time = get_max_watch_time(job.update)
|
185
|
-
watch_schedule(min_watch_time, max_watch_time).each do |watch_time|
|
186
|
-
sleep_time = watch_time.to_f / 1000
|
187
|
-
@logger.info("Waiting for #{sleep_time} seconds to check #{instance} status")
|
188
|
-
sleep(sleep_time)
|
189
|
-
@logger.info("Checking if #{instance} has been updated after #{sleep_time} seconds")
|
190
|
-
|
191
|
-
@current_state = agent(instance).get_state
|
192
|
-
|
193
|
-
if instance.state == "started"
|
194
|
-
break if current_state["job_state"] == "running"
|
195
|
-
elsif instance.state == "stopped"
|
196
|
-
break if current_state["job_state"] != "running"
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
150
|
def needs_recreate?(instance_plan)
|
202
151
|
instance = instance_plan.instance
|
203
152
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module Bosh::Director
|
2
2
|
class InstanceUpdater::StateApplier
|
3
|
-
def initialize(instance_plan, agent_client, rendered_job_templates_cleaner)
|
3
|
+
def initialize(instance_plan, agent_client, rendered_job_templates_cleaner, logger)
|
4
4
|
@instance_plan = instance_plan
|
5
5
|
@instance = @instance_plan.instance
|
6
6
|
@agent_client = agent_client
|
7
7
|
@rendered_job_templates_cleaner = rendered_job_templates_cleaner
|
8
|
+
@logger = logger
|
8
9
|
end
|
9
10
|
|
10
11
|
def apply
|
@@ -17,5 +18,62 @@ module Bosh::Director
|
|
17
18
|
@agent_client.start
|
18
19
|
end
|
19
20
|
end
|
21
|
+
|
22
|
+
def post_start(min_watch_time, max_watch_time)
|
23
|
+
current_state = wait_until_desired_state(min_watch_time, max_watch_time)
|
24
|
+
|
25
|
+
if @instance.state == 'started'
|
26
|
+
if current_state['job_state'] != 'running'
|
27
|
+
raise AgentJobNotRunning, "`#{@instance}' is not running after update"
|
28
|
+
else
|
29
|
+
@agent_client.run_script('post-start', {})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if @instance.state == 'stopped' && current_state['job_state'] == 'running'
|
34
|
+
raise AgentJobNotStopped, "`#{@instance}' is still running despite the stop command"
|
35
|
+
end
|
36
|
+
|
37
|
+
@instance.update_state
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def wait_until_desired_state(min_watch_time, max_watch_time)
|
43
|
+
current_state = {}
|
44
|
+
watch_schedule(min_watch_time, max_watch_time).each do |watch_time|
|
45
|
+
sleep_time = watch_time.to_f / 1000
|
46
|
+
@logger.info("Waiting for #{sleep_time} seconds to check #{@instance} status")
|
47
|
+
sleep(sleep_time)
|
48
|
+
@logger.info("Checking if #{@instance} has been updated after #{sleep_time} seconds")
|
49
|
+
|
50
|
+
current_state = @agent_client.get_state
|
51
|
+
|
52
|
+
if @instance.state == 'started'
|
53
|
+
break if current_state['job_state'] == 'running'
|
54
|
+
elsif @instance.state == 'stopped'
|
55
|
+
break if current_state['job_state'] != 'running'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
current_state
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns an array of wait times distributed
|
63
|
+
# on the [min_watch_time..max_watch_time] interval.
|
64
|
+
#
|
65
|
+
# Tries to respect intervals but doesn't allow an interval to
|
66
|
+
# fall under 1 second.
|
67
|
+
# All times are in milliseconds.
|
68
|
+
# @param [Numeric] min_watch_time minimum time to watch the jobs
|
69
|
+
# @param [Numeric] max_watch_time maximum time to watch the jobs
|
70
|
+
# @return [Array<Numeric>] watch schedule
|
71
|
+
def watch_schedule(min_watch_time, max_watch_time)
|
72
|
+
delta = (max_watch_time - min_watch_time).to_f
|
73
|
+
watch_intervals = 10
|
74
|
+
step = [1000, delta / (watch_intervals - 1)].max
|
75
|
+
|
76
|
+
[min_watch_time] + ([step] * (delta / step).floor)
|
77
|
+
end
|
20
78
|
end
|
21
79
|
end
|
@@ -68,7 +68,7 @@ module Bosh::Director
|
|
68
68
|
begin
|
69
69
|
@logger.debug('Sending cpi request: detach_disk')
|
70
70
|
cloud.detach_disk(@vm.cid, @disk.disk_cid) if @vm.cid
|
71
|
-
rescue Bosh::Clouds::DiskNotAttached
|
71
|
+
rescue Bosh::Clouds::DiskNotAttached, Bosh::Clouds::DiskNotFound
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-director
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3167.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-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_common
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.3167.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.3167.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bosh_cpi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.3167.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.3167.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bosh-registry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.3167.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.3167.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: blobstore_client
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.3167.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.3167.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bosh-core
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.3167.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.3167.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bosh-director-core
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.3167.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.3167.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bosh-template
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.3167.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: 1.
|
110
|
+
version: 1.3167.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: bosh_openstack_cpi
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|