fog-vsphere 3.6.0 → 3.6.2

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
  SHA256:
3
- metadata.gz: 894200caa04d87aa819573c86239ebc6f9f6050ff58f6bd8243f2cdb2ba3de62
4
- data.tar.gz: 268630c771bab27449b795987b4368911b5531396ece00817bcab4a19845d162
3
+ metadata.gz: 7ffd073bf26a6cd8fac5eecedbae2cd0ce3b7f0edb11ca52f3f5fc2b45dd6653
4
+ data.tar.gz: e3e921ba25609b8e13a0523918dc25b6b5db6cb1dde66a6f66cad15d0809dc87
5
5
  SHA512:
6
- metadata.gz: c04c8a90cda3331a694eddbe9d4d9e6d0942b47ddf4a824808295fd904dc68b3bed3830a10fde6120ad681a3a8c8534970a1133eee209fd713f5d0b5a1b67994
7
- data.tar.gz: 1d18e55c8326a30f9e2c52ddbff9a87d1f90242b959a8e7eea1b86270134901217b5c61d40890e71cd9f5edcb1ced2c79f9464254453a2536c5b7c490f409af8
6
+ metadata.gz: 48ea23c5093f1e8640d74c856fe40b9d7319c71e8475de3405e28769ebe238284f572c4a1d4b587f6d48b767ff9f652441569935b36746b863f5b2622f26e4a4
7
+ data.tar.gz: e39985451598902c910e565c38f1e9e110feae3aa15014802e0c69628aa28318dc0e8831ea1002630a2697861d4d9889dd2e60c422b425e1782a29e67f898b7a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.6.2
2
+ * Add disk and partitions info
3
+
4
+ ## 3.6.1
5
+ * Revert Unify network ID attribute for Red Hat Satellite
6
+
1
7
  ## 3.6.0
2
8
  * Switch to rbvmomi2 (#281)
3
9
  * Raise the minimum Ruby version to 2.7 (#280)
@@ -160,6 +160,8 @@ module Fog
160
160
  tools_version: 'guest.toolsVersionStatus',
161
161
  memory_mb: 'config.hardware.memoryMB',
162
162
  cpus: 'config.hardware.numCPU',
163
+ disks: 'config.hardware.device',
164
+ partitions: 'guest.disk',
163
165
  corespersocket: 'config.hardware.numCoresPerSocket',
164
166
  overall_status: 'overallStatus',
165
167
  guest_id: 'config.guestId',
@@ -252,6 +254,8 @@ module Fog
252
254
  end
253
255
  }
254
256
 
257
+ attrs['disks'] = parse_disks(attrs['disks'])
258
+ attrs['partitions'] = parse_partitions(attrs['partitions'])
255
259
  attrs['extra_config'] = parse_extra_config(attrs['extra_config'])
256
260
  end
257
261
  # This inline rescue catches any standard error. While a VM is
@@ -317,6 +321,20 @@ module Fog
317
321
  vm_extra_config.map { |entry| [entry[:key], entry[:value]] }.to_h
318
322
  end
319
323
 
324
+ def parse_disks(vm_disks)
325
+ return unless vm_disks.is_a?(Array)
326
+ vm_disks.grep(RbVmomi::VIM::VirtualDisk).map do |d|
327
+ { :label => d.deviceInfo.label, :capacity => d.capacityInBytes }
328
+ end
329
+ end
330
+
331
+ def parse_partitions(vm_partitions)
332
+ return unless vm_partitions.is_a?(Array)
333
+ vm_partitions.grep(RbVmomi::VIM::GuestDiskInfo).map do |p|
334
+ { :path => p.diskPath, :free => p.freeSpace, :capacity => p.capacity }
335
+ end
336
+ end
337
+
320
338
  # returns vmware managed obj id string
321
339
  def managed_obj_id(obj)
322
340
  obj.to_s.match(/\("([^"]+)"\)/)[1]
@@ -35,6 +35,8 @@ module Fog
35
35
  attribute :path
36
36
  attribute :memory_mb
37
37
  attribute :cpus
38
+ attribute :disks
39
+ attribute :partitions
38
40
  attribute :corespersocket
39
41
  attribute :interfaces
40
42
  attribute :volumes
@@ -38,7 +38,7 @@ module Fog
38
38
  # only the one will do
39
39
  proc do |n|
40
40
  n._ref == ref_or_name || (
41
- n.is_a?(RbVmomi::VIM::DistributedVirtualPortgroup) && (n.name == ref_or_name) &&
41
+ n.is_a?(RbVmomi::VIM::DistributedVirtualPortgroup) && (n.name == ref_or_name || n.key == ref_or_name) &&
42
42
  (n.config.distributedVirtualSwitch.name == distributedswitch)
43
43
  )
44
44
  end
@@ -46,12 +46,12 @@ module Fog
46
46
  # the first distributed virtual switch will do - selected by network - gives control to vsphere
47
47
  proc do |n|
48
48
  n._ref == ref_or_name || (
49
- n.is_a?(RbVmomi::VIM::DistributedVirtualPortgroup) && (n.name == ref_or_name)
49
+ n.is_a?(RbVmomi::VIM::DistributedVirtualPortgroup) && (n.name == ref_or_name || n.key == ref_or_name)
50
50
  )
51
51
  end
52
52
  else
53
53
  # the first matching network will do, seems like the non-distributed networks come first
54
- proc { |n| n._ref == ref_or_name || n.name == ref_or_name }
54
+ proc { |n| n._ref == ref_or_name || n.name == ref_or_name || (n.is_a?(RbVmomi::VIM::DistributedVirtualPortgroup) && n.key == ref_or_name) }
55
55
  end
56
56
  end
57
57
  end
@@ -30,15 +30,17 @@ module Fog
30
30
  virtualswitch: dvswitches[network['config.distributedVirtualSwitch']._ref]
31
31
  )
