fog-vsphere 1.6.0 → 1.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed406936e8160692fc51175c72c9011fecd95653
4
- data.tar.gz: 7f184ce06c1b43431c84da12d2880589d570d724
3
+ metadata.gz: f885f4027de3c28c90d0d9909bd13c7c9ec8b339
4
+ data.tar.gz: afc80dbe162913b73794220d69ca791ea2829ef0
5
5
  SHA512:
6
- metadata.gz: 7c3892e6447634c9cb464ac7fd9aae19ef12c7583a0fa6f598a66055e6aee66007e4dfa44e8859b417da0cdf3b1ec71f732196e6bff2b0de3d20d4a9e5149410
7
- data.tar.gz: 8f99da266df8a4aa7182d383601562664fa26a3c50a2dfbad5cb2b4479ade1a3f2e3756d7d4db13172421cf5210ee0e7b12dbb06b961203ffae407f110dc6c1f
6
+ metadata.gz: 6ee93b2bb15102f94be2510f384651452b6a973626dfc8efef770091c2e58856de199b39c043d1c8316d79f921732b2846ea027f17b3cf03042c2dab2ef087f5
7
+ data.tar.gz: 7144e530d128aeb69042ec2dfdbf7935eb4130e46f2ef7e5a9bd8097f2385b5bd82715b056558aac00347269017701932756dce6fc3d7b20e08e30096848397c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.7.0
2
+
3
+ * Update volumes when `save` is called on Server
4
+ * Add the ability to update the size of attached virtual disks
5
+ * Improve mocks for folders and networks
6
+
1
7
  ## v1.6.0
2
8
 
3
9
  * Support updating of server CPUs and memory
data/CONTRIBUTORS.md CHANGED
@@ -1,3 +1,4 @@
1
+ * Adam, Till - D0249540 <till.adam@dm.de>
1
2
  * Ahmed Elsabbahy <aelsabbahy@promnetwork.com>
2
3
  * Alan Sebastian <asebastian2@gmail.com>
3
4
  * Ben Talbot - btalbot <ben_t48@hotmail.com>
@@ -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" => "VM 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" => "VM 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
@@ -29,6 +29,7 @@ module Fog
29
29
 
30
30
  def size_gb= s
31
31
  attributes[:size] = s.to_i * DISK_SIZE_TO_GB if s
32
+ attributes[:size_gb] = s.to_i if s
32
33
  end
33
34
 
34
35
  def to_s
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Vsphere
3
- VERSION = '1.6.0'
3
+ VERSION = '1.7.0'
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: 1.6.0
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: 2016-12-30 00:00:00.000000000 Z
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