deltacloud-core 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/config/drivers/aruba.yaml +3 -3
- data/deltacloud-core.gemspec +2 -2
- data/lib/cimi/collections/address_templates.rb +1 -2
- data/lib/cimi/collections/addresses.rb +1 -2
- data/lib/cimi/collections/base.rb +1 -1
- data/lib/cimi/collections/credentials.rb +2 -3
- data/lib/cimi/collections/forwarding_group_templates.rb +1 -2
- data/lib/cimi/collections/forwarding_groups.rb +1 -2
- data/lib/cimi/collections/machine_configurations.rb +1 -2
- data/lib/cimi/collections/machine_images.rb +1 -2
- data/lib/cimi/collections/machines.rb +9 -9
- data/lib/cimi/collections/network_configurations.rb +1 -2
- data/lib/cimi/collections/network_port_configurations.rb +1 -2
- data/lib/cimi/collections/network_port_templates.rb +1 -2
- data/lib/cimi/collections/network_ports.rb +1 -2
- data/lib/cimi/collections/network_templates.rb +1 -2
- data/lib/cimi/collections/networks.rb +2 -3
- data/lib/cimi/collections/volume_configurations.rb +1 -2
- data/lib/cimi/collections/volume_images.rb +1 -2
- data/lib/cimi/collections/volumes.rb +3 -4
- data/lib/cimi/helpers/cimi_helper.rb +7 -2
- data/lib/cimi/models.rb +6 -10
- data/lib/cimi/models/base.rb +48 -35
- data/lib/cimi/models/cloud_entry_point.rb +22 -1
- data/lib/cimi/models/collection.rb +42 -5
- data/lib/cimi/models/credential.rb +1 -1
- data/lib/cimi/models/disk.rb +39 -10
- data/lib/cimi/models/machine.rb +39 -22
- data/lib/cimi/models/machine_configuration.rb +4 -5
- data/lib/cimi/models/machine_image.rb +1 -1
- data/lib/cimi/models/machine_volume.rb +1 -1
- data/lib/cimi/models/network.rb +6 -3
- data/lib/cimi/models/network_port.rb +13 -2
- data/lib/cimi/models/schema.rb +66 -5
- data/lib/cimi/models/volume.rb +17 -16
- data/lib/cimi/models/volume_configuration.rb +7 -10
- data/lib/cimi/models/volume_image.rb +1 -1
- data/lib/deltacloud/collections/base.rb +1 -1
- data/lib/deltacloud/collections/firewalls.rb +2 -2
- data/lib/deltacloud/collections/load_balancers.rb +8 -2
- data/lib/deltacloud/core_ext.rb +1 -0
- data/lib/deltacloud/core_ext/base.rb +30 -0
- data/lib/deltacloud/drivers.rb +1 -1
- data/lib/deltacloud/drivers/base_driver.rb +1 -1
- data/lib/deltacloud/drivers/condor/condor_driver.rb +1 -1
- data/lib/deltacloud/drivers/exceptions.rb +24 -14
- data/lib/deltacloud/drivers/features.rb +3 -3
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +163 -92
- data/lib/deltacloud/drivers/mock/data/images/img1.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/images/img2.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/images/img3.yml +1 -0
- data/lib/deltacloud/drivers/mock/mock_client.rb +4 -4
- data/lib/deltacloud/drivers/mock/mock_driver.rb +16 -16
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +25 -9
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +2 -1
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +1 -1
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +2 -0
- data/lib/deltacloud/helpers/deltacloud_helper.rb +29 -8
- data/lib/deltacloud/models/image.rb +1 -0
- data/lib/deltacloud/models/instance_profile.rb +4 -0
- data/lib/deltacloud/version.rb +1 -1
- data/lib/ec2/query_parser.rb +1 -1
- data/lib/sinatra/rack_accept.rb +5 -1
- data/lib/sinatra/rack_logger.rb +9 -2
- data/tests/cimi/collections/machine_images_test.rb +23 -6
- data/tests/cimi/collections/machines_test.rb +39 -0
- data/tests/cimi/model/collection_spec.rb +109 -0
- data/tests/cimi/{spec/cimi/model → model}/credential_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/machine_configuration_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/machine_image_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/machine_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/machine_template_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/schema_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/volume_configuration_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/volume_image_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/volume_spec.rb +1 -1
- data/tests/cimi/{spec/cimi/model → model}/volume_template_spec.rb +1 -1
- data/tests/cimi/{spec/spec_helper.rb → spec_helper.rb} +7 -4
- data/tests/drivers/base/exceptions_test.rb +8 -8
- data/tests/drivers/ec2/buckets_test.rb +1 -1
- data/tests/drivers/ec2/images_test.rb +1 -1
- data/tests/drivers/ec2/instance_test.rb +1 -1
- data/tests/drivers/ec2/keys_test.rb +2 -2
- data/tests/drivers/ec2/realms_test.rb +1 -1
- data/tests/drivers/ec2/storage_snapshots_test.rb +1 -1
- data/tests/drivers/gogrid/hardware_profiles_test.rb +1 -1
- data/tests/drivers/gogrid/images_test.rb +1 -1
- data/tests/drivers/gogrid/instances_test.rb +1 -1
- data/tests/drivers/gogrid/realms_test.rb +1 -1
- data/tests/drivers/mock/images_test.rb +7 -2
- data/tests/drivers/mock/instances_test.rb +1 -1
- data/tests/drivers/mock/keys_test.rb +2 -2
- data/tests/drivers/mock/realms_test.rb +1 -1
- data/tests/drivers/mock/storage_snapshots_test.rb +1 -1
- data/tests/drivers/mock/storage_volumes_test.rb +1 -1
- data/tests/drivers/openstack/hardware_profiles_test.rb +3 -3
- data/tests/drivers/openstack/images_test.rb +1 -1
- data/tests/drivers/openstack/instances_test.rb +1 -1
- data/tests/drivers/openstack/keys_test.rb +2 -2
- data/tests/drivers/openstack/realms_test.rb +1 -1
- data/tests/drivers/rhevm/common.rb +3 -3
- data/tests/drivers/rhevm/images_test.rb +13 -13
- data/tests/drivers/rhevm/instance_test.rb +22 -22
- data/tests/drivers/rhevm/provider_test.rb +3 -3
- data/tests/drivers/rhevm/realms_test.rb +7 -7
- data/tests/test_helper.rb +0 -5
- data/views/api/show.xml.haml +6 -3
- data/views/errors/401.html.haml +0 -16
- data/views/errors/404.html.haml +2 -3
- data/views/errors/500.html.haml +6 -5
- data/views/images/show.html.haml +5 -1
- data/views/images/show.xml.haml +8 -3
- data/views/instances/new.html.haml +1 -1
- data/views/instances/show.xml.haml +1 -1
- data/views/load_balancers/show.html.haml +1 -1
- metadata +761 -778
- data/lib/cimi/models/disk_collection.rb +0 -37
- data/lib/cimi/models/machine_volume_collection.rb +0 -34
- data/lib/cimi/models/network_port_collection.rb +0 -51
- data/lib/cimi/models/network_port_configuration_collection.rb +0 -35
- data/lib/cimi/models/network_port_template_collection.rb +0 -37
@@ -12,7 +12,7 @@ describe 'MockDriver Images' do
|
|
12
12
|
it 'must throw error when wrong credentials' do
|
13
13
|
Proc.new do
|
14
14
|
@driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
15
|
-
end.must_raise Deltacloud::
|
15
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'must return list of images' do
|
@@ -43,7 +43,7 @@ describe 'MockDriver Images' do
|
|
43
43
|
@driver.image(:id => 'img1-test').id.must_equal 'img1-test'
|
44
44
|
@driver.image(:id => 'img1-test').name.must_equal 'img1-test'
|
45
45
|
@driver.image(:id => 'img1-test').description.must_equal 'Test1'
|
46
|
-
Proc.new { @driver.create_image(:id => 'unknown-instance', :name => 'test') }.must_raise Deltacloud::
|
46
|
+
Proc.new { @driver.create_image(:id => 'unknown-instance', :name => 'test') }.must_raise Deltacloud::Exceptions::BackendError, 'CreateImageNotSupported'
|
47
47
|
@driver.image(:id => 'test').must_be_nil
|
48
48
|
end
|
49
49
|
|
@@ -53,4 +53,9 @@ describe 'MockDriver Images' do
|
|
53
53
|
@driver.image(:id => 'img1-test-destroy').must_be_nil
|
54
54
|
end
|
55
55
|
|
56
|
+
it 'must report image creation time' do
|
57
|
+
@driver.image(:id => 'img1').wont_be_nil
|
58
|
+
@driver.image(:id => 'img1').creation_time.wont_be_nil
|
59
|
+
end
|
60
|
+
|
56
61
|
end
|
@@ -12,7 +12,7 @@ describe 'MockDriver Instances' do
|
|
12
12
|
it 'must throw error when wrong credentials' do
|
13
13
|
Proc.new do
|
14
14
|
@driver.backend.instances(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
15
|
-
end.must_raise Deltacloud::
|
15
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'must return list of instances' do
|
@@ -12,7 +12,7 @@ describe 'MockDriver Keys' do
|
|
12
12
|
it 'must throw error when wrong credentials' do
|
13
13
|
Proc.new do
|
14
14
|
@driver.backend.keys(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
15
|
-
end.must_raise Deltacloud::
|
15
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'must return list of keys' do
|
@@ -39,7 +39,7 @@ describe 'MockDriver Keys' do
|
|
39
39
|
key = @driver.create_key(:key_name => 'test1')
|
40
40
|
key.wont_be_nil
|
41
41
|
key.must_be_kind_of Key
|
42
|
-
Proc.new { @driver.create_key(:key_name => 'test1') }.must_raise Deltacloud::
|
42
|
+
Proc.new { @driver.create_key(:key_name => 'test1') }.must_raise Deltacloud::Exceptions::ForbiddenError, 'KeyExist'
|
43
43
|
@driver.destroy_key :id => key.id
|
44
44
|
@driver.key(:id => key.id).must_be_nil
|
45
45
|
end
|
@@ -12,7 +12,7 @@ describe 'MockDriver Realms' do
|
|
12
12
|
it 'must throw error when wrong credentials' do
|
13
13
|
Proc.new do
|
14
14
|
@driver.backend.realms(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
15
|
-
end.must_raise Deltacloud::
|
15
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'must return list of realms' do
|
@@ -12,7 +12,7 @@ describe 'MockDriver StorageSnapshots' do
|
|
12
12
|
it 'must throw error when wrong credentials' do
|
13
13
|
Proc.new do
|
14
14
|
@driver.backend.storage_snapshots(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
15
|
-
end.must_raise Deltacloud::
|
15
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'must return list of storage_snapshots' do
|
@@ -12,7 +12,7 @@ describe 'MockDriver StorageVolumes' do
|
|
12
12
|
it 'must throw error when wrong credentials' do
|
13
13
|
Proc.new do
|
14
14
|
@driver.backend.storage_volumes(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
15
|
-
end.must_raise Deltacloud::
|
15
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'must return list of storage_volumes' do
|
@@ -17,7 +17,7 @@ describe 'OpenStackDriver HardwareProfiles' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown+wrong', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of hardware_profiles' do
|
@@ -30,14 +30,14 @@ describe 'OpenStackDriver HardwareProfiles' do
|
|
30
30
|
hardware_profiles.wont_be_empty
|
31
31
|
hardware_profiles.must_be_kind_of Array
|
32
32
|
hardware_profiles.size.must_equal 1
|
33
|
-
hardware_profiles.first.
|
33
|
+
hardware_profiles.first.id.must_equal '1'
|
34
34
|
@driver.hardware_profiles(:id => 'unknown').must_be_empty
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'must allow to retrieve single hardware_profile' do
|
38
38
|
hardware_profile = @driver.hardware_profile :id => '1'
|
39
39
|
hardware_profile.wont_be_nil
|
40
|
-
hardware_profile.
|
40
|
+
hardware_profile.id.must_equal '1'
|
41
41
|
hardware_profile.properties.must_be_kind_of Array
|
42
42
|
hardware_profile.properties.wont_be_empty
|
43
43
|
@driver.hardware_profile(:id => 'unknown').must_be_nil
|
@@ -17,7 +17,7 @@ describe 'OpenStackDriver Images' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown+wrong', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of images' do
|
@@ -17,7 +17,7 @@ describe 'OpenStackDriver Instances' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown+wrong', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of instances' do
|
@@ -17,7 +17,7 @@ describe 'OpenStackDriver Keys' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown+wrong', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of keys' do
|
@@ -54,7 +54,7 @@ describe 'OpenStackDriver Keys' do
|
|
54
54
|
# Should not allow duplicate keys to be created:
|
55
55
|
lambda {
|
56
56
|
@driver.create_key(:key_name => 'test-unit-1')
|
57
|
-
}.must_raise Deltacloud::
|
57
|
+
}.must_raise Deltacloud::Exceptions::BackendError
|
58
58
|
@driver.destroy_key(:id => 'test-unit-1').must_equal true
|
59
59
|
end
|
60
60
|
|
@@ -17,7 +17,7 @@ describe 'OpenStackDriver Realms' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown+wrong', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of realms' do
|
@@ -8,9 +8,9 @@ require_relative '../../test_helper'
|
|
8
8
|
#
|
9
9
|
def credentials
|
10
10
|
{
|
11
|
-
:user => '
|
12
|
-
:password => '
|
13
|
-
:provider => 'https://
|
11
|
+
:user => 'admin@internal',
|
12
|
+
:password => 'redhat',
|
13
|
+
:provider => 'https://dell-per610-02.lab.eng.brq.redhat.com/api;9df72b84-0234-11e2-9b87-9386d9b09d4a'
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
@@ -17,7 +17,7 @@ describe 'RhevmDriver Images' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of images' do
|
@@ -26,12 +26,12 @@ describe 'RhevmDriver Images' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'must allow to filter images' do
|
29
|
-
@driver.images(:id => '
|
30
|
-
@driver.images(:id => '
|
31
|
-
@driver.images(:id => '
|
32
|
-
@driver.images(:id => '
|
33
|
-
@driver.images(:owner_id => '
|
34
|
-
img.owner_id.must_equal '
|
29
|
+
@driver.images(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').wont_be_empty
|
30
|
+
@driver.images(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').must_be_kind_of Array
|
31
|
+
@driver.images(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').size.must_equal 1
|
32
|
+
@driver.images(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').first.id.must_equal '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5'
|
33
|
+
@driver.images(:owner_id => 'admin@internal').each do |img|
|
34
|
+
img.owner_id.must_equal 'admin@internal'
|
35
35
|
end
|
36
36
|
@driver.images(:id => 'ami-aaaaaaaa').must_be_empty
|
37
37
|
@driver.images(:id => 'unknown').must_be_empty
|
@@ -42,9 +42,9 @@ describe 'RhevmDriver Images' do
|
|
42
42
|
# of YAML under Ruby 1.8.
|
43
43
|
#
|
44
44
|
if RUBY_VERSION =~ /^1\.9/
|
45
|
-
@driver.image(:id => '
|
46
|
-
@driver.image(:id => '
|
47
|
-
@driver.image(:id => '
|
45
|
+
@driver.image(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').wont_be_nil
|
46
|
+
@driver.image(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').must_be_kind_of Image
|
47
|
+
@driver.image(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5').id.must_equal '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5'
|
48
48
|
@driver.image(:id => 'ami-aaaaaaaa').must_be_nil
|
49
49
|
@driver.image(:id => 'unknown').must_be_nil
|
50
50
|
end
|
@@ -52,17 +52,17 @@ describe 'RhevmDriver Images' do
|
|
52
52
|
|
53
53
|
it 'must throw proper exception when destroying used image' do
|
54
54
|
if RUBY_VERSION =~ /^1\.9/
|
55
|
-
image = @driver.image(:id => '
|
55
|
+
image = @driver.image(:id => '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5')
|
56
56
|
image.wont_be_nil
|
57
57
|
image.state.must_equal 'OK'
|
58
58
|
Proc.new {
|
59
59
|
@driver.destroy_image(image.id)
|
60
|
-
}.must_raise Deltacloud::
|
60
|
+
}.must_raise Deltacloud::Exceptions::BackendError, 'Cannot delete Template. Template is being used by the following VMs: test1.'
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'must support destroying images' do
|
65
|
-
image = @driver.image(:id => '
|
65
|
+
image = @driver.image(:id => '5472e759-dee1-4e90-a2bf-79b61a601e80')
|
66
66
|
image.wont_be_nil
|
67
67
|
image.state.must_equal 'OK'
|
68
68
|
@driver.destroy_image(image.id)
|
@@ -17,7 +17,7 @@ describe 'RhevmDriver Instances' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of instances' do
|
@@ -26,29 +26,29 @@ describe 'RhevmDriver Instances' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'must allow to filter instances' do
|
29
|
-
@driver.instances(:id => '
|
30
|
-
@driver.instances(:id => '
|
31
|
-
@driver.instances(:id => '
|
32
|
-
@driver.instances(:id => '
|
33
|
-
@driver.instances(:owner_id => '
|
34
|
-
@driver.instances(:owner_id => '
|
35
|
-
inst.owner_id.must_equal '
|
29
|
+
@driver.instances(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').wont_be_empty
|
30
|
+
@driver.instances(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').must_be_kind_of Array
|
31
|
+
@driver.instances(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').size.must_equal 1
|
32
|
+
@driver.instances(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').first.id.must_equal 'de048029-c4f8-4e90-ac7b-67cf06102190'
|
33
|
+
@driver.instances(:owner_id => 'admin@internal').wont_be_empty
|
34
|
+
@driver.instances(:owner_id => 'admin@internal').each do |inst|
|
35
|
+
inst.owner_id.must_equal 'admin@internal'
|
36
36
|
end
|
37
37
|
@driver.instances(:id => 'i-00000000').must_be_empty
|
38
38
|
@driver.instances(:id => 'unknown').must_be_empty
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'must allow to retrieve single instance' do
|
42
|
-
@driver.instance(:id => '
|
43
|
-
@driver.instance(:id => '
|
44
|
-
@driver.instance(:id => '
|
42
|
+
@driver.instance(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').wont_be_nil
|
43
|
+
@driver.instance(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').must_be_kind_of Instance
|
44
|
+
@driver.instance(:id => 'de048029-c4f8-4e90-ac7b-67cf06102190').id.must_equal 'de048029-c4f8-4e90-ac7b-67cf06102190'
|
45
45
|
@driver.instance(:id => 'i-00000000').must_be_nil
|
46
46
|
@driver.instance(:id => 'unknown').must_be_nil
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'must allow to create a new instance and destroy it' do
|
50
|
-
instance = @driver.create_instance('
|
51
|
-
:realm_id => '
|
50
|
+
instance = @driver.create_instance('5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5',
|
51
|
+
:realm_id => '99408929-82cf-4dc7-a532-9d998063fa95',
|
52
52
|
:hwp_id => 'SERVER',
|
53
53
|
:hwp_memory => '1024',
|
54
54
|
:user_data => 'test user data'
|
@@ -61,9 +61,9 @@ describe 'RhevmDriver Instances' do
|
|
61
61
|
@driver.instance(:id => instance.id).name.wont_be_nil
|
62
62
|
@driver.instance(:id => instance.id).instance_profile.name.must_equal 'SERVER'
|
63
63
|
@driver.instance(:id => instance.id).instance_profile.memory.must_equal 1024
|
64
|
-
@driver.instance(:id => instance.id).realm_id.must_equal '
|
65
|
-
@driver.instance(:id => instance.id).image_id.must_equal '
|
66
|
-
@driver.instance(:id => instance.id).owner_id.must_equal '
|
64
|
+
@driver.instance(:id => instance.id).realm_id.must_equal '99408929-82cf-4dc7-a532-9d998063fa95'
|
65
|
+
@driver.instance(:id => instance.id).image_id.must_equal '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5'
|
66
|
+
@driver.instance(:id => instance.id).owner_id.must_equal 'admin@internal'
|
67
67
|
@driver.instance(:id => instance.id).state.must_equal 'STOPPED'
|
68
68
|
@driver.instance(:id => instance.id).actions.must_include :start
|
69
69
|
@driver.destroy_instance(instance.id)
|
@@ -71,8 +71,8 @@ describe 'RhevmDriver Instances' do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'must allow to create a new instance and make it running' do
|
74
|
-
instance = @driver.create_instance('
|
75
|
-
:realm_id => '
|
74
|
+
instance = @driver.create_instance('5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5',
|
75
|
+
:realm_id => '99408929-82cf-4dc7-a532-9d998063fa95',
|
76
76
|
:hwp_id => 'SERVER',
|
77
77
|
:hwp_memory => '1024',
|
78
78
|
:user_data => 'test user data'
|
@@ -85,15 +85,15 @@ describe 'RhevmDriver Instances' do
|
|
85
85
|
@driver.instance(:id => instance.id).name.wont_be_nil
|
86
86
|
@driver.instance(:id => instance.id).instance_profile.name.must_equal 'SERVER'
|
87
87
|
@driver.instance(:id => instance.id).instance_profile.memory.must_equal 1024
|
88
|
-
@driver.instance(:id => instance.id).realm_id.must_equal '
|
89
|
-
@driver.instance(:id => instance.id).image_id.must_equal '
|
90
|
-
@driver.instance(:id => instance.id).owner_id.must_equal '
|
88
|
+
@driver.instance(:id => instance.id).realm_id.must_equal '99408929-82cf-4dc7-a532-9d998063fa95'
|
89
|
+
@driver.instance(:id => instance.id).image_id.must_equal '5558c5b6-9dd6-41b7-87f9-7cbce4fd40c5'
|
90
|
+
@driver.instance(:id => instance.id).owner_id.must_equal 'admin@internal'
|
91
91
|
@driver.instance(:id => instance.id).state.must_equal 'STOPPED'
|
92
92
|
@driver.instance(:id => instance.id).actions.must_include :start
|
93
93
|
@driver.start_instance(instance.id)
|
94
94
|
instance = instance.wait_for!(@driver, record_retries('start')) { |i| i.is_running? }
|
95
95
|
@driver.instance(:id => instance.id).state.must_equal 'RUNNING'
|
96
|
-
Proc.new { @driver.destroy_instance(instance.id) }.must_raise Deltacloud::
|
96
|
+
Proc.new { @driver.destroy_instance(instance.id) }.must_raise Deltacloud::Exceptions::BackendError, 'Cannot remove VM. VM is running.'
|
97
97
|
@driver.stop_instance(instance.id)
|
98
98
|
instance = instance.wait_for!(@driver, record_retries('stop')) { |i| i.is_stopped? }
|
99
99
|
@driver.instance(:id => instance.id).state.must_equal 'STOPPED'
|
@@ -18,7 +18,7 @@ describe 'RHEV-M provider test' do
|
|
18
18
|
wrong_driver = Deltacloud::new(:rhevm, credentials.merge(:provider => 'unknown'))
|
19
19
|
Proc.new {
|
20
20
|
wrong_driver.realms
|
21
|
-
}.must_raise Deltacloud::
|
21
|
+
}.must_raise Deltacloud::Exceptions::BackendError
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'must support listing of available providers' do
|
@@ -31,11 +31,11 @@ describe 'RHEV-M provider test' do
|
|
31
31
|
|
32
32
|
it 'must switch realms when switching between different clusters' do
|
33
33
|
|
34
|
-
provider1 = @driver.provider(:id => '
|
34
|
+
provider1 = @driver.provider(:id => '9df72b84-0234-11e2-9b87-9386d9b09d4a')
|
35
35
|
provider1.wont_be_nil
|
36
36
|
provider1.url.wont_be_empty
|
37
37
|
|
38
|
-
provider2 = @driver.provider(:id => '
|
38
|
+
provider2 = @driver.provider(:id => '9df72b84-0234-11e2-9b87-9386d9b09d4a')
|
39
39
|
provider2.wont_be_nil
|
40
40
|
provider2.url.wont_be_empty
|
41
41
|
|
@@ -17,7 +17,7 @@ describe 'RhevmDriver Realms' do
|
|
17
17
|
it 'must throw error when wrong credentials' do
|
18
18
|
Proc.new do
|
19
19
|
@driver.backend.realms(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
20
|
-
end.must_raise Deltacloud::
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must return list of realms' do
|
@@ -26,16 +26,16 @@ describe 'RhevmDriver Realms' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'must allow to filter realms' do
|
29
|
-
@driver.realms(:id => '
|
30
|
-
@driver.realms(:id => '
|
31
|
-
@driver.realms(:id => '
|
32
|
-
@driver.realms(:id => '
|
29
|
+
@driver.realms(:id => '99408929-82cf-4dc7-a532-9d998063fa95').wont_be_empty
|
30
|
+
@driver.realms(:id => '99408929-82cf-4dc7-a532-9d998063fa95').must_be_kind_of Array
|
31
|
+
@driver.realms(:id => '99408929-82cf-4dc7-a532-9d998063fa95').size.must_equal 1
|
32
|
+
@driver.realms(:id => '99408929-82cf-4dc7-a532-9d998063fa95').first.id.must_equal '99408929-82cf-4dc7-a532-9d998063fa95'
|
33
33
|
@driver.realms(:id => 'unknown').must_be_empty
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'must allow to retrieve single realm' do
|
37
|
-
@driver.realm(:id => '
|
38
|
-
@driver.realm(:id => '
|
37
|
+
@driver.realm(:id => '99408929-82cf-4dc7-a532-9d998063fa95').wont_be_nil
|
38
|
+
@driver.realm(:id => '99408929-82cf-4dc7-a532-9d998063fa95').must_be_kind_of Realm
|
39
39
|
@driver.realm(:id => 'unknown').must_be_nil
|
40
40
|
end
|
41
41
|
|
data/tests/test_helper.rb
CHANGED
data/views/api/show.xml.haml
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
- @collections.each do |c|
|
3
3
|
%link{ :rel => c.collection_name, :href => self.send(:"#{c.collection_name}_url")}
|
4
4
|
- c.features.select { |f| driver.class.has_feature?(c.collection_name, f.name) }.each do |f|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
- f.operations.each do |operation|
|
6
|
+
%feature{ :name => f.name, :rel => operation.name }
|
7
|
+
- operation.params_array.each do |param|
|
8
|
+
%param{ :name => param.name}
|
9
|
+
- driver.class.constraints(:collection => c.collection_name, :feature => f.name).each do |name, value|
|
10
|
+
%constraint{ :name => name }=value
|
data/views/errors/401.html.haml
CHANGED
@@ -15,13 +15,6 @@
|
|
15
15
|
- else
|
16
16
|
%em No details
|
17
17
|
|
18
|
-
- if @error.class.method_defined? :backtrace
|
19
|
-
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
20
|
-
%h3 Backtrace
|
21
|
-
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
22
|
-
%li
|
23
|
-
%pre=@error.backtrace.join("\n")
|
24
|
-
|
25
18
|
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
26
19
|
%h3 Parameters
|
27
20
|
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
@@ -31,12 +24,3 @@
|
|
31
24
|
%li{ :'data-role' => 'list-divider'}=key
|
32
25
|
%li
|
33
26
|
%span{:style => 'font-weight:normal;'}=value.inspect
|
34
|
-
|
35
|
-
|
36
|
-
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
37
|
-
%h3 Request details
|
38
|
-
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
39
|
-
- request.env.each do |key, value|
|
40
|
-
%li{ :'data-role' => 'list-divider'}=key
|
41
|
-
%li
|
42
|
-
%span{:style => 'font-weight:normal;'}=value.to_s
|
data/views/errors/404.html.haml
CHANGED
@@ -19,11 +19,10 @@
|
|
19
19
|
%li
|
20
20
|
%span{:style => 'font-weight:normal;'}=value.inspect
|
21
21
|
|
22
|
-
|
23
22
|
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
24
|
-
%h3 Request
|
23
|
+
%h3 Request Headers
|
25
24
|
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
26
|
-
-
|
25
|
+
- request_headers.each do |key, value|
|
27
26
|
%li{ :'data-role' => 'list-divider'}=key
|
28
27
|
%li
|
29
28
|
%span{:style => 'font-weight:normal;'}=value.inspect
|