32
32
  elsif network.obj.is_a?(RbVmomi::VIM::OpaqueNetwork)
33
- map_attrs_to_hash(network, network_attribute_mapping).merge(
33
+ map_attrs_to_hash(network, network_dvportgroup_attribute_mapping).merge(
34
+ id: network.obj._ref,
34
35
  opaqueNetworkId: network.obj.summary.opaqueNetworkId
35
36
  )
36
37
  else
37
- map_attrs_to_hash(network, network_attribute_mapping)
38
+ map_attrs_to_hash(network, network_attribute_mapping).merge(
39
+ id: network.obj._ref
40
+ )
38
41
  end.merge(
39
- _ref: network.obj._ref,
40
- id: managed_obj_id(network.obj),
41
- datacenter: datacenter_name
42
+ datacenter: datacenter_name,
43
+ _ref: network.obj._ref
42
44
  )
43
45
  end.compact
44
46
  end
@@ -54,7 +56,7 @@ module Fog
54
56
 
55
57
  def network_dvportgroup_attribute_mapping
56
58
  network_attribute_mapping.merge(
57
- dvp_uuid: 'config.key'
59
+ id: 'config.key'
58
60
  )
59
61
  end
60
62
 
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Vsphere
3
- VERSION = '3.6.0'.freeze
3
+ VERSION = '3.6.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.R. Garcia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-13 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -359,7 +359,7 @@ homepage: https://github.com/fog/fog-vsphere
359
359
  licenses:
360
360
  - MIT
361
361
  metadata: {}
362
- post_install_message:
362
+ post_install_message:
363
363
  rdoc_options: []
364
364
  require_paths:
365
365
  - lib
@@ -374,8 +374,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
374
374
  - !ruby/object:Gem::Version
375
375
  version: '0'
376
376
  requirements: []
377
- rubygems_version: 3.3.26
378
- signing_key:
377
+ rubygems_version: 3.1.6
378
+ signing_key:
379
379
  specification_version: 4
380
380
  summary: Module for the 'fog' gem to support VMware vSphere.
381
381
  test_files: []