fog-vsphere 1.8.0 → 1.9.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 +5 -0
- data/lib/fog/vsphere/models/compute/volume.rb +8 -0
- data/lib/fog/vsphere/requests/compute/create_vm.rb +6 -5
- data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +13 -3
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +11 -1
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +1 -10
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be1e2a1637899ea613c7b58dbab33a4414d252e
|
4
|
+
data.tar.gz: c52b5f6072294919ff343ce384213b6ef2eb04b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07c537deccc790717d3166a6de38eba43338e7c59ea12d5073bcf4c2090cb7f4f1f094669d8d262de3c412a83b6f05d59f7940fc725dd54c76361da436206a2b
|
7
|
+
data.tar.gz: 010e3c52e24594f2088f5649145cae621a2aa874250680f48d92815a568017016e73b979f55357e841355bc68595fbc095d9b339d5366659d4181d2d2958a18e
|
data/CHANGELOG.md
CHANGED
@@ -102,7 +102,7 @@ module Fog
|
|
102
102
|
end
|
103
103
|
|
104
104
|
if (disks = attributes[:volumes])
|
105
|
-
devices << disks.map { |disk| create_disk(disk, :add, get_storage_pod(attributes)) }
|
105
|
+
devices << disks.map { |disk| create_disk(disk, :add, storage_pod: get_storage_pod(attributes)) }
|
106
106
|
end
|
107
107
|
|
108
108
|
if (cdroms = attributes[:cdroms])
|
@@ -230,9 +230,9 @@ module Fog
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
def create_disk(disk, operation = :add,
|
233
|
+
def create_disk(disk, operation = :add, options = {})
|
234
234
|
# If we deploy the vm on a storage pod, datastore has to be an empty string
|
235
|
-
if storage_pod
|
235
|
+
if options[:storage_pod]
|
236
236
|
datastore = ''
|
237
237
|
else
|
238
238
|
datastore = "[#{disk.datastore}]"
|
@@ -243,11 +243,10 @@ module Fog
|
|
243
243
|
|
244
244
|
payload = {
|
245
245
|
:operation => operation,
|
246
|
-
:fileOperation => operation == :add ? :create : :destroy,
|
247
246
|
:device => RbVmomi::VIM.VirtualDisk(
|
248
247
|
:key => disk.key,
|
249
248
|
:backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
|
250
|
-
:fileName => datastore,
|
249
|
+
:fileName => options[:filename] || datastore,
|
251
250
|
:diskMode => disk.mode.to_sym,
|
252
251
|
:thinProvisioned => disk.thin
|
253
252
|
),
|
@@ -256,6 +255,8 @@ module Fog
|
|
256
255
|
:capacityInKB => disk.size
|
257
256
|
)
|
258
257
|
}
|
258
|
+
file_operation = options[:file_operation] || (:create if operation == :add)
|
259
|
+
payload[:fileOperation] = file_operation if file_operation
|
259
260
|
|
260
261
|
if operation == :add && disk.thin == 'false' && disk.eager_zero == 'true'
|
261
262
|
payload[:device][:backing][:eagerlyScrub] = disk.eager_zero
|
@@ -26,15 +26,16 @@ module Fog
|
|
26
26
|
backing = create_nic_backing(interface, {})
|
27
27
|
raw_interface.backing = backing
|
28
28
|
end
|
29
|
+
apply_options_to_raw_interface(raw_interface, options)
|
29
30
|
spec = {
|
30
31
|
operation: :edit,
|
31
32
|
device: raw_interface
|
32
|
-
}
|
33
|
+
}
|
33
34
|
vm_reconfig_hardware('instance_uuid' => vmid, 'hardware_spec' => {'deviceChange'=>[spec]})
|
34
35
|
end
|
35
36
|
|
36
37
|
private
|
37
|
-
|
38
|
+
|
38
39
|
def get_interface_from_options(vmid, options)
|
39
40
|
if options and options[:interface]
|
40
41
|
options[:interface]
|
@@ -50,6 +51,15 @@ module Fog
|
|
50
51
|
raise ArgumentError, "interface is a required parameter or pass options with type and network"
|
51
52
|
end
|
52
53
|
end
|
54
|
+
|
55
|
+
def apply_options_to_raw_interface(raw_interface, options)
|
56
|
+
if options[:connectable]
|
57
|
+
options[:connectable].each do |key, value|
|
58
|
+
raw_interface.connectable.send("#{key}=", value)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
raw_interface
|
62
|
+
end
|
53
63
|
end
|
54
64
|
|
55
65
|
class Mock
|
@@ -64,7 +74,7 @@ module Fog
|
|
64
74
|
raise ArgumentError, "interface is a required parameter" unless options and options[:interface]
|
65
75
|
true
|
66
76
|
end
|
67
|
-
|
77
|
+
|
68
78
|
def update_vm_interface(vmid, options = {})
|
69
79
|
return unless options[:interface]
|
70
80
|
options[:interface].network = options[:network]
|
@@ -6,9 +6,15 @@ module Fog
|
|
6
6
|
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_disk(volume, :add)]})
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def remove_vm_volume(volume)
|
10
10
|
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_disk(volume, :remove)]})
|
11
11
|
end
|
12
|
+
|
13
|
+
def destroy_vm_volume(volume)
|
14
|
+
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {
|
15
|
+
'deviceChange'=>[create_disk(volume, :remove, file_operation: :destroy)]
|
16
|
+
})
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
class Mock
|
@@ -16,6 +22,10 @@ module Fog
|
|
16
22
|
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_cdrom(volume, :add)]})
|
17
23
|
end
|
18
24
|
|
25
|
+
def remove_vm_volume(volume)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
19
29
|
def destroy_vm_volume(volume)
|
20
30
|
true
|
21
31
|
end
|
@@ -9,16 +9,7 @@ module Fog
|
|
9
9
|
deviceChange: []
|
10
10
|
}
|
11
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
|
-
})
|
12
|
+
hardware_spec[:deviceChange].push(create_disk(volume, :edit, filename: volume.filename))
|
22
13
|
end
|
23
14
|
vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
|
24
15
|
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.9.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: 2017-03-
|
11
|
+
date: 2017-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|