fog-vsphere 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTORS.md +1 -0
- data/lib/fog/vsphere/compute.rb +3 -2
- data/lib/fog/vsphere/models/compute/server.rb +6 -0
- data/lib/fog/vsphere/models/compute/volume.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_folders.rb +6 -0
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +51 -0
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f885f4027de3c28c90d0d9909bd13c7c9ec8b339
|
4
|
+
data.tar.gz: afc80dbe162913b73794220d69ca791ea2829ef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee93b2bb15102f94be2510f384651452b6a973626dfc8efef770091c2e58856de199b39c043d1c8316d79f921732b2846ea027f17b3cf03042c2dab2ef087f5
|
7
|
+
data.tar.gz: 7144e530d128aeb69042ec2dfdbf7935eb4130e46f2ef7e5a9bd8097f2385b5bd82715b056558aac00347269017701932756dce6fc3d7b20e08e30096848397c
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTORS.md
CHANGED
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -89,6 +89,7 @@ module Fog
|
|
89
89
|
request :get_virtual_machine
|
90
90
|
request :vm_reconfig_hardware
|
91
91
|
request :vm_reconfig_memory
|
92
|
+
request :vm_reconfig_volumes
|
92
93
|
request :vm_reconfig_cpus
|
93
94
|
request :vm_reconfig_cdrom
|
94
95
|
request :vm_config_vnc
|
@@ -258,7 +259,7 @@ module Fog
|
|
258
259
|
}],
|
259
260
|
"interfaces" =>
|
260
261
|
[{"mac" => "00:50:56:a9:00:28",
|
261
|
-
"network" => "
|
262
|
+
"network" => "dvportgroup-123456",
|
262
263
|
"name" => "Network adapter 1",
|
263
264
|
"status" => "ok",
|
264
265
|
"summary" => "VM Network",
|
@@ -312,7 +313,7 @@ module Fog
|
|
312
313
|
[{ "summary" => "VM Network",
|
313
314
|
"mac" => "00:50:56:a9:00:00",
|
314
315
|
"status" => "ok",
|
315
|
-
"network" => "
|
316
|
+
"network" => "dvportgroup-123456",
|
316
317
|
"name" => "Network adapter 1" }],
|
317
318
|
"hypervisor" => "gunab.puppetlabs.lan",
|
318
319
|
"guest_id" => nil,
|
@@ -80,6 +80,11 @@ module Fog
|
|
80
80
|
service.vm_reconfig_cpus('instance_uuid' => instance_uuid, 'cpus' => cpus, 'corespersocket' => corespersocket)
|
81
81
|
end
|
82
82
|
|
83
|
+
def vm_reconfig_volumes(options = {})
|
84
|
+
requires :instance_uuid, :volumes
|
85
|
+
service.vm_reconfig_volumes('instance_uuid' => instance_uuid, 'volumes' => volumes)
|
86
|
+
end
|
87
|
+
|
83
88
|
def vm_reconfig_hardware(hardware_spec, options = {})
|
84
89
|
requires :instance_uuid
|
85
90
|
service.vm_reconfig_hardware('instance_uuid' => instance_uuid, 'hardware_spec' => hardware_spec)
|
@@ -274,6 +279,7 @@ module Fog
|
|
274
279
|
if persisted?
|
275
280
|
vm_reconfig_cpus if attribute_changed?(:cpus) || attribute_changed?(:corespersocket)
|
276
281
|
vm_reconfig_memory if attribute_changed?(:memory_mb)
|
282
|
+
vm_reconfig_volumes if attribute_changed?(:volumes)
|
277
283
|
else
|
278
284
|
self.id = service.create_vm(attributes)
|
279
285
|
end
|
@@ -39,6 +39,12 @@ module Fog
|
|
39
39
|
[folder, folder.childEntity.grep(RbVmomi::VIM::Folder).map(&method(:child_folders)).flatten]
|
40
40
|
end
|
41
41
|
end
|
42
|
+
class Mock
|
43
|
+
def list_folders(options = {})
|
44
|
+
options.reject! {|k,v| v.nil? } # ignore options with nil value
|
45
|
+
self.data[:folders].values.select {|folder| options.all? {|k,v| folder[k.to_s] == v.to_s }}
|
46
|
+
end
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def vm_reconfig_volumes(options = {})
|
6
|
+
raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
|
7
|
+
raise ArgumentError, "volumes is a required parameter" unless options.key? 'volumes'
|
8
|
+
hardware_spec = {
|
9
|
+
deviceChange: []
|
10
|
+
}
|
11
|
+
options['volumes'].each do |volume|
|
12
|
+
hardware_spec[:deviceChange].push({
|
13
|
+
:operation=>:edit,
|
14
|
+
device: RbVmomi::VIM::VirtualDisk(
|
15
|
+
backing: RbVmomi::VIM::VirtualDiskFlatVer2BackingInfo( diskMode: volume.mode, fileName: volume.filename ),
|
16
|
+
unitNumber: volume.unit_number,
|
17
|
+
key: volume.key,
|
18
|
+
controllerKey: volume.controller_key,
|
19
|
+
capacityInKB: volume.size,
|
20
|
+
)
|
21
|
+
})
|
22
|
+
end
|
23
|
+
vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class Mock
|
28
|
+
def vm_reconfig_volumes(options = {})
|
29
|
+
raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
|
30
|
+
raise ArgumentError, "volumes is a required parameter" unless options.key? 'volumes'
|
31
|
+
hardware_spec = {
|
32
|
+
deviceChange: []
|
33
|
+
}
|
34
|
+
options['volumes'].each do |volume|
|
35
|
+
hardware_spec[:deviceChange].push({
|
36
|
+
:operation=>:edit,
|
37
|
+
device: {
|
38
|
+
backing: { diskMode: volume.mode, fileName: volume.filename },
|
39
|
+
unitNumber: volume.unit_number,
|
40
|
+
key: volume.key,
|
41
|
+
controllerKey: volume.controller_key,
|
42
|
+
capacityInKB: volume.size,
|
43
|
+
}
|
44
|
+
})
|
45
|
+
end
|
46
|
+
vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
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: 1.
|
4
|
+
version: 1.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:
|
11
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -250,6 +250,7 @@ files:
|
|
250
250
|
- lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb
|
251
251
|
- lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb
|
252
252
|
- lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb
|
253
|
+
- lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
|
253
254
|
- lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
|
254
255
|
- lib/fog/vsphere/version.rb
|
255
256
|
- tests/class_from_string_tests.rb
|