bosh_vsphere_cpi 1.2682.1.0 → 1.2685.0

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: 52a22d440892009f6d466516f79a97199fb0844a
4
- data.tar.gz: 4c6b71b6074141153e45c53eebd96ab943d585ed
3
+ metadata.gz: bb75a5c5f99392b3883c23316028c678d7805d1c
4
+ data.tar.gz: 02d9fc933cac7271b579cbbfc0b883e11b8f75ca
5
5
  SHA512:
6
- metadata.gz: c7dcc9e25e6fb4ae5829d584b48acc617c0fa3541bfce3294cee175a62a5370b3cd785eb33923e577c8706b7d266e1cacd872af33161c87ef03f85df1f72c3c6
7
- data.tar.gz: 7fca5156afcd197254c5f864eaf939aad4685c34fc55cd02b4a82a4138f3f9fbfe1afe942d2c24be798fc93a0a2603517732316edbe3c41156e3716edf7d0afb
6
+ metadata.gz: a3d9fc81fc4a51f342910c6bffd52309a0875f174bc54edddca84d870368721d48335d96f089af270f52c0a7a26e34d2dcbf55d599ee124cd6cee9d12689f377
7
+ data.tar.gz: 4880e3ba35be392ae34ed87cd9980339b37896fdfeac2076d5963be5dd1e09e2c1e7fdb520a37f08c112c7e4caaf0fba26535d99e7fd39386be8cee8ad181c89
@@ -235,6 +235,22 @@ module VSphereCloud
235
235
  wait_for_task(task)
236
236
  end
237
237
 
238
+ def has_disk?(disk_path, disk_datacenter)
239
+ datacenter = find_by_inventory_path(disk_datacenter)
240
+
241
+ [".vmdk", "-flat.vmdk"].each do |extension|
242
+ begin
243
+ uuid = @service_content.virtual_disk_manager.query_virtual_disk_uuid(
244
+ "#{disk_path}#{extension}", datacenter
245
+ )
246
+ return true if uuid
247
+ rescue VimSdk::SoapError
248
+ end
249
+ end
250
+
251
+ false
252
+ end
253
+
238
254
  def find_by_inventory_path(path)
239
255
  full_path = Array(path).join("/")
240
256
  @service_content.search_index.find_by_inventory_path(full_path)
@@ -72,6 +72,16 @@ module VSphereCloud
72
72
  false
73
73
  end
74
74
 
75
+ def has_disk?(disk_id)
76
+ disk = VSphereCloud::Models::Disk.find(uuid: disk_id)
77
+
78
+ return false unless disk
79
+ return false unless disk.path
80
+ return false unless disk.datacenter
81
+
82
+ @client.has_disk?(disk.path, disk.datacenter)
83
+ end
84
+
75
85
  def create_stemcell(image, _)
76
86
  with_thread_name("create_stemcell(#{image}, _)") do
77
87
  result = nil
@@ -503,8 +513,17 @@ module VSphereCloud
503
513
 
504
514
  vm = get_vm_by_cid(vm_cid)
505
515
 
506
- devices = client.get_property(vm, Vim::VirtualMachine, 'config.hardware.device', ensure_all: true)
516
+ location = get_vm_location(vm)
517
+ env = @agent_env.get_current_env(vm, location[:datacenter])
518
+ @logger.info("Reading current agent env: #{env.pretty_inspect}")
519
+ if env['disks']['persistent'][disk.uuid]
520
+ env['disks']['persistent'].delete(disk.uuid)
521
+ @logger.info("Updating agent env to: #{env.pretty_inspect}")
507
522
 
523
+ @agent_env.set_env(vm, location, env)
524
+ end
525
+
526
+ devices = client.get_property(vm, Vim::VirtualMachine, 'config.hardware.device', ensure_all: true)
508
527
  vmdk_path = "#{disk.path}.vmdk"
509
528
  virtual_disk =
510
529
  devices.find do |device|
@@ -516,13 +535,6 @@ module VSphereCloud
516
535
  config.device_change = []
517
536
  config.device_change << create_delete_device_spec(virtual_disk)
518
537
 
519
- location = get_vm_location(vm)
520
- env = @agent_env.get_current_env(vm, location[:datacenter])
521
- @logger.info("Reading current agent env: #{env.pretty_inspect}")
522
- env['disks']['persistent'].delete(disk.uuid)
523
- @logger.info("Updating agent env to: #{env.pretty_inspect}")
524
-
525
- @agent_env.set_env(vm, location, env)
526
538
  @logger.info('Detaching disk')
527
539
  client.reconfig_vm(vm, config)
528
540
 
@@ -1,7 +1,7 @@
1
1
  module Bosh
2
2
  module Clouds
3
3
  class VSphere
4
- VERSION = '1.2682.1.0'
4
+ VERSION = '1.2685.0'
5
5
  end
6
6
  end
7
7
  end
data/lib/cloud/vsphere.rb CHANGED
@@ -15,7 +15,7 @@ module Bosh
15
15
  :create_vm, :delete_vm, :reboot_vm, :has_vm?,
16
16
  :set_vm_metadata,
17
17
  :configure_networks,
18
- :create_disk, :delete_disk,
18
+ :create_disk, :has_disk?, :delete_disk,
19
19
  :attach_disk, :detach_disk,
20
20
  :snapshot_disk, :delete_snapshot,
21
21
  :current_vm_id, :get_disks, :ping
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_vsphere_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2682.1.0
4
+ version: 1.2685.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_common
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2682.1.0
19
+ version: 1.2685.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.2682.1.0
26
+ version: 1.2685.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.2682.1.0
33
+ version: 1.2685.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.2682.1.0
40
+ version: 1.2685.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: membrane
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  version: 2.4.0
139
139
  description: |-
140
140
  BOSH VSphere CPI
141
- 93a782
141
+ 989d8b
142
142
  email: support@cloudfoundry.com
143
143
  executables:
144
144
  - vsphere_cpi