fog-vsphere 1.13.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +0 -4
- data/CHANGELOG.md +9 -0
- data/fog-vsphere.gemspec +1 -1
- data/lib/fog/vsphere/compute.rb +20 -0
- data/lib/fog/vsphere/models/compute/cluster.rb +5 -5
- data/lib/fog/vsphere/models/compute/host.rb +30 -0
- data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +14 -0
- data/lib/fog/vsphere/requests/compute/host_shutdown.rb +14 -0
- data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +14 -0
- data/lib/fog/vsphere/requests/compute/list_clusters.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_hosts.rb +18 -4
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +2 -1
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +7 -5
- data/gemfiles/Gemfile.1.9.2+ +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d0dddb289327d2871f911801e572de9b9f3301a1eb3b0da0e9aeb60f8660fc3d
|
4
|
+
data.tar.gz: 2ed6a2f1ac3c94187cfdfc9dcc683f09c32c382c89872da97914754b4c567514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01ca149030adc6f5d6b76b2ee2f4c9e7986dd533f99ab49cea195f6cb8ec56da761851e577f93dab33fbcb3d4e044637b7f0b98dfbee105a2f87fc4f1c4b52da
|
7
|
+
data.tar.gz: c0eb59366051e13703bf0a81ba091e84796dd1f1aae5e31260eb0bc9fa4dca46d56e4e1514daf06691b497b367b7735bb85f1fd102d4d8ad87c34e708e641ba9
|
data/.travis.yml
CHANGED
@@ -6,8 +6,6 @@ matrix:
|
|
6
6
|
- rvm: jruby-head
|
7
7
|
fast_finish: true
|
8
8
|
include:
|
9
|
-
- rvm: 1.9.3
|
10
|
-
gemfile: gemfiles/Gemfile.1.9.2+
|
11
9
|
- rvm: 2.0.0
|
12
10
|
gemfile: Gemfile
|
13
11
|
- rvm: 2.1.10
|
@@ -18,8 +16,6 @@ matrix:
|
|
18
16
|
gemfile: Gemfile
|
19
17
|
- rvm: 2.4.0
|
20
18
|
gemfile: Gemfile
|
21
|
-
- rvm: jruby-19mode
|
22
|
-
gemfile: gemfiles/Gemfile.1.9.2+
|
23
19
|
- rvm: jruby-head
|
24
20
|
gemfile: Gemfile
|
25
21
|
notifications:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## v2.0.0
|
2
|
+
|
3
|
+
* Drop support for ruby versions < 2.0.0
|
4
|
+
* Fix regex issue when folder contains the datacenter name (#120)
|
5
|
+
* add more attributes to host model (#119)
|
6
|
+
* Fixes listing resource pools for clusters nested in folders (#118)
|
7
|
+
* Add requests to host (#116)
|
8
|
+
* Fix interface code in VM clone (#115)
|
9
|
+
|
1
10
|
## v1.13.1
|
2
11
|
|
3
12
|
* Fix typo of local variable name in clone operation (#114)
|
data/fog-vsphere.gemspec
CHANGED
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -127,6 +127,9 @@ module Fog
|
|
127
127
|
request :vm_remove_snapshot
|
128
128
|
request :vm_acquire_ticket
|
129
129
|
request :vm_relocate
|
130
|
+
request :host_shutdown
|
131
|
+
request :host_start_maintenance
|
132
|
+
request :host_finish_maintenance
|
130
133
|
|
131
134
|
module Shared
|
132
135
|
attr_reader :vsphere_is_vcenter
|
@@ -437,6 +440,7 @@ module Fog
|
|
437
440
|
:num_cpu_cores => "16",
|
438
441
|
:overall_status => "green",
|
439
442
|
:datacenter => "Solutions",
|
443
|
+
:full_path => 'Solutionscluster',
|
440
444
|
:klass => "RbVmomi::VIM::ComputeResource"
|
441
445
|
},
|
442
446
|
{:id => "e4195973-102b-4096-bbd6-5429ff0b35c9",
|
@@ -445,6 +449,7 @@ module Fog
|
|
445
449
|
:num_cpu_cores => "32",
|
446
450
|
:overall_status => "green",
|
447
451
|
:datacenter => "Solutions",
|
452
|
+
:full_path => 'Problemscluster',
|
448
453
|
:klass => "RbVmomi::VIM::ComputeResource"
|
449
454
|
},
|
450
455
|
{
|
@@ -455,6 +460,7 @@ module Fog
|
|
455
460
|
:num_cpu_cores => "32",
|
456
461
|
:overall_status => "green",
|
457
462
|
:datacenter => "Solutions",
|
463
|
+
:full_path => 'Nested/Problemscluster',
|
458
464
|
:klass => "RbVmomi::VIM::ComputeResource"
|
459
465
|
},
|
460
466
|
{:id => "03616b8d-b707-41fd-b3b5-the Second",
|
@@ -463,6 +469,7 @@ module Fog
|
|
463
469
|
:num_cpu_cores => "32",
|
464
470
|
:overall_status => "green",
|
465
471
|
:datacenter => "Solutions",
|
472
|
+
:full_path => 'Nested/Lastcluster',
|
466
473
|
:klass => "RbVmomi::VIM::ComputeResource"}
|
467
474
|
]
|
468
475
|
}
|
@@ -483,6 +490,19 @@ module Fog
|
|
483
490
|
:datacenter => 'Solutions',
|
484
491
|
:cluster => 'Solutionscluster',
|
485
492
|
:name => 'host1.example.com',
|
493
|
+
:model => 'PowerEdge R730',
|
494
|
+
:vendor => 'Dell Inc.',
|
495
|
+
:ipaddress => '1.2.3.4',
|
496
|
+
:ipaddress6 => nil,
|
497
|
+
:hostname => 'host1',
|
498
|
+
:domainname => 'example.com',
|
499
|
+
:product_name => 'VMware ESXi',
|
500
|
+
:uuid => '4c4c4544-0051-3610-8046-c4c44f584a32',
|
501
|
+
:cpu_cores => 20,
|
502
|
+
:cpu_sockets => 2,
|
503
|
+
:cpu_threads => 40,
|
504
|
+
:memory => 824597241856,
|
505
|
+
:product_version => '6.0.0',
|
486
506
|
:vm_ids => ['5032c8a5-9c5e-ba7a-3804-832a03e16381', '502916a3-b42e-17c7-43ce-b3206e9524dc']
|
487
507
|
}
|
488
508
|
}
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
def resource_pools(filters = { })
|
15
15
|
self.attributes[:resource_pools] ||= id.nil? ? [] : service.resource_pools({
|
16
16
|
:service => service,
|
17
|
-
:cluster =>
|
17
|
+
:cluster => full_path,
|
18
18
|
:datacenter => datacenter
|
19
19
|
}.merge(filters))
|
20
20
|
end
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
def datastores(filters = { })
|
23
23
|
self.attributes[:datastores] ||= id.nil? ? [] : service.datastores({
|
24
24
|
:service => service,
|
25
|
-
:cluster =>
|
25
|
+
:cluster => full_path,
|
26
26
|
:datacenter => datacenter
|
27
27
|
}.merge(filters))
|
28
28
|
end
|
@@ -30,17 +30,17 @@ module Fog
|
|
30
30
|
def networks(filters = { })
|
31
31
|
self.attributes[:networks] ||= id.nil? ? [] : service.networks({
|
32
32
|
:service => service,
|
33
|
-
:cluster =>
|
33
|
+
:cluster => full_path,
|
34
34
|
:datacenter => datacenter
|
35
35
|
}.merge(filters))
|
36
36
|
end
|
37
37
|
|
38
38
|
def rules
|
39
|
-
service.rules(:datacenter => datacenter, :cluster =>
|
39
|
+
service.rules(:datacenter => datacenter, :cluster => full_path)
|
40
40
|
end
|
41
41
|
|
42
42
|
def hosts
|
43
|
-
service.hosts(:datacenter => datacenter, :cluster =>
|
43
|
+
service.hosts(:datacenter => datacenter, :cluster => full_path)
|
44
44
|
end
|
45
45
|
|
46
46
|
def to_s
|
@@ -8,10 +8,40 @@ module Fog
|
|
8
8
|
attribute :cluster
|
9
9
|
attribute :name
|
10
10
|
attribute :vm_ids
|
11
|
+
attribute :cpu_cores
|
12
|
+
attribute :cpu_sockets
|
13
|
+
attribute :cpu_threads
|
14
|
+
attribute :memory
|
15
|
+
attribute :uuid
|
16
|
+
|
17
|
+
# Lazy Loaded Attributes
|
18
|
+
[:vm_ids].each do |attr|
|
19
|
+
define_method attr do
|
20
|
+
attributes[attr] = attributes[attr].call if attributes[attr].is_a?(Proc)
|
21
|
+
attributes[attr]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
# End Lazy Loaded Attributes
|
11
25
|
|
12
26
|
def to_s
|
13
27
|
name
|
14
28
|
end
|
29
|
+
|
30
|
+
def memory_mb
|
31
|
+
memory / 1024 / 1024
|
32
|
+
end
|
33
|
+
|
34
|
+
def shutdown
|
35
|
+
service.host_shutdown(name, cluster, datacenter)
|
36
|
+
end
|
37
|
+
|
38
|
+
def start_maintenance
|
39
|
+
service.host_start_maintenance(name, cluster, datacenter)
|
40
|
+
end
|
41
|
+
|
42
|
+
def finish_maintenance
|
43
|
+
service.host_finish_maintenance(name, cluster, datacenter)
|
44
|
+
end
|
15
45
|
end
|
16
46
|
end
|
17
47
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def host_finish_maintenance(name, cluster_name, datacenter_name, timeout = 0)
|
6
|
+
host_ref = get_host(name, cluster_name, datacenter_name)
|
7
|
+
task = host_ref.ExitMaintenanceMode_Task(:timeout => timeout)
|
8
|
+
task.wait_for_completion
|
9
|
+
{ 'task_state' => task.info.state }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def host_shutdown(name, cluster_name, datacenter_name, force = false)
|
6
|
+
host_ref = get_host(name, cluster_name, datacenter_name)
|
7
|
+
task = host_ref.ShutdownHost_Task(:force => force)
|
8
|
+
task.wait_for_completion
|
9
|
+
{ 'task_state' => task.info.state }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def host_start_maintenance(name, cluster_name, datacenter_name, timeout = 0, evacuate_powered_off_vms = false)
|
6
|
+
host_ref = get_host(name, cluster_name, datacenter_name)
|
7
|
+
task = host_ref.EnterMaintenanceMode_Task(:timeout => timeout, :evacuatePoweredOffVms => evacuate_powered_off_vms)
|
8
|
+
task.wait_for_completion
|
9
|
+
{ 'task_state' => task.info.state }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -47,7 +47,7 @@ module Fog
|
|
47
47
|
|
48
48
|
def cluster_path(cluster, datacenter_name)
|
49
49
|
datacenter = find_raw_datacenter(datacenter_name)
|
50
|
-
cluster.pretty_path.gsub(%r{(
|
50
|
+
cluster.pretty_path.gsub(%r{(^#{Regexp.escape(datacenter_name)}|#{Regexp.escape(datacenter.hostFolder.name)})\/}, '')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -11,13 +11,27 @@ module Fog
|
|
11
11
|
|
12
12
|
def host_attributes(host, filters)
|
13
13
|
{
|
14
|
-
datacenter:
|
15
|
-
cluster:
|
16
|
-
name:
|
17
|
-
|
14
|
+
datacenter: filters[:datacenter],
|
15
|
+
cluster: filters[:cluster],
|
16
|
+
name: host[:name],
|
17
|
+
cpu_cores: host.hardware.cpuInfo.numCpuCores,
|
18
|
+
cpu_sockets: host.hardware.cpuInfo.numCpuPackages,
|
19
|
+
cpu_threads: host.hardware.cpuInfo.numCpuThreads,
|
20
|
+
memory: host.hardware.memorySize,
|
21
|
+
uuid: host.hardware.systemInfo.uuid,
|
22
|
+
model: host.hardware.systemInfo.model,
|
23
|
+
vendor: host.hardware.systemInfo.vendor,
|
24
|
+
ipaddress: (host.config.network.vnic.first.spec.ip.ipAddress rescue nil),
|
25
|
+
ipaddress6: (host.config.network.vnic.first.spec.ip.ipV6Config.ipV6Address.first.ipAddress rescue nil),
|
26
|
+
product_name: host.summary.config.product.name,
|
27
|
+
product_version: host.summary.config.product.version,
|
28
|
+
hostname: (host.config.network.dnsConfig.hostName rescue nil),
|
29
|
+
domainname: (host.config.network.dnsConfig.domainName rescue nil),
|
30
|
+
vm_ids: Proc.new { host[:vm].map {|vm| vm.config.instanceUuid } }
|
18
31
|
}
|
19
32
|
end
|
20
33
|
end
|
34
|
+
|
21
35
|
class Mock
|
22
36
|
def list_hosts(filters = {})
|
23
37
|
self.data[:hosts].values.select {|r| r[:datacenter] == filters[:datacenter] && r[:cluster] == filters[:cluster]}
|
@@ -766,7 +766,8 @@ module Fog
|
|
766
766
|
device: template_nic
|
767
767
|
}
|
768
768
|
else
|
769
|
-
|
769
|
+
interface = Fog::Compute::Vsphere::Interface.new(raw_to_hash(template_nic))
|
770
|
+
specs << create_interface(interface, interface.key, :remove, :datacenter => datacenter)
|
770
771
|
end
|
771
772
|
end
|
772
773
|
|
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:
|
4
|
+
version: 2.0.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: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -140,7 +140,6 @@ files:
|
|
140
140
|
- README.md
|
141
141
|
- Rakefile
|
142
142
|
- fog-vsphere.gemspec
|
143
|
-
- gemfiles/Gemfile.1.9.2+
|
144
143
|
- lib/fog/bin/vsphere.rb
|
145
144
|
- lib/fog/vsphere.rb
|
146
145
|
- lib/fog/vsphere/compute.rb
|
@@ -209,6 +208,9 @@ files:
|
|
209
208
|
- lib/fog/vsphere/requests/compute/get_template.rb
|
210
209
|
- lib/fog/vsphere/requests/compute/get_virtual_machine.rb
|
211
210
|
- lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb
|
211
|
+
- lib/fog/vsphere/requests/compute/host_finish_maintenance.rb
|
212
|
+
- lib/fog/vsphere/requests/compute/host_shutdown.rb
|
213
|
+
- lib/fog/vsphere/requests/compute/host_start_maintenance.rb
|
212
214
|
- lib/fog/vsphere/requests/compute/list_child_snapshots.rb
|
213
215
|
- lib/fog/vsphere/requests/compute/list_clusters.rb
|
214
216
|
- lib/fog/vsphere/requests/compute/list_compute_resources.rb
|
@@ -314,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
314
316
|
requirements:
|
315
317
|
- - ">="
|
316
318
|
- !ruby/object:Gem::Version
|
317
|
-
version:
|
319
|
+
version: 2.0.0
|
318
320
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
321
|
requirements:
|
320
322
|
- - ">="
|
@@ -322,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
324
|
version: '0'
|
323
325
|
requirements: []
|
324
326
|
rubyforge_project:
|
325
|
-
rubygems_version: 2.
|
327
|
+
rubygems_version: 2.7.3
|
326
328
|
signing_key:
|
327
329
|
specification_version: 4
|
328
330
|
summary: Module for the 'fog' gem to support VMware vSphere.
|
data/gemfiles/Gemfile.1.9.2+
DELETED