bosh_vcloud_cpi 0.7.9 → 0.7.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710aa4ae586bb095e7d141d87f370f32aea9b5a3
4
- data.tar.gz: 244fc9bb0602ed4cb4de55cfdbccef20b91b1c66
3
+ metadata.gz: fb7cda14ebdb11a1c818ce26c463bc7fd9605bd3
4
+ data.tar.gz: 7a6e5455d43ccd766749289d04592e9d61c630cd
5
5
  SHA512:
6
- metadata.gz: 622c767b56144f930d34a7241cc3f942a52553ef246277b8a9cac0c71dcbb57db0744d63a3bde2a19a13f83be359f0e561c60113d993f4fc10d3ad2d64f9bf38
7
- data.tar.gz: 081218358ed1a0ecb744bad2953e67d83515ee8895ae01d2c363d6b68a6e4ac6cf96c5f16efe624608ee4c9e5a2cacf0d7df1a2bbef4f5a99baa238a1db29aa1
6
+ metadata.gz: d644a6ecb8f31d59a23e18c11bd479233a1bd48420b449816d751c5f8d1bbf01836d8dbd12c630da58a383f75fd0af3dab8f2be2dfbb4da70365bacb9adc6998
7
+ data.tar.gz: e5f5d04c699e5f7e56068be8f7c54c2add73396e8e12e77fbaffa4b1c45f446a7770b5f0c3c873345840c42730e27bb9b30472684e765e44ef4378645998bf4e
@@ -38,16 +38,27 @@ module VCloudCloud
38
38
 
39
39
  def delete_stemcell(catalog_vapp_id)
40
40
  steps "delete_stemcell(#{catalog_vapp_id})" do |s|
41
- catalog_vapp = client.resolve_entity catalog_vapp_id
42
- raise "Catalog vApp #{catalog_vapp_id} not found" unless catalog_vapp
43
- vapp = client.resolve_link catalog_vapp.entity
44
- client.wait_entity vapp, true
45
- client.invoke :delete, vapp.remove_link
46
- client.invoke :delete, catalog_vapp.href
41
+ begin
42
+ catalog_vapp = client.resolve_entity catalog_vapp_id
43
+ if catalog_vapp.nil?
44
+ @logger.warn "Catalog vApp #{catalog_vapp_id} not found, skip the error"
45
+ return
46
+ end
47
+
48
+ vapp = client.resolve_link catalog_vapp.entity
49
+ client.wait_entity vapp, true
50
+ client.invoke :delete, vapp.remove_link
51
+ client.invoke :delete, catalog_vapp.href
52
+ rescue RestClient::Forbidden, ObjectNotFoundError => e
53
+ @logger.warn "get #{e.message} error while deleting Catalog vApp #{catalog_vapp_id} in #delete_stemcell, skip the error"
54
+ return
55
+ end
47
56
  end
48
57
  end
49
58
 
50
- def cpi_call_wait_time; 2; end
59
+ def cpi_call_wait_time
60
+ 2
61
+ end
51
62
 
52
63
  def create_vm(agent_id, catalog_vapp_id, resource_pool, networks, disk_locality = nil, environment = nil)
