fog-vsphere 3.6.6 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -0
- data/fog-vsphere.gemspec +40 -0
- data/lib/fog/vsphere/compute.rb +2 -0
- 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/version.rb +1 -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: c2d12d766e82a1faadbe212c6bd4b456f2f5d8b5020eea068e3baf03bfed784a
|
4
|
+
data.tar.gz: 9c83dbf3aedac89dd590e6ca916aa88a66c8bf3fe3340e94c9e42de919c9cb98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7c125bd12412bf05a7bb3941bf911f84b3fffd5a75e029b4af16173551c8059c1ac2325fc75eded98705f284a82116616473ff49c86f0b56eb98131a2ada32a
|
7
|
+
data.tar.gz: 83783358165788fa50e94953c1946f0ab86abb3d0d93bbca2d91932abbb1be003e5b6ad2ba8f74aa2108bbbf23d8da70664c74cc06578c04b4351687b4fb3b22
|
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'
|
@@ -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
|
data/lib/fog/vsphere/version.rb
CHANGED
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.
|
4
|
+
version: 3.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J.R. Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -216,9 +216,11 @@ extra_rdoc_files: []
|
|
216
216
|
files:
|
217
217
|
- CHANGELOG.md
|
218
218
|
- CONTRIBUTORS.md
|
219
|
+
- Gemfile
|
219
220
|
- LICENSE.md
|
220
221
|
- README.md
|
221
222
|
- Rakefile
|
223
|
+
- fog-vsphere.gemspec
|
222
224
|
- lib/fog-vsphere.rb
|
223
225
|
- lib/fog/bin/vsphere.rb
|
224
226
|
- lib/fog/vsphere.rb
|