fog-vsphere 0.7.0 → 0.8.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/compute.rb +55 -2
- data/lib/fog/vsphere/models/compute/cluster.rb +21 -1
- data/lib/fog/vsphere/models/compute/datastores.rb +2 -2
- data/lib/fog/vsphere/models/compute/host.rb +18 -0
- data/lib/fog/vsphere/models/compute/hosts.rb +22 -0
- data/lib/fog/vsphere/models/compute/networks.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_vm.rb +11 -5
- data/lib/fog/vsphere/requests/compute/get_host.rb +16 -0
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +18 -6
- data/lib/fog/vsphere/requests/compute/list_hosts.rb +28 -0
- data/lib/fog/vsphere/requests/compute/list_networks.rb +18 -6
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +11 -0
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/models/compute/cluster_tests.rb +19 -0
- data/tests/models/compute/hosts_tests.rb +13 -0
- data/tests/requests/compute/list_datastores_tests.rb +18 -0
- data/tests/requests/compute/list_hosts_tests.rb +11 -0
- data/tests/requests/compute/list_networks_tests.rb +18 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d30a391d089effa12a3ce332e51dbaa45ef22fc
|
4
|
+
data.tar.gz: 3d2ae5f7f2d377f2f9ccb7fc174e6ffad86eea23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 421b024fe77dad72a17dfc72e373ccd989b6b834d65b3315f7d181628be8bff9a2956421bf78497558d83183dfc0a08276380199821b44d88218527d465ce840
|
7
|
+
data.tar.gz: b305b9c8afdeed0d9631b04eed403250d4a36167ebbc306b30122cf84809e7b0c694c2b3b218ddbb04a61b2acc2473af2600a06538c085633f5a17e8042bf854
|
data/CHANGELOG.md
CHANGED
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -47,6 +47,8 @@ module Fog
|
|
47
47
|
collection :cdroms
|
48
48
|
model :rule
|
49
49
|
collection :rules
|
50
|
+
model :host
|
51
|
+
collection :hosts
|
50
52
|
|
51
53
|
request_path 'fog/vsphere/requests/compute'
|
52
54
|
request :current_time
|
@@ -109,6 +111,7 @@ module Fog
|
|
109
111
|
request :create_rule
|
110
112
|
request :list_rules
|
111
113
|
request :destroy_rule
|
114
|
+
request :list_hosts
|
112
115
|
|
113
116
|
module Shared
|
114
117
|
attr_reader :vsphere_is_vcenter
|
@@ -348,6 +351,48 @@ module Fog
|
|
348
351
|
:datacenters => {
|
349
352
|
"Solutions" => {:name => "Solutions", :status => "grey", :path => ['Solutions']}
|
350
353
|
},
|
354
|
+
:datastores => {
|
355
|
+
'Storage1' => {
|
356
|
+
'id' => 'datastore-123456',
|
357
|
+
'name' => 'Storage1',
|
358
|
+
'datacenter' => 'Solutions',
|
359
|
+
'type' => 'VMFS',
|
360
|
+
'freespace' => 697471860736,
|
361
|
+
'accessible' => true,
|
362
|
+
'capacity' => 1099243192320,
|
363
|
+
'uncommitted' => 977158537741,
|
364
|
+
'cluster' => [],
|
365
|
+
},
|
366
|
+
'datastore1' => {
|
367
|
+
'id' => 'datastore-789123',
|
368
|
+
'name' => 'datastore1',
|
369
|
+
'datacenter' => 'Solutions',
|
370
|
+
'type' => 'VMFS',
|
371
|
+
'freespace' => 697471860736,
|
372
|
+
'accessible' => true,
|
373
|
+
'capacity' => 1099243192320,
|
374
|
+
'uncommitted' => 977158537741,
|
375
|
+
'cluster' => ['Solutionscluster'],
|
376
|
+
},
|
377
|
+
},
|
378
|
+
:networks => {
|
379
|
+
'network1' => {
|
380
|
+
'id' => 'dvportgroup-123456',
|
381
|
+
'name' => 'network1',
|
382
|
+
'datacenter' => 'Solutions',
|
383
|
+
'accessible' => true,
|
384
|
+
'virtualswitch' => nil,
|
385
|
+
'cluster' => ['Solutionscluster'],
|
386
|
+
},
|
387
|
+
'network2' => {
|
388
|
+
'id' => 'dvportgroup-789123',
|
389
|
+
'name' => 'network2',
|
390
|
+
'datacenter' => 'Solutions',
|
391
|
+
'accessible' => true,
|
392
|
+
'virtualswitch' => nil,
|
393
|
+
'cluster' => [],
|
394
|
+
},
|
395
|
+
},
|
351
396
|
:folders => {
|
352
397
|
'wibble' => {
|
353
398
|
'name' => 'wibble',
|
@@ -417,6 +462,14 @@ module Fog
|
|
417
462
|
:type => RbVmomi::VIM::ClusterAntiAffinityRuleSpec,
|
418
463
|
:vm_ids => ['5032c8a5-9c5e-ba7a-3804-832a03e16381', '502916a3-b42e-17c7-43ce-b3206e9524dc']
|
419
464
|
}
|
465
|
+
},
|
466
|
+
:hosts => {
|
467
|
+
'Host1' => {
|
468
|
+
:datacenter => 'Solutions',
|
469
|
+
:cluster => 'Solutionscluster',
|
470
|
+
:name => 'host1.example.com',
|
471
|
+
:vm_ids => ['5032c8a5-9c5e-ba7a-3804-832a03e16381', '502916a3-b42e-17c7-43ce-b3206e9524dc']
|
472
|
+
}
|
420
473
|
}
|
421
474
|
}
|
422
475
|
end
|
@@ -498,7 +551,7 @@ module Fog
|
|
498
551
|
:ssl => @vsphere_ssl,
|
499
552
|
:insecure => bad_cert,
|
500
553
|
:debug => @vsphere_debug
|
501
|
-
|
554
|
+
|
502
555
|
# Create a shadow class to change the behaviour of @connection.obj2xml
|
503
556
|
# so that xsd:any types are converted to xsd:int (and not xsd:long).
|
504
557
|
#
|
@@ -520,7 +573,7 @@ module Fog
|
|
520
573
|
end
|
521
574
|
end
|
522
575
|
end
|
523
|
-
|
576
|
+
|
524
577
|
break
|
525
578
|
rescue OpenSSL::SSL::SSLError
|
526
579
|
raise if bad_cert
|
@@ -18,11 +18,31 @@ module Fog
|
|
18
18
|
:datacenter => datacenter
|
19
19
|
}.merge(filters))
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
|
+
def datastores(filters = { })
|
23
|
+
self.attributes[:datastores] ||= id.nil? ? [] : service.datastores({
|
24
|
+
:service => service,
|
25
|
+
:cluster => name,
|
26
|
+
:datacenter => datacenter
|
27
|
+
}.merge(filters))
|
28
|
+
end
|
29
|
+
|
30
|
+
def networks(filters = { })
|
31
|
+
self.attributes[:networks] ||= id.nil? ? [] : service.networks({
|
32
|
+
:service => service,
|
33
|
+
:cluster => name,
|
34
|
+
:datacenter => datacenter
|
35
|
+
}.merge(filters))
|
36
|
+
end
|
37
|
+
|
22
38
|
def rules
|
23
39
|
service.rules(:datacenter => datacenter, :cluster => name)
|
24
40
|
end
|
25
41
|
|
42
|
+
def hosts
|
43
|
+
service.hosts(:datacenter => datacenter, :cluster => name)
|
44
|
+
end
|
45
|
+
|
26
46
|
def to_s
|
27
47
|
name
|
28
48
|
end
|
@@ -5,10 +5,10 @@ module Fog
|
|
5
5
|
autoload :Datastore, File.expand_path('../datastore', __FILE__)
|
6
6
|
|
7
7
|
model Fog::Compute::Vsphere::Datastore
|
8
|
-
attr_accessor :datacenter
|
8
|
+
attr_accessor :datacenter, :cluster
|
9
9
|
|
10
10
|
def all(filters = {})
|
11
|
-
load service.list_datastores(filters.merge(:datacenter => datacenter))
|
11
|
+
load service.list_datastores(filters.merge(:datacenter => datacenter, :cluster => cluster))
|
12
12
|
end
|
13
13
|
|
14
14
|
def get(id)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Hosts < Fog::Collection
|
5
|
+
attribute :datacenter
|
6
|
+
attribute :cluster
|
7
|
+
|
8
|
+
model Fog::Compute::Vsphere::Host
|
9
|
+
|
10
|
+
def all(filters = {})
|
11
|
+
requires :datacenter, :cluster
|
12
|
+
load service.list_hosts(:datacenter => datacenter, :cluster => cluster)
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(name)
|
16
|
+
all.find { |host| host.name == name } or
|
17
|
+
raise Fog::Compute::Vsphere::NotFound, "no such host #{name}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -5,10 +5,10 @@ module Fog
|
|
5
5
|
autoload :Network, File.expand_path('../network', __FILE__)
|
6
6
|
|
7
7
|
model Fog::Compute::Vsphere::Network
|
8
|
-
attr_accessor :datacenter
|
8
|
+
attr_accessor :datacenter, :cluster
|
9
9
|
|
10
10
|
def all(filters = {})
|
11
|
-
f = { :datacenter => datacenter }.merge(filters)
|
11
|
+
f = { :datacenter => datacenter, :cluster => cluster }.merge(filters)
|
12
12
|
load service.list_networks(f)
|
13
13
|
end
|
14
14
|
|
@@ -27,12 +27,17 @@ module Fog
|
|
27
27
|
get_raw_cluster(attributes[:cluster], attributes[:datacenter]).resourcePool
|
28
28
|
end
|
29
29
|
vmFolder = get_raw_vmfolder(attributes[:path], attributes[:datacenter])
|
30
|
+
if attributes.key?(:host)
|
31
|
+
host = get_raw_host(attributes[:host], attributes[:cluster], attributes[:datacenter])
|
32
|
+
else
|
33
|
+
host = nil
|
34
|
+
end
|
30
35
|
# if any volume has a storage_pod set, we deploy the vm on a storage pod instead of the defined datastores
|
31
36
|
pod = get_storage_pod(attributes)
|
32
37
|
if pod
|
33
|
-
vm = create_vm_on_storage_pod(pod, vm_cfg, vmFolder, resource_pool, attributes[:datacenter])
|
38
|
+
vm = create_vm_on_storage_pod(pod, vm_cfg, vmFolder, resource_pool, attributes[:datacenter], host)
|
34
39
|
else
|
35
|
-
vm = create_vm_on_datastore(vm_cfg, vmFolder, resource_pool)
|
40
|
+
vm = create_vm_on_datastore(vm_cfg, vmFolder, resource_pool, host)
|
36
41
|
end
|
37
42
|
vm.config.instanceUuid
|
38
43
|
rescue => e
|
@@ -41,11 +46,11 @@ module Fog
|
|
41
46
|
|
42
47
|
private
|
43
48
|
|
44
|
-
def create_vm_on_datastore(vm_cfg, vmFolder, resource_pool)
|
45
|
-
vm = vmFolder.CreateVM_Task(:config => vm_cfg, :pool => resource_pool).wait_for_completion
|
49
|
+
def create_vm_on_datastore(vm_cfg, vmFolder, resource_pool, host = nil)
|
50
|
+
vm = vmFolder.CreateVM_Task(:config => vm_cfg, :pool => resource_pool, :host => host).wait_for_completion
|
46
51
|
end
|
47
52
|
|
48
|
-
def create_vm_on_storage_pod(storage_pod, vm_cfg, vmFolder, resource_pool, datacenter)
|
53
|
+
def create_vm_on_storage_pod(storage_pod, vm_cfg, vmFolder, resource_pool, datacenter, host = nil)
|
49
54
|
pod_spec = RbVmomi::VIM::StorageDrsPodSelectionSpec.new(
|
50
55
|
:storagePod => get_raw_storage_pod(storage_pod, datacenter),
|
51
56
|
)
|
@@ -55,6 +60,7 @@ module Fog
|
|
55
60
|
:resourcePool => resource_pool,
|
56
61
|
:podSelectionSpec => pod_spec,
|
57
62
|
:configSpec => vm_cfg,
|
63
|
+
:host => host,
|
58
64
|
)
|
59
65
|
srm = @connection.serviceContent.storageResourceManager
|
60
66
|
result = srm.RecommendDatastores(:storageSpec => storage_spec)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
|
6
|
+
protected
|
7
|
+
|
8
|
+
def get_raw_host(name, cluster_name, datacenter_name)
|
9
|
+
cluster = get_raw_cluster(cluster_name, datacenter_name)
|
10
|
+
cluster.host.find { |host| host.name == name } or
|
11
|
+
raise Fog::Compute::Vsphere::NotFound, "no such host #{name}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -4,16 +4,21 @@ module Fog
|
|
4
4
|
class Real
|
5
5
|
def list_datastores(filters = { })
|
6
6
|
datacenter_name = filters[:datacenter]
|
7
|
+
cluster_name = filters.fetch(:cluster, nil)
|
7
8
|
# default to show all datastores
|
8
9
|
only_active = filters[:accessible] || false
|
9
|
-
raw_datastores(datacenter_name).map do |datastore|
|
10
|
+
raw_datastores(datacenter_name, cluster_name).map do |datastore|
|
10
11
|
next if only_active and !datastore.summary.accessible
|
11
12
|
datastore_attributes(datastore, datacenter_name)
|
12
13
|
end.compact
|
13
14
|
end
|
14
15
|
|
15
|
-
def raw_datastores(datacenter_name)
|
16
|
-
|
16
|
+
def raw_datastores(datacenter_name, cluster = nil)
|
17
|
+
if cluster.nil?
|
18
|
+
find_raw_datacenter(datacenter_name).datastore
|
19
|
+
else
|
20
|
+
get_raw_cluster(cluster, datacenter_name).datastore
|
21
|
+
end
|
17
22
|
end
|
18
23
|
protected
|
19
24
|
|
@@ -31,9 +36,16 @@ module Fog
|
|
31
36
|
end
|
32
37
|
end
|
33
38
|
class Mock
|
34
|
-
def list_datastores(
|
35
|
-
|
36
|
-
|
39
|
+
def list_datastores(filters)
|
40
|
+
datacenter_name = filters[:datacenter]
|
41
|
+
cluster_name = filters.fetch(:cluster, nil)
|
42
|
+
if cluster_name.nil?
|
43
|
+
self.data[:datastores].values.select { |d| d['datacenter'] == datacenter_name } or
|
44
|
+
raise Fog::Compute::Vsphere::NotFound
|
45
|
+
else
|
46
|
+
self.data[:datastores].values.select { |d| d['datacenter'] == datacenter_name && d['cluster'].include?(cluster_name) } or
|
47
|
+
raise Fog::Compute::Vsphere::NotFound
|
48
|
+
end
|
37
49
|
end
|
38
50
|
end
|
39
51
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def list_hosts(filters = {})
|
6
|
+
cluster = get_raw_cluster(filters[:cluster], filters[:datacenter])
|
7
|
+
cluster.host.map {|host| host_attributes(host, filters)}
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def host_attributes(host, filters)
|
13
|
+
{
|
14
|
+
datacenter: filters[:datacenter],
|
15
|
+
cluster: filters[:cluster],
|
16
|
+
name: host[:name],
|
17
|
+
vm_ids: host[:vm].map {|vm| vm.config.instanceUuid }
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
class Mock
|
22
|
+
def list_hosts(filters = {})
|
23
|
+
self.data[:hosts].values.select {|r| r[:datacenter] == filters[:datacenter] && r[:cluster] == filters[:cluster]}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -4,16 +4,21 @@ module Fog
|
|
4
4
|
class Real
|
5
5
|
def list_networks(filters = { })
|
6
6
|
datacenter_name = filters[:datacenter]
|
7
|
+
cluster_name = filters.fetch(:cluster, nil)
|
7
8
|
# default to show all networks
|
8
9
|
only_active = filters[:accessible] || false
|
9
|
-
raw_networks(datacenter_name).map do |network|
|
10
|
+
raw_networks(datacenter_name, cluster_name).map do |network|
|
10
11
|
next if only_active and !network.summary.accessible
|
11
12
|
network_attributes(network, datacenter_name)
|
12
13
|
end.compact
|
13
14
|
end
|
14
15
|
|
15
|
-
def raw_networks(datacenter_name)
|
16
|
-
|
16
|
+
def raw_networks(datacenter_name, cluster = nil)
|
17
|
+
if cluster.nil?
|
18
|
+
find_raw_datacenter(datacenter_name).network
|
19
|
+
else
|
20
|
+
get_raw_cluster(cluster, datacenter_name).network
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
protected
|
@@ -29,9 +34,16 @@ module Fog
|
|
29
34
|
end
|
30
35
|
end
|
31
36
|
class Mock
|
32
|
-
def list_networks(
|
33
|
-
|
34
|
-
|
37
|
+
def list_networks(filters)
|
38
|
+
datacenter_name = filters[:datacenter]
|
39
|
+
cluster_name = filters.fetch(:cluster, nil)
|
40
|
+
if cluster_name.nil?
|
41
|
+
self.data[:networks].values.select { |d| d['datacenter'] == datacenter_name } or
|
42
|
+
raise Fog::Compute::Vsphere::NotFound
|
43
|
+
else
|
44
|
+
self.data[:networks].values.select { |d| d['datacenter'] == datacenter_name && d['cluster'].include?(cluster_name) } or
|
45
|
+
raise Fog::Compute::Vsphere::NotFound
|
46
|
+
end
|
35
47
|
end
|
36
48
|
end
|
37
49
|
end
|
@@ -121,6 +121,7 @@ module Fog
|
|
121
121
|
esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host']
|
122
122
|
# The parent of the ESX host itself is a ComputeResource which has a resourcePool
|
123
123
|
resource_pool = esx_host.parent.resourcePool
|
124
|
+
cluster_name = nil
|
124
125
|
end
|
125
126
|
# If the vm given did return a valid resource pool, default to using it for the clone.
|
126
127
|
# Even if specific pools aren't implemented in this environment, we will still get back
|
@@ -129,6 +130,14 @@ module Fog
|
|
129
130
|
# already set.
|
130
131
|
resource_pool ||= vm_mob_ref.resourcePool.nil? ? esx_host.parent.resourcePool : vm_mob_ref.resourcePool
|
131
132
|
|
133
|
+
# Options['host']<~String>
|
134
|
+
# The target host for the virtual machine. Optional.
|
135
|
+
if options.key?('host') && !options['host'].empty? && !cluster_name.nil?
|
136
|
+
host = get_raw_host(options['host'], attributes[:cluster], options['datacenter'])
|
137
|
+
else
|
138
|
+
host = nil
|
139
|
+
end
|
140
|
+
|
132
141
|
# Options['datastore']<~String>
|
133
142
|
# Grab the datastore object if option is set
|
134
143
|
datastore_obj = get_raw_datastore(options['datastore'], options['datacenter']) if options.key?('datastore')
|
@@ -578,9 +587,11 @@ module Fog
|
|
578
587
|
# Next, create a Relocation Spec instance
|
579
588
|
relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:datastore => datastore_obj,
|
580
589
|
:pool => resource_pool,
|
590
|
+
:host => host,
|
581
591
|
:diskMoveType => :moveChildMostDiskBacking)
|
582
592
|
else
|
583
593
|
relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool,
|
594
|
+
:host => host,
|
584
595
|
:transform => options['transform'] || 'sparse')
|
585
596
|
unless options.key?('storage_pod') and datastore_obj.nil?
|
586
597
|
relocation_spec[:datastore] = datastore_obj
|
data/lib/fog/vsphere/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | cluster collection', ['vsphere']) do
|
2
|
+
|
3
|
+
compute = Fog::Compute[:vsphere]
|
4
|
+
|
5
|
+
tests('Cluster collection') do
|
6
|
+
clusters = compute.datacenters.first.clusters
|
7
|
+
|
8
|
+
test('should not be empty') { not clusters.empty? }
|
9
|
+
test('should be a kind of Fog::Compute::Vsphere::Clusters') { clusters.kind_of? Fog::Compute::Vsphere::Clusters }
|
10
|
+
test('should get a cluster') { clusters.get('Solutionscluster').id == '1d4d9a3f-e4e8-4c40-b7fc-263850068fa4' }
|
11
|
+
end
|
12
|
+
|
13
|
+
tests('A cluster should') do
|
14
|
+
cluster = compute.datacenters.first.clusters.get('Solutionscluster')
|
15
|
+
|
16
|
+
test('have datastores') { cluster.datastores.first.kind_of? Fog::Compute::Vsphere::Datastore }
|
17
|
+
test('have networks') { cluster.networks.first.kind_of? Fog::Compute::Vsphere::Network }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
+
|
3
|
+
compute = Fog::Compute[:vsphere]
|
4
|
+
cluster = compute.datacenters.first.clusters.get('Solutionscluster')
|
5
|
+
hosts = cluster.hosts
|
6
|
+
|
7
|
+
tests('The hosts collection') do
|
8
|
+
test('should not be empty') { not hosts.empty? }
|
9
|
+
test('should be a kind of Fog::Compute::Vsphere::Hosts') { hosts.kind_of? Fog::Compute::Vsphere::Hosts }
|
10
|
+
test('should get hosts') { hosts.get('host1.example.com').name == 'host1.example.com' }
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | list_datastores request', ['vsphere']) do
|
2
|
+
|
3
|
+
compute = Fog::Compute[:vsphere]
|
4
|
+
|
5
|
+
tests('The response with datastore filter should') do
|
6
|
+
response = compute.list_datastores(:datacenter => 'Solutions')
|
7
|
+
test('be a kind of Array') { response.kind_of? Array }
|
8
|
+
test('contain Hashes') { response.all? { |i| Hash === i } }
|
9
|
+
test("have 2 elements") {response.length == 2}
|
10
|
+
end
|
11
|
+
|
12
|
+
tests('The response with cluster filter should') do
|
13
|
+
response = compute.list_datastores(:datacenter => 'Solutions', :cluster => 'Solutionscluster')
|
14
|
+
test('be a kind of Array') { response.kind_of? Array }
|
15
|
+
test('contain Hashes') { response.all? { |i| Hash === i } }
|
16
|
+
test("have a single element") {response.length == 1}
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | list_hosts request', ['vsphere']) do
|
2
|
+
|
3
|
+
compute = Fog::Compute[:vsphere]
|
4
|
+
|
5
|
+
tests('The response should') do
|
6
|
+
response = compute.list_hosts(:datacenter => 'Solutions', :cluster => 'Solutionscluster')
|
7
|
+
test('be a kind of Array') { response.kind_of? Array }
|
8
|
+
test('contain Hashes') { response.all? { |i| Hash === i } }
|
9
|
+
test("have 1 element") {response.length == 1}
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | list_networks request', ['vsphere']) do
|
2
|
+
|
3
|
+
compute = Fog::Compute[:vsphere]
|
4
|
+
|
5
|
+
tests('The response with datastore filter should') do
|
6
|
+
response = compute.list_networks(:datacenter => 'Solutions')
|
7
|
+
test('be a kind of Array') { response.kind_of? Array }
|
8
|
+
test('contain Hashes') { response.all? { |i| Hash === i } }
|
9
|
+
test("have 2 elements") {response.length == 2}
|
10
|
+
end
|
11
|
+
|
12
|
+
tests('The response with cluster filter should') do
|
13
|
+
response = compute.list_networks(:datacenter => 'Solutions', :cluster => 'Solutionscluster')
|
14
|
+
test('be a kind of Array') { response.kind_of? Array }
|
15
|
+
test('contain Hashes') { response.all? { |i| Hash === i } }
|
16
|
+
test("have a single element") {response.length == 1}
|
17
|
+
end
|
18
|
+
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: 0.
|
4
|
+
version: 0.8.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-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -159,6 +159,8 @@ files:
|
|
159
159
|
- lib/fog/vsphere/models/compute/datastores.rb
|
160
160
|
- lib/fog/vsphere/models/compute/folder.rb
|
161
161
|
- lib/fog/vsphere/models/compute/folders.rb
|
162
|
+
- lib/fog/vsphere/models/compute/host.rb
|
163
|
+
- lib/fog/vsphere/models/compute/hosts.rb
|
162
164
|
- lib/fog/vsphere/models/compute/interface.rb
|
163
165
|
- lib/fog/vsphere/models/compute/interfaces.rb
|
164
166
|
- lib/fog/vsphere/models/compute/interfacetype.rb
|
@@ -195,6 +197,7 @@ files:
|
|
195
197
|
- lib/fog/vsphere/requests/compute/get_datacenter.rb
|
196
198
|
- lib/fog/vsphere/requests/compute/get_datastore.rb
|
197
199
|
- lib/fog/vsphere/requests/compute/get_folder.rb
|
200
|
+
- lib/fog/vsphere/requests/compute/get_host.rb
|
198
201
|
- lib/fog/vsphere/requests/compute/get_interface_type.rb
|
199
202
|
- lib/fog/vsphere/requests/compute/get_network.rb
|
200
203
|
- lib/fog/vsphere/requests/compute/get_resource_pool.rb
|
@@ -210,6 +213,7 @@ files:
|
|
210
213
|
- lib/fog/vsphere/requests/compute/list_datacenters.rb
|
211
214
|
- lib/fog/vsphere/requests/compute/list_datastores.rb
|
212
215
|
- lib/fog/vsphere/requests/compute/list_folders.rb
|
216
|
+
- lib/fog/vsphere/requests/compute/list_hosts.rb
|
213
217
|
- lib/fog/vsphere/requests/compute/list_interface_types.rb
|
214
218
|
- lib/fog/vsphere/requests/compute/list_networks.rb
|
215
219
|
- lib/fog/vsphere/requests/compute/list_processes.rb
|
@@ -249,6 +253,8 @@ files:
|
|
249
253
|
- tests/helper.rb
|
250
254
|
- tests/helpers/mock_helper.rb
|
251
255
|
- tests/helpers/succeeds_helper.rb
|
256
|
+
- tests/models/compute/cluster_tests.rb
|
257
|
+
- tests/models/compute/hosts_tests.rb
|
252
258
|
- tests/models/compute/rules_tests.rb
|
253
259
|
- tests/models/compute/server_tests.rb
|
254
260
|
- tests/models/compute/server_unit_tests.rb
|
@@ -258,6 +264,9 @@ files:
|
|
258
264
|
- tests/requests/compute/get_network_tests.rb
|
259
265
|
- tests/requests/compute/list_child_snapshots_tests.rb
|
260
266
|
- tests/requests/compute/list_clusters_tests.rb
|
267
|
+
- tests/requests/compute/list_datastores_tests.rb
|
268
|
+
- tests/requests/compute/list_hosts_tests.rb
|
269
|
+
- tests/requests/compute/list_networks_tests.rb
|
261
270
|
- tests/requests/compute/list_storage_pods_test.rb
|
262
271
|
- tests/requests/compute/list_virtual_machines_tests.rb
|
263
272
|
- tests/requests/compute/list_vm_cdroms_tests.rb
|
@@ -307,6 +316,8 @@ test_files:
|
|
307
316
|
- tests/helper.rb
|
308
317
|
- tests/helpers/mock_helper.rb
|
309
318
|
- tests/helpers/succeeds_helper.rb
|
319
|
+
- tests/models/compute/cluster_tests.rb
|
320
|
+
- tests/models/compute/hosts_tests.rb
|
310
321
|
- tests/models/compute/rules_tests.rb
|
311
322
|
- tests/models/compute/server_tests.rb
|
312
323
|
- tests/models/compute/server_unit_tests.rb
|
@@ -316,6 +327,9 @@ test_files:
|
|
316
327
|
- tests/requests/compute/get_network_tests.rb
|
317
328
|
- tests/requests/compute/list_child_snapshots_tests.rb
|
318
329
|
- tests/requests/compute/list_clusters_tests.rb
|
330
|
+
- tests/requests/compute/list_datastores_tests.rb
|
331
|
+
- tests/requests/compute/list_hosts_tests.rb
|
332
|
+
- tests/requests/compute/list_networks_tests.rb
|
319
333
|
- tests/requests/compute/list_storage_pods_test.rb
|
320
334
|
- tests/requests/compute/list_virtual_machines_tests.rb
|
321
335
|
- tests/requests/compute/list_vm_cdroms_tests.rb
|