53
64
  (steps "create_vm(#{agent_id}, #{catalog_vapp_id}, #{resource_pool}, ...)" do |s|
@@ -65,7 +76,7 @@ module VCloudCloud
65
76
 
66
77
 
67
78
  s.next Steps::Instantiate, catalog_vapp_id, vapp_name, description, disk_locality, storage_profile
68
- client.flush_cache # flush cached vdc which contains vapp list
79
+ client.flush_cache # flush cached vdc which contains vapp list
69
80
  vapp = s.state[:vapp]
70
81
  vm = s.state[:vm] = vapp.vms[0]
71
82
 
@@ -195,7 +206,7 @@ module VCloudCloud
195
206
  def has_vm?(vm_id)
196
207
  vm = client.resolve_entity vm_id
197
208
  vm.type == VCloudSdk::Xml::MEDIA_TYPE[:VM]
198
- rescue RestClient::Exception # invalid ID will get 403
209
+ rescue RestClient::Exception # invalid ID will get 403
199
210
  false
200
211
  rescue ObjectNotFoundError
201
212
  false
@@ -203,11 +214,9 @@ module VCloudCloud
203
214
 
204
215
  def delete_vm(vm_id)
205
216
  steps "delete_vm(#{vm_id})" do |s|
206
- vm = s.state[:vm] = client.resolve_entity vm_id
217
+ begin
218
+ vm = s.state[:vm] = client.resolve_entity vm_id
207
219
 
208
- errors = [RuntimeError]
209
- Bosh::Common.retryable(sleep: cpi_call_wait_time, tries: 20, on: errors) do
210
- begin
211
220
  # poweroff vm before we are able to delete it
212
221
  s.next Steps::PowerOff, :vm, true
213
222
 
@@ -222,14 +231,12 @@ module VCloudCloud
222
231
  s.next Steps::Undeploy, :vm
223
232
  s.next Steps::Delete, s.state[:vm], true
224
233
  end
225
- rescue Exception => e
226
- @logger.warn "Caught an exception during delete_vm Exception #{e}, Type #{e.class} Message #{e.message}"
227
- @logger.warn "Exception trace #{e.backtrace.join('\n')}"
228
- raise "re raising exception #{e.message} in delete_vm"
229
- end
230
- end
231
234
 
232
- s.next Steps::DeleteCatalogMedia, vm.name
235
+ s.next Steps::DeleteCatalogMedia, vm.name
236
+ rescue RestClient::Forbidden, ObjectNotFoundError => e
237
+ @logger.warn "get #{e.message} error while deleting vm #{vm_id} likely due to non-existence, skip the error"
238
+ return
239
+ end
233
240
  end
234
241
  end
235
242
 
@@ -254,7 +261,7 @@ module VCloudCloud
254
261
  # vm.hardware_section will change, save current state of disks
255
262
  previous_disks_list = Array.new(vm.hardware_section.hard_disks)
256
263
 
257
- s.state[:disk] = client.resolve_entity disk_id
264
+ s.state[:disk] = client.resolve_entity disk_id
258
265
 
259
266
  errors = [RuntimeError]
260
267
  Bosh::Common.retryable(sleep: cpi_call_wait_time, tries: 20, on: errors) do
@@ -266,7 +273,7 @@ module VCloudCloud
266
273
  s.next Steps::LoadAgentEnv
267
274
 
268
275
  vm = s.state[:vm] = client.reload vm
269
- Steps::CreateOrUpdateAgentEnv.update_persistent_disk s.state[:env], vm, disk_id , previous_disks_list
276
+ Steps::CreateOrUpdateAgentEnv.update_persistent_disk s.state[:env], vm, disk_id, previous_disks_list
270
277
 
271
278
  save_agent_env s
272
279
  rescue Exception => e
@@ -313,8 +320,13 @@ module VCloudCloud
313
320
 
314
321
  def delete_disk(disk_id)
315
322
  steps "delete_disk(#{disk_id})" do |s|
316
- disk = client.resolve_entity disk_id
317
- s.next Steps::Delete, disk, true
323
+ begin
324
+ disk = client.resolve_entity disk_id
325
+ s.next Steps::Delete, disk, true
326
+ rescue RestClient::Forbidden, ObjectNotFoundError => e
327
+ @logger.warn "got #{e.message} error while deleting disk #{disk_id}, skip the error"
328
+ return
329
+ end
318
330
  end
319
331
  end
320
332
 
@@ -348,7 +360,7 @@ module VCloudCloud
348
360
  end
349
361
 
350
362
  def network_names(networks)
351
- networks.map { |k,v| v['cloud_properties']['name'] }.uniq
363
+ networks.map { |k, v| v['cloud_properties']['name'] }.uniq
352
364
  end
353
365
 
354
366
  def reconfigure_vm(s, name, description, resource_pool, networks)
@@ -168,7 +168,8 @@ module VCloudCloud
168
168
  failed_tasks = entity.tasks.find_all { |task| task.status.downcase != VCloudSdk::Xml::TASK_STATUS[:SUCCESS] }
169
169
  unless failed_tasks.empty?
170
170
  @logger.error "Failed tasks: #{failed_tasks}"
171
- raise "Some tasks failed"
171
+ failed_tasks_info = failed_tasks.map {|t| "Task #{t.urn} #{t.operation}"}
172
+ raise "Some tasks failed: #{failed_tasks_info.join('; ')}"
172
173
  end
173
174
  end
174
175
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_vcloud_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-09 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_common
@@ -124,7 +124,7 @@ dependencies:
124
124
  version: '0'
125
125
  description: |-
126
126
  BOSH vCloud CPI
127
- 99eceb
127
+ dc1c42
128
128
  email: support@cloudfoundry.com
129
129
  executables: []
130
130
  extensions: []