fog-vsphere 1.7.0.1 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -2
- data/.travis.yml +7 -6
- data/CHANGELOG.md +13 -2
- data/CONTRIBUTORS.md +0 -8
- data/Rakefile +1 -10
- data/gemfiles/Gemfile.1.9.2+ +9 -0
- data/lib/fog/vsphere/compute.rb +2 -0
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +6 -1
- data/lib/fog/vsphere/models/compute/server.rb +37 -8
- data/lib/fog/vsphere/models/compute/volume.rb +62 -28
- data/lib/fog/vsphere/models/compute/volumes.rb +1 -1
- data/lib/fog/vsphere/requests/compute/create_vm.rb +32 -44
- data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +4 -11
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +2 -1
- data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +2 -14
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +3 -3
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_migrate.rb +1 -0
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +26 -15
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/class_from_string_tests.rb +3 -3
- data/tests/compute_tests.rb +17 -16
- data/tests/helpers/mock_helper.rb +3 -3
- data/tests/models/compute/cluster_tests.rb +5 -4
- data/tests/models/compute/hosts_tests.rb +4 -2
- data/tests/models/compute/rules_tests.rb +16 -10
- data/tests/models/compute/server_tests.rb +29 -33
- data/tests/models/compute/servers_tests.rb +4 -2
- data/tests/requests/compute/current_time_tests.rb +4 -2
- data/tests/requests/compute/folder_destroy_tests.rb +7 -5
- data/tests/requests/compute/get_network_tests.rb +22 -18
- data/tests/requests/compute/list_child_snapshots_tests.rb +2 -1
- data/tests/requests/compute/list_clusters_tests.rb +6 -5
- data/tests/requests/compute/list_datastores_tests.rb +7 -6
- data/tests/requests/compute/list_hosts_tests.rb +4 -3
- data/tests/requests/compute/list_networks_tests.rb +7 -6
- data/tests/requests/compute/list_storage_pods_test.rb +4 -3
- data/tests/requests/compute/list_virtual_machines_tests.rb +20 -16
- data/tests/requests/compute/list_vm_cdroms_tests.rb +2 -1
- data/tests/requests/compute/list_vm_snapshots_tests.rb +2 -1
- data/tests/requests/compute/modify_vm_cdrom_tests.rb +4 -3
- data/tests/requests/compute/revert_to_snapshot_tests.rb +4 -2
- data/tests/requests/compute/set_vm_customvalue_tests.rb +2 -0
- data/tests/requests/compute/vm_clone_tests.rb +20 -20
- data/tests/requests/compute/vm_config_vnc_tests.rb +4 -3
- data/tests/requests/compute/vm_destroy_tests.rb +4 -1
- data/tests/requests/compute/vm_migrate_tests.rb +2 -1
- data/tests/requests/compute/vm_power_off_tests.rb +4 -2
- data/tests/requests/compute/vm_power_on_tests.rb +3 -1
- data/tests/requests/compute/vm_reboot_tests.rb +4 -2
- data/tests/requests/compute/vm_reconfig_cdrom_tests.rb +3 -2
- data/tests/requests/compute/vm_reconfig_cpus_tests.rb +3 -1
- data/tests/requests/compute/vm_reconfig_hardware_tests.rb +4 -2
- data/tests/requests/compute/vm_reconfig_memory_tests.rb +3 -1
- data/tests/requests/compute/vm_take_snapshot_tests.rb +3 -1
- metadata +4 -22
- data/.rubocop.yml +0 -8
- data/.rubocop_todo.yml +0 -217
- data/lib/fog/vsphere/models/compute/ticket.rb +0 -16
- data/lib/fog/vsphere/models/compute/tickets.rb +0 -25
- data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +0 -14
- data/lib/fog/vsphere/requests/compute/host_shutdown.rb +0 -14
- data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +0 -14
- data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +0 -34
- data/lib/fog/vsphere/requests/compute/vm_relocate.rb +0 -54
- data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +0 -29
- data/lib/fog/vsphere/requests/compute/vm_rename.rb +0 -24
- data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +0 -29
- data/lib/fog/vsphere/requests/compute/vm_suspend.rb +0 -54
- data/tests/models/compute/ticket_tests.rb +0 -12
- data/tests/models/compute/tickets_tests.rb +0 -8
- data/tests/requests/compute/vm_suspend_tests.rb +0 -23
@@ -1,29 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Vsphere
|
4
|
-
class Real
|
5
|
-
def vm_revert_snapshot(vm_id, snapshot_id)
|
6
|
-
vm = servers.get(vm_id)
|
7
|
-
snapshot = vm.snapshots.get(snapshot_id).mo_ref
|
8
|
-
task = snapshot.RevertToSnapshot_Task
|
9
|
-
|
10
|
-
task.wait_for_completion
|
11
|
-
|
12
|
-
{
|
13
|
-
'task_state' => task.info.state,
|
14
|
-
'was_cancelled' => task.info.cancelled
|
15
|
-
}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Mock
|
20
|
-
def vm_revert_snapshot(_vm_id, _snapshot_id)
|
21
|
-
{
|
22
|
-
'task_state' => 'success',
|
23
|
-
'was_cancelled' => false
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Vsphere
|
4
|
-
class Real
|
5
|
-
def vm_suspend(options = {})
|
6
|
-
raise(ArgumentError, 'instance_uuid is a required parameter') unless options.key?('instance_uuid')
|
7
|
-
options = { 'force' => false }.merge(options)
|
8
|
-
|
9
|
-
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
10
|
-
vm = connection.searchIndex.FindAllByUuid(search_filter).first
|
11
|
-
|
12
|
-
if options['force']
|
13
|
-
suspend_forcefully(vm)
|
14
|
-
else
|
15
|
-
suspend_gracefully(vm)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def suspend_forcefully(vm)
|
22
|
-
task = vm.SuspendVM_Task
|
23
|
-
task.wait_for_completion
|
24
|
-
{
|
25
|
-
'task_state' => task.info.result,
|
26
|
-
'suspend_type' => 'suspend'
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def suspend_gracefully(vm)
|
31
|
-
vm.StandbyGuest
|
32
|
-
{
|
33
|
-
'task_state' => 'running',
|
34
|
-
'suspend_type' => 'standby_guest'
|
35
|
-
}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class Mock
|
40
|
-
def vm_suspend(options = {})
|
41
|
-
raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
|
42
|
-
|
43
|
-
vm = get_virtual_machine(options['instance_uuid'])
|
44
|
-
vm['power_state'] = 'suspended'
|
45
|
-
|
46
|
-
{
|
47
|
-
'task_state' => 'running',
|
48
|
-
'suspend_type' => options['force'] ? 'suspend' : 'standby_guest'
|
49
|
-
}
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
-
servers = Fog::Compute[:vsphere].servers
|
3
|
-
server = servers.last
|
4
|
-
ticket = server.acquire_ticket
|
5
|
-
|
6
|
-
tests('A ticket') do
|
7
|
-
test('should have a ticket') { !ticket.ticket.empty? }
|
8
|
-
test('should have a host') { !ticket.host.empty? }
|
9
|
-
test('should have a port') { ticket.port.is_a?(Integer) }
|
10
|
-
test('should have a ssl ssl_thumbprint') { !ticket.ssl_thumbprint.empty? }
|
11
|
-
end
|
12
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
-
service = Fog::Compute[:vsphere]
|
3
|
-
server = service.servers.last
|
4
|
-
|
5
|
-
tests('The tickets collection') do
|
6
|
-
test('should create a ticket for a server') { service.tickets(server: server).create.is_a? Fog::Compute::Vsphere::Ticket }
|
7
|
-
end
|
8
|
-
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
|