fog-vsphere 3.3.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d522f89cf7a0b460bc53861f70f2c14e2e7b9eb28077b6e98ce2bb7c043f88a6
4
- data.tar.gz: f8f87ac00f957fb5506b4b52c404ab92e1a1ba17dd5fb77018e858537e4381cd
3
+ metadata.gz: 1090356cd911b5f4d34de083d7ebd0c26fc10d976155a4896767dbc8c4593001
4
+ data.tar.gz: c52e89e4fb8fbb66654d8555abf1c3d962fa1baf915b8bd5ab45f85a6ae6b789
5
5
  SHA512:
6
- metadata.gz: a2b9cd261f022e924d7316f242f9ae7605f657c34254bc0ca98baa6ef3b29218596a141fcba07a2b01b4ca346d6fa43733046cef87c285adbb4cab9682ad0701
7
- data.tar.gz: 60a07472cf4acd475431f5b54017a6e5b62ad6c70b35ec969f5ca198158b9b657aa6fa38a631c1679a8cc8eb80bdef3dbc0ba9a6d7108d376cc1c6a60eb5840b
6
+ metadata.gz: 5031553aa6291340875c681f9ec771668bc1465e5b09fca9681713a0bab8feda8c5f08e95c11f99f0ffc7a82c18e76e8f1fba6b7dce923641885ccea0dbc1746
7
+ data.tar.gz: c1207ec44317315c925f77efe93b8c5469677fb0807cf3163654052eb63ea5941320672a20cf4a36f8fd92a91a747153846d9f474cd7c16bad335be4679809bb
@@ -1,3 +1,8 @@
1
+ ## v3.4.0
2
+ * list_resource_pools returns incorrect resource pool name (#256)
3
+ * Add ability to create update and delete Resource Pools (#253)
4
+ * Check datastore for existence prior vm_clone
5
+
1
6
  ## v3.3.1
2
7
  Fixes eager zero flag (#251, #252)
3
8
 
@@ -56,9 +56,10 @@
56
56
  * Paul Thornthwaite <paul@brightbox.co.uk>
57
57
  * Paul Thornthwaite <tokengeek@gmail.com>
58
58
  * Paulo Henrique Lopes Ribeiro <plribeiro3000@gmail.com>
59
- * Rohan Arora <roarora@redhat.com>
60
59
  * Rich Daley <rdaley@williamhill.co.uk>
61
60
  * Rich Lane <rlane@club.cc.cmu.edu>
61
+ * Rohan Arora <roarora@redhat.com>
62
+ * Roman Lazoryshchak <lazoryshchak@gmail.com>
62
63
  * Samuel Keeley <samuel@dropbox.com>
63
64
  * Sergio Cambra <sergio@programatica.es>
64
65
  * Shlomi Zadok <shlomi@ben-hanna.com>
@@ -71,6 +71,9 @@ module Fog
71
71
  request :get_cluster
72
72
  request :list_resource_pools
73
73
  request :get_resource_pool
74
+ request :create_resource_pool
75
+ request :update_resource_pool
76
+ request :destroy_resource_pool
74
77
  request :list_networks
75
78
  request :get_network
76
79
  request :list_datastores
@@ -0,0 +1,49 @@
1
+ module Fog
2
+ module Vsphere
3
+ class Compute
4
+ class Real
5
+ def create_resource_pool(attributes = {})
6
+ cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter])
7
+
8
+ root_resource_pool = if attributes[:root_resource_pool_name]
9
+ cluster.resourcePool.find attributes[:root_resource_pool_name]
10
+ else
11
+ cluster.resourcePool
12
+ end
13
+
14
+ root_resource_pool.CreateResourcePool(
15
+ name: attributes[:name],
16
+ spec: get_resource_pool_spec(attributes)
17
+ )
18
+
19
+ get_resource_pool(attributes[:name], attributes[:cluster], attributes[:datacenter])
20
+ end
21
+
22
+ private
23
+
24
+ def get_resource_pool_spec(attributes = {})
25
+ RbVmomi::VIM.ResourceConfigSpec(
26
+ cpuAllocation: get_resource_pool_allocation_spec(attributes.fetch(:cpu, {})),
27
+ memoryAllocation: get_resource_pool_allocation_spec(attributes.fetch(:memory, {}))
28
+ )
29
+ end
30
+
31
+ def get_resource_pool_allocation_spec(attributes = {})
32
+ RbVmomi::VIM.ResourceAllocationInfo(
33
+ reservation: attributes.fetch(:reservation, 0),
34
+ limit: attributes.fetch(:limit, -1),
35
+ expandableReservation: attributes.fetch(:expandable_reservation, false),
36
+ shares: RbVmomi::VIM.SharesInfo(
37
+ level: RbVmomi::VIM.SharesLevel(attributes.fetch(:shares_level, 'normal')),
38
+ shares: attributes.fetch(:shares, 0)
39
+ )
40
+ )
41
+ end
42
+ end
43
+
44
+ class Mock
45
+ def create_resource_pool(attributes = {}); end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Vsphere
3
+ class Compute
4
+ class Real
5
+ def destroy_resource_pool(attributes = {})
6
+ get_raw_resource_pool_by_ref(attributes).Destroy_Task().wait_for_completion
7
+ end
8
+ end
9
+
10
+ class Mock
11
+ def destroy_resource_pool(attributes = {}); end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -36,8 +36,8 @@ module Fog
36
36
  end
37
37
 
38
38
  def resource_pool_attributes(resource_pool, cluster, datacenter)
39
- name = folder_path(resource_pool).gsub(/^.*Resources(\/|)/, '')
40
- name = 'Resources' if name.empty?
39
+ folder_path(resource_pool) =~ /(?<=Resources\/)(.+)/
40
+ name = Regexp.last_match(1) || 'Resources'
41
41
  {
42
42
  id: managed_obj_id(resource_pool),
43
43
  name: name,
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module Vsphere
3
+ class Compute
4
+ class Real
5
+ def update_resource_pool(attributes = {})
6
+ raw_resource_pool = get_raw_resource_pool_by_ref(attributes)
7
+
8
+ raw_resource_pool.UpdateConfig(
9
+ name: attributes[:name],
10
+ config: get_resource_pool_spec(attributes)
11
+ )
12
+
13
+ get_resource_pool(attributes[:name], attributes[:cluster], attributes[:datacenter])
14
+ end
15
+
16
+ private
17
+
18
+ def get_raw_resource_pool_by_ref(attributes = {})
19
+ dc = find_raw_datacenter(attributes[:datacenter])
20
+ cluster = dc.find_compute_resource(attributes[:cluster])
21
+
22
+ list_raw_resource_pools(cluster).detect { |rp| rp._ref == attributes[:ref] }
23
+ end
24
+ end
25
+
26
+ class Mock
27
+ def update_resource_pool(attributes = {}); end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -24,6 +24,9 @@ module Fog
24
24
  raise Fog::Vsphere::Compute::NotFound, "Template #{options['template_path']} Doesn't Exist!" unless get_virtual_machine(options['template_path'], options['datacenter'])
25
25
  raise Fog::Vsphere::Compute::NotFound, "Cluster #{options['resource_pool'][0]} Doesn't Exist in the DC!" unless get_raw_cluster(options["resource_pool"][0], options['datacenter'])
26
26
  raise ArgumentError, 'path option is required' unless options.fetch('dest_folder', '/')
27
+ if options.key?('datastore') && !options['datastore'].nil? && !get_raw_datastore(options['datastore'], options['datacenter'])
28
+ raise Fog::Vsphere::Compute::NotFound, "Datastore #{options['datastore']} Doesn't Exist!"
29
+ end
27
30
  if options.key?('storage_pod') && !options['storage_pod'].nil? && !get_raw_storage_pod(options['storage_pod'], options['datacenter'])
28
31
  raise Fog::Vsphere::Compute::NotFound, "Storage Pod #{options['storage_pod']} Doesn't Exist!"
29
32
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Vsphere
3
- VERSION = '3.3.1'.freeze
3
+ VERSION = '3.4.0'.freeze
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: 3.3.1
4
+ version: 3.4.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: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -240,10 +240,12 @@ files:
240
240
  - lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb
241
241
  - lib/fog/vsphere/requests/compute/create_folder.rb
242
242
  - lib/fog/vsphere/requests/compute/create_group.rb
243
+ - lib/fog/vsphere/requests/compute/create_resource_pool.rb
243
244
  - lib/fog/vsphere/requests/compute/create_rule.rb
244
245
  - lib/fog/vsphere/requests/compute/create_vm.rb
245
246
  - lib/fog/vsphere/requests/compute/current_time.rb
246
247
  - lib/fog/vsphere/requests/compute/destroy_group.rb
248
+ - lib/fog/vsphere/requests/compute/destroy_resource_pool.rb
247
249
  - lib/fog/vsphere/requests/compute/destroy_rule.rb
248
250
  - lib/fog/vsphere/requests/compute/folder_destroy.rb
249
251
  - lib/fog/vsphere/requests/compute/get_cluster.rb
@@ -293,6 +295,7 @@ files:
293
295
  - lib/fog/vsphere/requests/compute/modify_vm_volume.rb
294
296
  - lib/fog/vsphere/requests/compute/revert_to_snapshot.rb
295
297
  - lib/fog/vsphere/requests/compute/set_vm_customvalue.rb
298
+ - lib/fog/vsphere/requests/compute/update_resource_pool.rb
296
299
  - lib/fog/vsphere/requests/compute/update_vm.rb
297
300
  - lib/fog/vsphere/requests/compute/upload_iso.rb
298
301
  - lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb
@@ -335,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
338
  - !ruby/object:Gem::Version
336
339
  version: '0'
337
340
  requirements: []
338
- rubygems_version: 3.0.3
341
+ rubygems_version: 3.1.2
339
342
  signing_key:
340
343
  specification_version: 4
341
344
  summary: Module for the 'fog' gem to support VMware vSphere.