bosh-director 1.2820.0 → 1.2824.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -431,6 +431,12 @@ module Bosh::Director
431
431
  spec
432
432
  end
433
433
 
434
+ def bind_to_vm_model(vm_model)
435
+ @model.update(vm: vm_model)
436
+ @vm.model = vm_model
437
+ @vm.bound_instance = self
438
+ end
439
+
434
440
  # Looks up instance model in DB
435
441
  # @return [Models::Instance]
436
442
  def find_or_create_model
@@ -135,15 +135,11 @@ module Bosh::Director
135
135
  raise ResourcePoolNotEnoughCapacity, "Resource pool `#{@name}' has no more VMs to allocate" if vm.nil?
136
136
  end
137
137
 
138
- add_allocated_vm(vm)
138
+ register_allocated_vm(vm)
139
139
  end
140
140
 
141
- # Adds an existing VM to allocated_vms
142
- def add_allocated_vm(vm=nil)
143
- vm ||= Vm.new(self)
144
- @logger.info("ResourcePool `#{name}' - Adding allocated VM (index=#{@allocated_vms.size})")
145
- @allocated_vms << vm
146
- vm
141
+ def add_allocated_vm
142
+ register_allocated_vm(Vm.new(self))
147
143
  end
148
144
 
149
145
  def deallocate_vm(vm_cid)
@@ -155,6 +151,8 @@ module Bosh::Director
155
151
  @logger.info("ResourcePool `#{name}' - Deallocating VM: #{deallocated_vm.model.cid}")
156
152
  @allocated_vms.delete(deallocated_vm)
157
153
 
154
+ deallocated_vm.release_reservation
155
+
158
156
  add_idle_vm unless dynamically_sized? # don't refill if dynamically sized
159
157
 
160
158
  nil
@@ -198,6 +196,12 @@ module Bosh::Director
198
196
  end
199
197
 
200
198
  private
199
+ # Adds an existing VM to allocated_vms
200
+ def register_allocated_vm(vm)
201
+ @logger.info("ResourcePool `#{name}' - Adding allocated VM (index=#{@allocated_vms.size})")
202
+ @allocated_vms << vm
203
+ vm
204
+ end
201
205
 
202
206
  def dynamically_sized?
203
207
  @size.nil?
@@ -87,21 +87,10 @@ module Bosh::Director
87
87
  def create(new_disk_id)
88
88
  @logger.info('Creating VM')
89
89
 
90
- deployment = @instance.job.deployment
91
- resource_pool = @instance.job.resource_pool
92
-
93
- vm_model = Bosh::Director::VmCreator.create(
94
- deployment.model,
95
- resource_pool.stemcell.model,
96
- resource_pool.cloud_properties,
97
- @instance.network_settings,
98
- [@instance.model.persistent_disk_cid, new_disk_id].compact,
99
- resource_pool.env,
100
- )
90
+ vm_model = new_vm_model(new_disk_id)
101
91
 
102
92
  begin
103
- @instance.model.vm = vm_model
104
- @instance.model.save
93
+ @instance.bind_to_vm_model(vm_model)
105
94
 
106
95
  agent_client = AgentClient.with_defaults(vm_model.agent_id)
107
96
  agent_client.wait_until_ready
@@ -113,6 +102,20 @@ module Bosh::Director
113
102
 
114
103
  [vm_model, agent_client]
115
104
  end
105
+
106
+ def new_vm_model(new_disk_id)
107
+ deployment = @instance.job.deployment
108
+ resource_pool = @instance.job.resource_pool
109
+
110
+ Bosh::Director::VmCreator.create(
111
+ deployment.model,
112
+ resource_pool.stemcell.model,
113
+ resource_pool.cloud_properties,
114
+ @instance.network_settings,
115
+ [@instance.model.persistent_disk_cid, new_disk_id].compact,
116
+ resource_pool.env,
117
+ )
118
+ end
116
119
  end
117
120
 
118
121
  class VmDeleter
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.2820.0'
3
+ VERSION = '1.2824.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.2820.0
4
+ version: 1.2824.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: 2015-01-20 00:00:00.000000000 Z
12
+ date: 2015-01-23 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.2820.0
37
+ version: 1.2824.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.2820.0
45
+ version: 1.2824.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.2820.0
53
+ version: 1.2824.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.2820.0
61
+ version: 1.2824.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.2820.0
69
+ version: 1.2824.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.2820.0
77
+ version: 1.2824.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.2820.0
85
+ version: 1.2824.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.2820.0
93
+ version: 1.2824.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.2820.0
101
+ version: 1.2824.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.2820.0
109
+ version: 1.2824.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.2820.0
117
+ version: 1.2824.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.2820.0
125
+ version: 1.2824.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.2820.0
133
+ version: 1.2824.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.2820.0
141
+ version: 1.2824.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.2820.0
149
+ version: 1.2824.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.2820.0
157
+ version: 1.2824.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.2820.0
165
+ version: 1.2824.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.2820.0
173
+ version: 1.2824.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.2820.0
181
+ version: 1.2824.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.2820.0
189
+ version: 1.2824.0
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: bosh_vcloud_cpi
192
192
  requirement: !ruby/object:Gem::Requirement
@@ -525,7 +525,7 @@ dependencies:
525
525
  version: '0'
526
526
  description: ! 'BOSH Director
527
527
 
528
- ebc2f0'
528
+ 1607a8'
529
529
  email: support@cloudfoundry.com
530
530
  executables:
531
531
  - bosh-director
@@ -794,7 +794,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
794
794
  version: '0'
795
795
  segments:
796
796
  - 0
797
- hash: -659314648512800601
797
+ hash: -1867782211613584579
798
798
  requirements: []
799
799
  rubyforge_project:
800
800
  rubygems_version: 1.8.23