bosh-director 1.2780.0 → 1.2781.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/bosh-director CHANGED
@@ -57,10 +57,6 @@ thin_server = Thin::Server.new('127.0.0.1', config.hash['port'], signals: false)
57
57
  run Bosh::Director::Api::Controllers::StemcellsController.new
58
58
  end
59
59
 
60
- map '/tasks' do
61
- run Bosh::Director::Api::Controllers::TasksController.new
62
- end
63
-
64
60
  map '/task' do
65
61
  run Bosh::Director::Api::Controllers::TaskController.new
66
62
  end
@@ -0,0 +1,7 @@
1
+ Sequel.migration do
2
+ change do
3
+ alter_table(:persistent_disks) do
4
+ add_column :cloud_properties_json, String, :text => true
5
+ end
6
+ end
7
+ end
@@ -11,23 +11,28 @@ module Bosh::Director
11
11
  :state => :queued,
12
12
  :timestamp => Time.now,
13
13
  :checkpoint_time => Time.now)
14
- log_dir = File.join(Config.base_dir, "tasks", task.id.to_s)
15
- task_status_file = File.join(log_dir, "debug")
14
+ log_dir = File.join(Config.base_dir, 'tasks', task.id.to_s)
15
+ task_status_file = File.join(log_dir, 'debug')
16
16
  FileUtils.mkdir_p(log_dir)
17
17
 
18
- logger = Logging::Logger.new('DirectorTask')
19
- logger.add_appenders(Logging.appenders.file('DirectorTaskFile', filename: task_status_file))
20
- logger.level = Config.logger.level
21
- logger.info("Director Version : #{Bosh::Director::VERSION}")
22
- logger.info("Enqueuing task: #{task.id}")
18
+ File.open(task_status_file, 'a') do |f|
19
+ f << format_log_message("Director Version: #{Bosh::Director::VERSION}")
20
+ f << format_log_message("Enqueuing task: #{task.id}")
21
+ end
23
22
 
24
23
  # remove old tasks
25
- TaskRemover.new(Config.max_tasks, logger).remove
24
+ TaskRemover.new(Config.max_tasks).remove
26
25
 
27
26
  task.output = log_dir
28
27
  task.save
29
28
  task
30
29
  end
30
+
31
+ private
32
+
33
+ def format_log_message(message)
34
+ ThreadFormatter.new.call('INFO', Time.now, 'TaskHelper', message)
35
+ end
31
36
  end
32
37
  end
33
38
  end
@@ -1,8 +1,7 @@
1
1
  module Bosh::Director::Api
2
2
  class TaskRemover
3
- def initialize(max_tasks, logger)
3
+ def initialize(max_tasks)
4
4
  @max_tasks = max_tasks
5
- #@logger = logger
6
5
  end
7
6
 
8
7
  def remove
@@ -48,7 +48,6 @@ module Bosh::Director
48
48
  @index = index
49
49
  @logger = logger
50
50
 
51
- @model = nil
52
51
  @configuration_hash = nil
53
52
  @template_hashes = nil
54
53
  @vm = nil
@@ -72,18 +71,12 @@ module Bosh::Director
72
71
  "#{@job.name}/#{@index}"
73
72
  end
74
73
 
75
- # Looks up a DB model for this instance, creates one if doesn't exist yet.
76
- # @return [void]
77
- def bind_model
78
- @model ||= find_or_create_model
79
- end
80
-
81
74
  # Looks up instance model in DB and binds it to this instance spec.
82
75
  # Instance model is created if it's not found in DB. New VM is
83
76
  # allocated if instance DB record doesn't reference one.
84
77
  # @return [void]
85
78
  def bind_unallocated_vm
86
- bind_model
79
+ @model ||= find_or_create_model
87
80
  if @model.vm.nil?
88
81
  allocate_vm
89
82
  end
@@ -92,7 +85,8 @@ module Bosh::Director
92
85
  ##
93
86
  # Updates this domain object to reflect an existing instance running on an existing vm
94
87
  def bind_existing_instance(instance_model, state, reservations)
