fog-vsphere 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +10 -0
- data/CONTRIBUTING.md +42 -5
- data/README.md +1 -0
- data/fog-vsphere.gemspec +3 -1
- data/lib/fog/vsphere/compute.rb +21 -0
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/create_vm.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_network.rb +23 -8
- data/lib/fog/vsphere/requests/compute/list_networks.rb +1 -1
- data/lib/fog/vsphere/requests/compute/update_vm.rb +12 -5
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +8 -6
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +32 -88
- data/tests/class_from_string_tests.rb +0 -33
- data/tests/compute_tests.rb +0 -53
- data/tests/helper.rb +0 -9
- data/tests/helpers/mock_helper.rb +0 -9
- data/tests/helpers/succeeds_helper.rb +0 -9
- data/tests/models/compute/cluster_tests.rb +0 -18
- data/tests/models/compute/hosts_tests.rb +0 -11
- data/tests/models/compute/rules_tests.rb +0 -28
- data/tests/models/compute/server_tests.rb +0 -74
- data/tests/models/compute/server_unit_tests.rb +0 -13
- data/tests/models/compute/servers_tests.rb +0 -13
- data/tests/models/compute/ticket_tests.rb +0 -12
- data/tests/models/compute/tickets_tests.rb +0 -8
- data/tests/requests/compute/current_time_tests.rb +0 -10
- data/tests/requests/compute/folder_destroy_tests.rb +0 -19
- data/tests/requests/compute/get_network_tests.rb +0 -55
- data/tests/requests/compute/list_child_snapshots_tests.rb +0 -9
- data/tests/requests/compute/list_clusters_tests.rb +0 -10
- data/tests/requests/compute/list_datastores_tests.rb +0 -17
- data/tests/requests/compute/list_hosts_tests.rb +0 -10
- data/tests/requests/compute/list_networks_tests.rb +0 -17
- data/tests/requests/compute/list_storage_pods_test.rb +0 -9
- data/tests/requests/compute/list_virtual_machines_tests.rb +0 -34
- data/tests/requests/compute/list_vm_cdroms_tests.rb +0 -9
- data/tests/requests/compute/list_vm_snapshots_tests.rb +0 -9
- data/tests/requests/compute/modify_vm_cdrom_tests.rb +0 -20
- data/tests/requests/compute/revert_to_snapshot_tests.rb +0 -13
- data/tests/requests/compute/set_vm_customvalue_tests.rb +0 -18
- data/tests/requests/compute/update_vm_tests.rb +0 -13
- data/tests/requests/compute/vm_clone_tests.rb +0 -55
- data/tests/requests/compute/vm_config_vnc_tests.rb +0 -18
- data/tests/requests/compute/vm_destroy_tests.rb +0 -14
- data/tests/requests/compute/vm_migrate_tests.rb +0 -15
- data/tests/requests/compute/vm_power_off_tests.rb +0 -24
- data/tests/requests/compute/vm_power_on_tests.rb +0 -15
- data/tests/requests/compute/vm_reboot_tests.rb +0 -24
- data/tests/requests/compute/vm_reconfig_cdrom_tests.rb +0 -14
- data/tests/requests/compute/vm_reconfig_cpus_tests.rb +0 -17
- data/tests/requests/compute/vm_reconfig_hardware_tests.rb +0 -17
- data/tests/requests/compute/vm_reconfig_memory_tests.rb +0 -17
- data/tests/requests/compute/vm_suspend_tests.rb +0 -23
- data/tests/requests/compute/vm_take_snapshot_tests.rb +0 -17
@@ -1,17 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | list_networks request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
tests('The response with datastore filter should') do
|
5
|
-
response = compute.list_networks(datacenter: 'Solutions')
|
6
|
-
test('be a kind of Array') { response.is_a? Array }
|
7
|
-
test('contain Hashes') { response.all? { |i| Hash === i } }
|
8
|
-
test('have 2 elements') { response.length == 2 }
|
9
|
-
end
|
10
|
-
|
11
|
-
tests('The response with cluster filter should') do
|
12
|
-
response = compute.list_networks(datacenter: 'Solutions', cluster: 'Solutionscluster')
|
13
|
-
test('be a kind of Array') { response.is_a? Array }
|
14
|
-
test('contain Hashes') { response.all? { |i| Hash === i } }
|
15
|
-
test('have a single element') { response.length == 1 }
|
16
|
-
end
|
17
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | list_storage_pods request', ['vsphere']) do
|
2
|
-
tests('When listing all storage pods') do
|
3
|
-
response = Fog::Compute[:vsphere].list_storage_pods
|
4
|
-
|
5
|
-
tests('The response data format ...') do
|
6
|
-
test('be a kind of Hash') { response.is_a? Array }
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | list_virtual_machines request', ['vsphere']) do
|
2
|
-
tests('When listing all machines') do
|
3
|
-
response = Fog::Compute[:vsphere].list_virtual_machines
|
4
|
-
|
5
|
-
tests('The response data format ...') do
|
6
|
-
test('be a kind of Hash') { response.is_a? Array }
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
tests('When providing an instance_uuid') do
|
11
|
-
# pending unless Fog.mock?
|
12
|
-
|
13
|
-
tests('that does exist') do
|
14
|
-
uuid = '5029c440-85ee-c2a1-e9dd-b63e39364603'
|
15
|
-
response = Fog::Compute[:vsphere].list_virtual_machines('instance_uuid' => uuid)
|
16
|
-
|
17
|
-
tests('The response should') do
|
18
|
-
test('contain one vm') { response.length == 1 }
|
19
|
-
test('contain that is an attribute hash') { response[0].is_a? Hash }
|
20
|
-
test('find jefftest') { response.first['name'] == 'jefftest' }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
tests('that does not exist or is a template') do
|
25
|
-
%w[does-not-exist-and-is-not-a-uuid 50323f93-6835-1178-8b8f-9e2109890e1a].each do |uuid|
|
26
|
-
response = Fog::Compute[:vsphere].list_virtual_machines('instance_uuid' => uuid)
|
27
|
-
|
28
|
-
tests('The response should') do
|
29
|
-
test('be empty') { response.empty? }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | list_vm_cdroms request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
tests('The response should') do
|
5
|
-
response = compute.list_vm_cdroms('5032c8a5-9c5e-ba7a-3804-832a03e16381')
|
6
|
-
test('be a kind of Array') { response.is_a? Array }
|
7
|
-
test('it should contains Hashes') { response.all? { |i| Hash === i } }
|
8
|
-
end
|
9
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | list_vm_snapshots request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
tests('The response should') do
|
5
|
-
response = compute.list_vm_snapshots('5032c8a5-9c5e-ba7a-3804-832a03e16381')
|
6
|
-
test('be a kind of Array') { response.is_a? Array }
|
7
|
-
test('it should contains Hashes') { response.all? { |i| Hash === i } }
|
8
|
-
end
|
9
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | modify_vm_cdrom request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
modify_target = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
5
|
-
modify_cdrom = compute.cdroms.new(
|
6
|
-
instance_uuid: modify_target
|
7
|
-
)
|
8
|
-
|
9
|
-
tests('When adding a cdrom the response should') do
|
10
|
-
response = compute.add_vm_cdrom(modify_cdrom)
|
11
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
12
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
13
|
-
end
|
14
|
-
|
15
|
-
tests('When destroying a cdrom the response should') do
|
16
|
-
response = compute.destroy_vm_cdrom(modify_cdrom)
|
17
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
18
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
19
|
-
end
|
20
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | revert_to_snapshot request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
tests('The response should') do
|
5
|
-
response = compute.revert_to_snapshot(Fog::Vsphere::Compute::Snapshot.new(service: 1))
|
6
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
7
|
-
test('should have a task_state key') { response.key? 'state' }
|
8
|
-
end
|
9
|
-
|
10
|
-
tests('The expected options') do
|
11
|
-
raises(ArgumentError, 'raises ArgumentError when input param is missing') { compute.revert_to_snapshot(nil) }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | set_vm_customvalue request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
instance_uuid = '50137835-88a1-436e-768e-9b2677076e67'
|
5
|
-
custom_key = nil
|
6
|
-
custom_value = nil
|
7
|
-
|
8
|
-
tests('The response should') do
|
9
|
-
response = compute.set_vm_customvalue(instance_uuid, custom_key, custom_value)
|
10
|
-
test('be nil') { response.nil? }
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('The expected options') do
|
14
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.set_vm_customvalue }
|
15
|
-
raises(ArgumentError, 'raises ArgumentError when custom_key option is missing') { compute.set_vm_customvalue(instance_uuid) }
|
16
|
-
raises(ArgumentError, 'raises ArgumentError when custom_value option is missing') { compute.set_vm_customvalue(instance_uuid, custom_key) }
|
17
|
-
end
|
18
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
Shindo.tests('Fog::Compute[:vsphere] | update_vm request', 'vsphere') do
|
4
|
-
compute = Fog::Compute[:vsphere]
|
5
|
-
server = Fog::Vsphere::Compute::Server.new
|
6
|
-
|
7
|
-
tests('UPDATE vm | The return value should') do
|
8
|
-
response = compute.update_vm(server)
|
9
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
10
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
11
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', ['vsphere']) do
|
2
|
-
# require 'guid'
|
3
|
-
compute = Fog::Compute[:vsphere]
|
4
|
-
response = nil
|
5
|
-
response_linked = nil
|
6
|
-
|
7
|
-
template = 'rhel64'
|
8
|
-
datacenter = 'Solutions'
|
9
|
-
default_params = {
|
10
|
-
'datacenter' => datacenter,
|
11
|
-
'template_path' => template,
|
12
|
-
'resource_pool' => ['Solutionscluster', 'Resources']
|
13
|
-
}
|
14
|
-
|
15
|
-
tests('Standard Clone | The return value should') do
|
16
|
-
servers_size = compute.servers.size
|
17
|
-
response = compute.vm_clone(default_params.merge('name' => 'cloning_vm', 'wait' => true))
|
18
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
19
|
-
%w[vm_ref new_vm task_ref].each do |key|
|
20
|
-
test("have a #{key} key") { response.key? key }
|
21
|
-
end
|
22
|
-
test('creates a new server') { compute.servers.size == servers_size + 1 }
|
23
|
-
test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
|
24
|
-
end
|
25
|
-
|
26
|
-
tests('Standard Clone setting ram and cpu | The return value should') do
|
27
|
-
servers_size = compute.servers.size
|
28
|
-
response = compute.vm_clone(default_params.merge('name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true))
|
29
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
30
|
-
%w[vm_ref new_vm task_ref].each do |key|
|
31
|
-
test("have a #{key} key") { response.key? key }
|
32
|
-
end
|
33
|
-
test('creates a new server') { compute.servers.size == servers_size + 1 }
|
34
|
-
test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
|
35
|
-
end
|
36
|
-
|
37
|
-
tests('Linked Clone | The return value should') do
|
38
|
-
servers_size = compute.servers.size
|
39
|
-
response = compute.vm_clone(default_params.merge('name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true))
|
40
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
41
|
-
%w[vm_ref new_vm task_ref].each do |key|
|
42
|
-
test("have a #{key} key") { response.key? key }
|
43
|
-
end
|
44
|
-
test('creates a new server') { compute.servers.size == servers_size + 1 }
|
45
|
-
test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm_linked' }
|
46
|
-
end
|
47
|
-
|
48
|
-
tests('When invalid input is presented') do
|
49
|
-
raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(foo: 1) }
|
50
|
-
raises(Fog::Vsphere::Compute::NotFound, 'it should raise Fog::Vsphere::Compute::NotFound when the UUID is not a string') do
|
51
|
-
pending # require 'guid'
|
52
|
-
compute.vm_clone('instance_uuid' => Guid.from_s(template), 'name' => 'jefftestfoo')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_config_vnc request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
reconfig_target = '50137835-88a1-436e-768e-9b2677076e67'
|
5
|
-
vnc_spec = { port: '5900', password: 'ssaaa', enabled: 'true' }
|
6
|
-
|
7
|
-
tests('The response should') do
|
8
|
-
response = compute.vm_config_vnc('instance_uuid' => reconfig_target).merge(vnc_spec)
|
9
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
10
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('VNC attrs response should') do
|
14
|
-
response = compute.vm_get_vnc(reconfig_target)
|
15
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
16
|
-
test('should have a port key') { response.key? :port }
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_destroy request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
booted_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
5
|
-
|
6
|
-
tests('The response should') do
|
7
|
-
response = compute.vm_destroy('instance_uuid' => booted_vm)
|
8
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
9
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
10
|
-
end
|
11
|
-
tests('The expected options') do
|
12
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_destroy }
|
13
|
-
end
|
14
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_migrate request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
powered_on_vm = '50137835-88a1-436e-768e-9b2677076e67'
|
5
|
-
|
6
|
-
tests('The response should') do
|
7
|
-
response = compute.vm_migrate('instance_uuid' => powered_on_vm)
|
8
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
9
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
10
|
-
end
|
11
|
-
|
12
|
-
tests('The expected options') do
|
13
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_migrate }
|
14
|
-
end
|
15
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_power_off request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
powered_on_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
5
|
-
|
6
|
-
tests('The response should') do
|
7
|
-
response = compute.vm_power_off('instance_uuid' => powered_on_vm)
|
8
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
9
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
10
|
-
test('should have a power_off_type key') { response.key? 'power_off_type' }
|
11
|
-
end
|
12
|
-
|
13
|
-
# When forcing the shutdown, we expect the result to be
|
14
|
-
{ true => 'cut_power', false => 'shutdown_guest' }.each do |force, expected|
|
15
|
-
tests("When 'force' => #{force}") do
|
16
|
-
response = compute.vm_power_off('instance_uuid' => powered_on_vm, 'force' => force)
|
17
|
-
test("should retur power_off_type of #{expected}") { response['power_off_type'] == expected }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
tests('The expected options') do
|
22
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_power_off }
|
23
|
-
end
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_power_on request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
powered_off_vm = nil
|
5
|
-
|
6
|
-
tests('The response should') do
|
7
|
-
response = compute.vm_power_on('instance_uuid' => powered_off_vm)
|
8
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
9
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
10
|
-
end
|
11
|
-
|
12
|
-
tests('The expected options') do
|
13
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_power_on }
|
14
|
-
end
|
15
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_reboot request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
powered_on_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
5
|
-
|
6
|
-
tests('The response should') do
|
7
|
-
response = compute.vm_reboot('instance_uuid' => powered_on_vm)
|
8
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
9
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
10
|
-
test('should have a reboot_type key') { response.key? 'reboot_type' }
|
11
|
-
end
|
12
|
-
|
13
|
-
# When forcing the shutdown, we expect the result to be
|
14
|
-
{ true => 'reset_power', false => 'reboot_guest' }.each do |force, expected|
|
15
|
-
tests("When force => #{force}") do
|
16
|
-
response = compute.vm_reboot('instance_uuid' => powered_on_vm, 'force' => force)
|
17
|
-
test("should return reboot_type of #{expected}") { response['reboot_type'] == expected }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
tests('The expected options') do
|
22
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reboot }
|
23
|
-
end
|
24
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_cdrom request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
reconfig_target = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
5
|
-
reconfig_spec = {
|
6
|
-
'start_connected' => false
|
7
|
-
}
|
8
|
-
|
9
|
-
tests('the response should') do
|
10
|
-
response = compute.vm_reconfig_cdrom('instance_uuid' => reconfig_target, 'hardware_spec' => reconfig_spec)
|
11
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
12
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
13
|
-
end
|
14
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_cpus request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
reconfig_target = '50137835-88a1-436e-768e-9b2677076e67'
|
5
|
-
reconfig_spec = 2
|
6
|
-
|
7
|
-
tests('The response should') do
|
8
|
-
response = compute.vm_reconfig_cpus('instance_uuid' => reconfig_target, 'cpus' => reconfig_spec)
|
9
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
10
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('The expected options') do
|
14
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reconfig_cpus('cpus' => reconfig_spec) }
|
15
|
-
raises(ArgumentError, 'raises ArgumentError when cpus option is missing') { compute.vm_reconfig_cpus('instance_uuid' => reconfig_target) }
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_hardware request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
reconfig_target = '50137835-88a1-436e-768e-9b2677076e67'
|
5
|
-
reconfig_spec = { 'guestId' => 'rhel5_64Guest' }
|
6
|
-
|
7
|
-
tests('The response should') do
|
8
|
-
response = compute.vm_reconfig_hardware('instance_uuid' => reconfig_target, 'hardware_spec' => reconfig_spec)
|
9
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
10
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('The expected options') do
|
14
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reconfig_hardware('hardware_spec' => reconfig_spec) }
|
15
|
-
raises(ArgumentError, 'raises ArgumentError when hardware_spec option is missing') { compute.vm_reconfig_hardware('instance_uuid' => reconfig_target) }
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_memory request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
reconfig_target = '50137835-88a1-436e-768e-9b2677076e67'
|
5
|
-
reconfig_spec = 4096
|
6
|
-
|
7
|
-
tests('The response should') do
|
8
|
-
response = compute.vm_reconfig_memory('instance_uuid' => reconfig_target, 'memory' => reconfig_spec)
|
9
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
10
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('The expected options') do
|
14
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reconfig_memory('memory' => reconfig_spec) }
|
15
|
-
raises(ArgumentError, 'raises ArgumentError when memory option is missing') { compute.vm_reconfig_memory('instance_uuid' => reconfig_target) }
|
16
|
-
end
|
17
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_suspend request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
powered_on_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
4
|
-
|
5
|
-
tests('The response should') do
|
6
|
-
response = compute.vm_suspend('instance_uuid' => powered_on_vm)
|
7
|
-
test('be a kind of Hash') { response.is_a?(Hash) }
|
8
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
9
|
-
test('should have a suspend_type key') { response.key? 'suspend_type' }
|
10
|
-
end
|
11
|
-
|
12
|
-
# When forcing the shutdown, we expect the result to be
|
13
|
-
{ true => 'suspend', false => 'standby_guest' }.each do |force, expected|
|
14
|
-
tests("When 'force' => #{force}") do
|
15
|
-
response = compute.vm_suspend('instance_uuid' => powered_on_vm, 'force' => force)
|
16
|
-
test("should return suspend_type of #{expected}") { response['suspend_type'] == expected }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
tests('The expected options') do
|
21
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_suspend }
|
22
|
-
end
|
23
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | vm_take_snapshot request', ['vsphere']) do
|
2
|
-
compute = Fog::Compute[:vsphere]
|
3
|
-
|
4
|
-
powered_off_vm = nil
|
5
|
-
|
6
|
-
tests('The response should') do
|
7
|
-
response = compute.vm_take_snapshot('instance_uuid' => powered_off_vm, 'name' => 'foobar')
|
8
|
-
test('be a kind of Hash') { response.is_a? Hash }
|
9
|
-
test('should have a task_state key') { response.key? 'task_state' }
|
10
|
-
test('should have a was_cancelled key') { response.key? 'was_cancelled' }
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('The expected options') do
|
14
|
-
raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_take_snapshot('name' => 'foobar') }
|
15
|
-
raises(ArgumentError, 'raises ArgumentError when name option is missing') { compute.vm_take_snapshot('instance_uuid' => powered_off_vm) }
|
16
|
-
end
|
17
|
-
end
|