fog-vsphere 3.6.6 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +5 -0
- data/fog-vsphere.gemspec +40 -0
- data/lib/fog/vsphere/compute.rb +3 -1
- data/lib/fog/vsphere/models/compute/server.rb +2 -0
- data/lib/fog/vsphere/requests/compute/create_vm.rb +15 -1
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +2 -1
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/fixtures/vcr_cassettes/6_7/get_template.yml +7750 -50
- data/tests/fixtures/vcr_cassettes/6_7/get_virtual_machine.yml +7925 -44
- data/tests/requests/compute/get_template_tests.rb +2 -2
- data/tests/requests/compute/get_virtual_machine_tests.rb +2 -2
- data/tests/test_helper.rb +3 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fde8da8e67f090b3268f7c130b48d8730fb7fc1fcd922579c66f1ee67f50b19
|
4
|
+
data.tar.gz: 3fc30e334b66725ab517afc440dbdcbe3804c0565d8ad6e90d396529d9249d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a2c98ab7b82db9587b12cfc7bb06bd23a1346a9048cbf16bfec1d6e20b20ec0b9f39ee2a8912f92f7aec3c1a6e42caef3f37f9af6ddd6527468c572c08b76f0
|
7
|
+
data.tar.gz: c7569f04cade03956f13d637a6cebe77d5cefd97535c62b604b62c115c53cd423548f1379a94c96a7f1c74636f57b3f2d58fc26548b43d66580c6b757b7d53f0
|
data/Gemfile
ADDED
data/fog-vsphere.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fog/vsphere/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'fog-vsphere'
|
8
|
+
spec.version = Fog::Vsphere::VERSION
|
9
|
+
spec.authors = ['J.R. Garcia']
|
10
|
+
spec.email = ['jr@garciaole.com']
|
11
|
+
|
12
|
+
spec.summary = "Module for the 'fog' gem to support VMware vSphere."
|
13
|
+
spec.description = 'This library can be used as a module for `fog` or as standalone provider to use vSphere in applications.'
|
14
|
+
spec.homepage = 'https://github.com/fog/fog-vsphere'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = Dir['lib/**/*'] +
|
18
|
+
['LICENSE.md', 'Rakefile', 'README.md', 'CHANGELOG.md', 'CONTRIBUTORS.md', 'Gemfile', 'fog-vsphere.gemspec']
|
19
|
+
spec.test_files = Dir['tests/**/*']
|
20
|
+
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.required_ruby_version = '>= 2.7'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'fog-core'
|
26
|
+
spec.add_runtime_dependency 'rbvmomi2', '~> 3.0'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler'
|
29
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
30
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
31
|
+
spec.add_development_dependency 'minitest', '~> 5.22'
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 1.39.0'
|
33
|
+
spec.add_development_dependency 'rubocop-minitest'
|
34
|
+
spec.add_development_dependency 'rubocop-performance'
|
35
|
+
spec.add_development_dependency 'rubocop-rake'
|
36
|
+
spec.add_development_dependency 'mocha', '~> 2.2'
|
37
|
+
spec.add_development_dependency 'shindo', '~> 0.3'
|
38
|
+
spec.add_development_dependency 'webmock', '~> 3.5'
|
39
|
+
spec.add_development_dependency 'vcr', '~> 6.0'
|
40
|
+
end
|
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -156,6 +156,7 @@ module Fog
|
|
156
156
|
parent: 'parent',
|
157
157
|
hostname: 'summary.guest.hostName',
|
158
158
|
operatingsystem: 'summary.guest.guestFullName',
|
159
|
+
virtual_tpm: 'summary.config.tpmPresent',
|
159
160
|
ipaddress: 'guest.ipAddress',
|
160
161
|
power_state: 'runtime.powerState',
|
161
162
|
connection_state: 'runtime.connectionState',
|
@@ -173,6 +174,7 @@ module Fog
|
|
173
174
|
cpuHotAddEnabled: 'config.cpuHotAddEnabled',
|
174
175
|
memoryHotAddEnabled: 'config.memoryHotAddEnabled',
|
175
176
|
firmware: 'config.firmware',
|
177
|
+
secure_boot: 'config.bootOptions.efiSecureBootEnabled',
|
176
178
|
boot_order: 'config.bootOptions.bootOrder',
|
177
179
|
annotation: 'config.annotation',
|
178
180
|
extra_config: 'config.extraConfig'
|
@@ -345,7 +347,7 @@ module Fog
|
|
345
347
|
end
|
346
348
|
|
347
349
|
def is_uuid?(id)
|
348
|
-
|
350
|
+
id.is_a?(String) && /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/.match?(id)
|
349
351
|
end
|
350
352
|
end
|
351
353
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Vsphere
|
3
3
|
class Compute
|
4
|
+
# rubocop:disable Metrics/ClassLength
|
4
5
|
class Real
|
5
6
|
def create_vm(attributes = {})
|
6
7
|
# build up vm configuration
|
@@ -22,7 +23,7 @@ module Fog
|
|
22
23
|
vm_cfg[:cpuHotAddEnabled] = attributes[:cpuHotAddEnabled] if attributes.key?(:cpuHotAddEnabled)
|
23
24
|
vm_cfg[:memoryHotAddEnabled] = attributes[:memoryHotAddEnabled] if attributes.key?(:memoryHotAddEnabled)
|
24
25
|
vm_cfg[:firmware] = attributes[:firmware] if attributes.key?(:firmware)
|
25
|
-
vm_cfg[:bootOptions] = boot_options(attributes, vm_cfg)
|
26
|
+
vm_cfg[:bootOptions] = boot_options(attributes, vm_cfg)
|
26
27
|
resource_pool = if attributes[:resource_pool] && attributes[:resource_pool] != 'Resources'
|
27
28
|
get_raw_resource_pool(attributes[:resource_pool], attributes[:cluster], attributes[:datacenter])
|
28
29
|
else
|
@@ -153,6 +154,9 @@ module Fog
|
|
153
154
|
if (cdroms = attributes[:cdroms])
|
154
155
|
devices << cdroms.map { |cdrom| create_cdrom(cdrom, cdroms.index(cdrom)) }
|
155
156
|
end
|
157
|
+
|
158
|
+
devices << create_virtual_tpm if attributes[:virtual_tpm]
|
159
|
+
|
156
160
|
devices.flatten
|
157
161
|
end
|
158
162
|
|
@@ -170,6 +174,8 @@ module Fog
|
|
170
174
|
options[:bootRetryDelay] = attributes[:boot_retry]
|
171
175
|
end
|
172
176
|
|
177
|
+
options[:efiSecureBootEnabled] = attributes[:secure_boot] if attributes.key?(:secure_boot)
|
178
|
+
|
173
179
|
options.empty? ? nil : RbVmomi::VIM::VirtualMachineBootOptions.new(options)
|
174
180
|
end
|
175
181
|
|
@@ -333,12 +339,20 @@ module Fog
|
|
333
339
|
}
|
334
340
|
end
|
335
341
|
|
342
|
+
def create_virtual_tpm
|
343
|
+
{
|
344
|
+
operation: :add,
|
345
|
+
device: RbVmomi::VIM::VirtualTPM.new(key: -1)
|
346
|
+
}
|
347
|
+
end
|
348
|
+
|
336
349
|
def extra_config(attributes)
|
337
350
|
extra_config = attributes[:extra_config] || { 'bios.bootOrder' => 'ethernet0' }
|
338
351
|
extra_config.map { |k, v| { key: k, value: v.to_s } }
|
339
352
|
end
|
340
353
|
end
|
341
354
|
|
355
|
+
# rubocop:enable Metrics/ClassLength
|
342
356
|
class Mock
|
343
357
|
def create_vm(attributes = {})
|
344
358
|
id = SecureRandom.uuid
|
@@ -173,6 +173,7 @@ module Fog
|
|
173
173
|
device_change.concat(modify_template_volumes_specs(vm_mob_ref, options['volumes']))
|
174
174
|
device_change.concat(add_new_volumes_specs(vm_mob_ref, options['volumes'])) unless options['storage_pod']
|
175
175
|
end
|
176
|
+
device_change << create_virtual_tpm if options['virtual_tpm'].present?
|
176
177
|
virtual_machine_config_spec.deviceChange = device_change if device_change.any?
|
177
178
|
# Options['numCPUs'] or Options['memoryMB']
|
178
179
|
# Build up the specification for Hardware, for more details see ____________
|
@@ -216,7 +217,7 @@ module Fog
|
|
216
217
|
RbVmomi::VIM::VirtualMachineBootOptionsBootableFloppyDevice.new
|
217
218
|
end
|
218
219
|
end
|
219
|
-
virtual_machine_config_spec.bootOptions = { bootOrder: boot_order }
|
220
|
+
virtual_machine_config_spec.bootOptions = { bootOrder: boot_order, efiSecureBootEnabled: options["secure_boot"] || false }
|
220
221
|
end
|
221
222
|
# Options['customization_spec']
|
222
223
|
# OLD Options still supported
|
data/lib/fog/vsphere/version.rb
CHANGED