95
- raise DirectorError, "Instance `#{self}' model is already bound" if @model
88
+ check_model_not_bound
89
+
96
90
  @model = instance_model
97
91
  @current_state = state
98
92
 
@@ -156,9 +150,7 @@ module Bosh::Director
156
150
  # stopped or detached).
157
151
  # @return [void]
158
152
  def sync_state_with_db
159
- if @model.nil?
160
- raise DirectorError, "Instance `#{self}' model is not bound"
161
- end
153
+ check_model_bound
162
154
 
163
155
  if @state
164
156
  # Deployment plan explicitly sets state for this instance
@@ -232,14 +224,9 @@ module Bosh::Director
232
224
  ##
233
225
  # @return [Integer] persistent disk size
234
226
  def disk_size
235
- if @model.nil?
236
- disk_pool = current_state['persistent_disk_pool']
237
- if disk_pool
238
- disk_pool['disk_size'].to_i
239
- else
240
- current_state['persistent_disk'].to_i
241
- end
242
- elsif @model.persistent_disk
227
+ check_model_bound
228
+
229
+ if @model.persistent_disk
243
230
  @model.persistent_disk.size
244
231
  else
245
232
  0
@@ -249,9 +236,10 @@ module Bosh::Director
249
236
  ##
250
237
  # @return [Hash] persistent disk cloud properties
251
238
  def disk_cloud_properties
252
- disk_pool = current_state['persistent_disk_pool']
253
- if disk_pool
254
- disk_pool['cloud_properties']
239
+ check_model_bound
240
+
241
+ if @model.persistent_disk
242
+ @model.persistent_disk.cloud_properties
255
243
  else
256
244
  {}
257
245
  end
@@ -490,6 +478,16 @@ module Bosh::Director
490
478
 
491
479
  private
492
480
 
481
+ def check_model_bound
482
+ if @model.nil?
483
+ raise DirectorError, "Instance `#{self}' model is not bound"
484
+ end
485
+ end
486
+
487
+ def check_model_not_bound
488
+ raise DirectorError, "Instance `#{self}' model is already bound" if @model
489
+ end
490
+
493
491
  ##
494
492
  # Take any existing valid network reservations
495
493
  # @param [Hash<String, NetworkReservation>] reservations
@@ -315,10 +315,11 @@ module Bosh::Director
315
315
  @instance.model.db.transaction do
316
316
  disk_cid = @cloud.create_disk(disk_size, cloud_properties, @vm.cid)
317
317
  disk = Models::PersistentDisk.create(
318
- :disk_cid => disk_cid,
319
- :active => false,
320
- :instance_id => @instance.model.id,
321
- :size => disk_size
318
+ disk_cid: disk_cid,
319
+ active: false,
320
+ instance_id: @instance.model.id,
321
+ size: disk_size,
322
+ cloud_properties: cloud_properties,
322
323
  )
323
324
  end
324
325
  disk
@@ -9,5 +9,14 @@ module Bosh::Director::Models
9
9
  validates_presence [:instance_id, :disk_cid]
10
10
  validates_unique [:disk_cid]
11
11
  end
12
+
13
+ def cloud_properties
14
+ result = self.cloud_properties_json
15
+ result ? Yajl::Parser.parse(result) : {}
16
+ end
17
+
18
+ def cloud_properties=(cloud_properties)
19
+ self.cloud_properties_json = Yajl::Encoder.encode(cloud_properties)
20
+ end
12
21
  end
13
22
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.2780.0'
3
+ VERSION = '1.2781.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-director
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2780.0
4
+ version: 1.2781.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-02 00:00:00.000000000 Z
12
+ date: 2014-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bcrypt-ruby
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2780.0
37
+ version: 1.2781.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2780.0
45
+ version: 1.2781.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bosh-core
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 1.2780.0
53
+ version: 1.2781.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2780.0
61
+ version: 1.2781.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bosh-director-core
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 1.2780.0
69
+ version: 1.2781.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 1.2780.0
77
+ version: 1.2781.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: bosh_common
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 1.2780.0
85
+ version: 1.2781.0
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 1.2780.0
93
+ version: 1.2781.0
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: bosh-template
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: 1.2780.0
101
+ version: 1.2781.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 1.2780.0
109
+ version: 1.2781.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: bosh_cpi
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.2780.0
117
+ version: 1.2781.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.2780.0
125
+ version: 1.2781.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: bosh_openstack_cpi
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 1.2780.0
133
+ version: 1.2781.0
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 1.2780.0
141
+ version: 1.2781.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: bosh_aws_cpi
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
- version: 1.2780.0
149
+ version: 1.2781.0
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ~>
156
156
  - !ruby/object:Gem::Version
157
- version: 1.2780.0
157
+ version: 1.2781.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: bosh_vsphere_cpi
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,7 @@ dependencies:
162
162
  requirements:
163
163
  - - ~>
164
164
  - !ruby/object:Gem::Version
165
- version: 1.2780.0
165
+ version: 1.2781.0
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  requirements:
171
171
  - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: 1.2780.0
173
+ version: 1.2781.0
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: bosh_warden_cpi
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,7 @@ dependencies:
178
178
  requirements:
179
179
  - - ~>
180
180
  - !ruby/object:Gem::Version
181
- version: 1.2780.0
181
+ version: 1.2781.0
182
182
  type: :runtime
183
183
  prerelease: false
184
184
  version_requirements: !ruby/object:Gem::Requirement
@@ -186,7 +186,7 @@ dependencies:
186
186
  requirements:
187
187
  - - ~>
188
188
  - !ruby/object:Gem::Version
189
- version: 1.2780.0
189
+ version: 1.2781.0
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: bosh_vcloud_cpi
192
192
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ dependencies:
194
194
  requirements:
195
195
  - - ~>
196
196
  - !ruby/object:Gem::Version
197
- version: 0.7.1
197
+ version: 0.7.2
198
198
  type: :runtime
199
199
  prerelease: false
200
200
  version_requirements: !ruby/object:Gem::Requirement
@@ -202,7 +202,7 @@ dependencies:
202
202
  requirements:
203
203
  - - ~>
204
204
  - !ruby/object:Gem::Version
205
- version: 0.7.1
205
+ version: 0.7.2
206
206
  - !ruby/object:Gem::Dependency
207
207
  name: eventmachine
208
208
  requirement: !ruby/object:Gem::Requirement
@@ -258,7 +258,7 @@ dependencies:
258
258
  requirements:
259
259
  - - ~>
260
260
  - !ruby/object:Gem::Version
261
- version: 1.5.0
261
+ version: 1.8.2
262
262
  type: :runtime
263
263
  prerelease: false
264
264
  version_requirements: !ruby/object:Gem::Requirement
@@ -266,7 +266,7 @@ dependencies:
266
266
  requirements:
267
267
  - - ~>
268
268
  - !ruby/object:Gem::Version
269
- version: 1.5.0
269
+ version: 1.8.2
270
270
  - !ruby/object:Gem::Dependency
271
271
  name: nats
272
272
  requirement: !ruby/object:Gem::Requirement
@@ -525,7 +525,7 @@ dependencies:
525
525
  version: '0'
526
526
  description: ! 'BOSH Director
527
527
 
528
- c7836e'
528
+ cc921b'
529
529
  email: support@cloudfoundry.com
530
530
  executables:
531
531
  - bosh-director
@@ -568,6 +568,7 @@ files:
568
568
  - db/migrations/director/20140116002324_pivot_director_attributes.rb
569
569
  - db/migrations/director/20140124225348_proper_pk_for_attributes.rb
570
570
  - db/migrations/director/20140731215410_increase_text_limit_for_data_columns.rb
571
+ - db/migrations/director/20141204234517_add_cloud_properties_to_persistent_disk.rb
571
572
  - db/migrations/dns/20120123234908_initial.rb
572
573
  - lib/bosh/director.rb
573
574
  - lib/bosh/director/agent_client.rb
@@ -792,7 +793,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
792
793
  version: '0'
793
794
  segments:
794
795
  - 0
795
- hash: 2618373430597932191
796
+ hash: 4213686658557663604
796
797
  requirements: []
797
798
  rubyforge_project:
798
799
  rubygems_version: 1.8.23