fog-openstack 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +6 -2
- data/README.md +4 -0
- data/Rakefile +10 -2
- data/fog-openstack.gemspec +2 -3
- data/gemfiles/Gemfile-1.9 +1 -1
- data/lib/fog/openstack.rb +14 -6
- data/lib/fog/openstack/baremetal.rb +1 -1
- data/lib/fog/openstack/common.rb +0 -2
- data/lib/fog/openstack/compute.rb +78 -75
- data/lib/fog/openstack/core.rb +2 -1
- data/lib/fog/openstack/docs/compute.md +1 -1
- data/lib/fog/openstack/docs/network.md +283 -0
- data/lib/fog/openstack/docs/nfv.md +144 -0
- data/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb +4 -4
- data/lib/fog/openstack/examples/network/network_add_port.rb +21 -0
- data/lib/fog/openstack/examples/network/network_rbac.rb +69 -0
- data/lib/fog/openstack/identity.rb +14 -22
- data/lib/fog/openstack/identity_v2.rb +1 -1
- data/lib/fog/openstack/image_v1.rb +13 -28
- data/lib/fog/openstack/image_v2.rb +15 -17
- data/lib/fog/openstack/introspection.rb +1 -1
- data/lib/fog/openstack/metering.rb +1 -1
- data/lib/fog/openstack/models/collection.rb +4 -1
- data/lib/fog/openstack/models/compute/availability_zone.rb +5 -0
- data/lib/fog/openstack/models/compute/flavor.rb +21 -9
- data/lib/fog/openstack/models/compute/server.rb +64 -77
- data/lib/fog/openstack/models/compute/snapshot.rb +6 -6
- data/lib/fog/openstack/models/compute/volume_attachment.rb +15 -0
- data/lib/fog/openstack/models/compute/volume_attachments.rb +20 -0
- data/lib/fog/openstack/models/identity_v3/projects.rb +1 -1
- data/lib/fog/openstack/models/identity_v3/users.rb +2 -2
- data/lib/fog/openstack/models/image_v2/image.rb +41 -22
- data/lib/fog/openstack/models/network/floating_ip.rb +1 -0
- data/lib/fog/openstack/models/network/rbac_policies.rb +33 -0
- data/lib/fog/openstack/models/network/rbac_policy.rb +35 -0
- data/lib/fog/openstack/models/nfv/vnf.rb +58 -0
- data/lib/fog/openstack/models/nfv/vnfd.rb +53 -0
- data/lib/fog/openstack/models/nfv/vnfds.rb +28 -0
- data/lib/fog/openstack/models/nfv/vnfs.rb +28 -0
- data/lib/fog/openstack/models/volume/snapshot.rb +38 -0
- data/lib/fog/openstack/models/volume/snapshots.rb +26 -0
- data/lib/fog/openstack/models/volume/volume.rb +32 -2
- data/lib/fog/openstack/models/volume/volume_type.rb +3 -4
- data/lib/fog/openstack/models/volume_v1/snapshot.rb +43 -0
- data/lib/fog/openstack/models/volume_v1/snapshots.rb +16 -0
- data/lib/fog/openstack/models/volume_v1/volume.rb +12 -2
- data/lib/fog/openstack/models/volume_v2/snapshot.rb +43 -0
- data/lib/fog/openstack/models/volume_v2/snapshots.rb +16 -0
- data/lib/fog/openstack/models/volume_v2/volume.rb +12 -3
- data/lib/fog/openstack/network.rb +53 -46
- data/lib/fog/openstack/nfv.rb +158 -0
- data/lib/fog/openstack/orchestration.rb +1 -1
- data/lib/fog/openstack/planning.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -1
- data/lib/fog/openstack/requests/compute/{create_volume_snapshot.rb → create_snapshot.rb} +16 -16
- data/lib/fog/openstack/requests/compute/delete_flavor_metadata.rb +30 -0
- data/lib/fog/openstack/requests/compute/evacuate_server.rb +8 -7
- data/lib/fog/openstack/requests/compute/get_key_pair.rb +49 -0
- data/lib/fog/openstack/requests/compute/list_availability_zones.rb +23 -0
- data/lib/fog/openstack/requests/compute/list_volume_attachments.rb +31 -0
- data/lib/fog/openstack/requests/compute/update_flavor_metadata.rb +33 -0
- data/lib/fog/openstack/requests/network/create_rbac_policy.rb +42 -0
- data/lib/fog/openstack/requests/network/delete_rbac_policy.rb +28 -0
- data/lib/fog/openstack/requests/network/get_rbac_policy.rb +28 -0
- data/lib/fog/openstack/requests/network/list_rbac_policies.rb +25 -0
- data/lib/fog/openstack/requests/network/update_port.rb +8 -7
- data/lib/fog/openstack/requests/network/update_rbac_policy.rb +41 -0
- data/lib/fog/openstack/requests/nfv/create_vnf.rb +37 -0
- data/lib/fog/openstack/requests/nfv/create_vnfd.rb +35 -0
- data/lib/fog/openstack/requests/nfv/delete_vnf.rb +23 -0
- data/lib/fog/openstack/requests/nfv/delete_vnfd.rb +23 -0
- data/lib/fog/openstack/requests/nfv/get_vnf.rb +24 -0
- data/lib/fog/openstack/requests/nfv/get_vnfd.rb +24 -0
- data/lib/fog/openstack/requests/nfv/list_vnfds.rb +25 -0
- data/lib/fog/openstack/requests/nfv/list_vnfs.rb +25 -0
- data/lib/fog/openstack/requests/nfv/update_vnf.rb +35 -0
- data/lib/fog/openstack/requests/volume/action.rb +16 -0
- data/lib/fog/openstack/requests/volume/create_snapshot.rb +18 -0
- data/lib/fog/openstack/requests/volume/delete_metadata.rb +15 -0
- data/lib/fog/openstack/requests/volume/delete_snapshot.rb +5 -5
- data/lib/fog/openstack/requests/volume/delete_snapshot_metadata.rb +15 -0
- data/lib/fog/openstack/requests/volume/replace_metadata.rb +20 -0
- data/lib/fog/openstack/requests/volume/update_metadata.rb +20 -0
- data/lib/fog/openstack/requests/volume/update_snapshot.rb +37 -0
- data/lib/fog/openstack/requests/volume/update_snapshot_metadata.rb +20 -0
- data/lib/fog/openstack/requests/volume/update_volume.rb +25 -0
- data/lib/fog/openstack/requests/volume_v1/action.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/create_snapshot.rb +45 -0
- data/lib/fog/openstack/requests/volume_v1/delete_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/delete_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/replace_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_snapshot.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v1/update_volume.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/action.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/create_snapshot.rb +45 -0
- data/lib/fog/openstack/requests/volume_v2/delete_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/delete_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/replace_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_snapshot.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_snapshot_metadata.rb +2 -0
- data/lib/fog/openstack/requests/volume_v2/update_volume.rb +2 -0
- data/lib/fog/openstack/storage.rb +1 -1
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/openstack/volume.rb +1 -1
- data/lib/fog/openstack/volume_v1.rb +29 -21
- data/lib/fog/openstack/volume_v2.rb +29 -21
- data/supported.md +54 -0
- data/tests/openstack/models/identity/ec2_credential_tests.rb +1 -1
- data/tests/openstack/models/identity/ec2_credentials_tests.rb +1 -1
- data/tests/openstack/models/identity/role_tests.rb +8 -3
- data/tests/openstack/models/identity/roles_tests.rb +5 -4
- data/tests/openstack/models/identity/tenant_tests.rb +7 -4
- data/tests/openstack/models/identity/tenants_tests.rb +10 -5
- data/tests/openstack/models/identity/user_tests.rb +4 -3
- data/tests/openstack/models/identity/users_tests.rb +10 -6
- data/tests/openstack/models/nfv/vnf_tests.rb +35 -0
- data/tests/openstack/models/nfv/vnfd_tests.rb +23 -0
- data/tests/openstack/models/nfv/vnfds_tests.rb +31 -0
- data/tests/openstack/models/nfv/vnfs_tests.rb +38 -0
- data/tests/openstack/requests/identity/ec2_credentials_tests.rb +6 -9
- data/tests/openstack/requests/identity/helper.rb +12 -4
- data/tests/openstack/requests/identity/role_tests.rb +13 -10
- data/tests/openstack/requests/identity/tenant_tests.rb +10 -9
- data/tests/openstack/requests/identity/user_tests.rb +11 -6
- data/tests/openstack/requests/image/image_tests.rb +1 -0
- data/tests/openstack/requests/nfv/vnf_tests.rb +70 -0
- data/tests/openstack/requests/nfv/vnfd_tests.rb +44 -0
- metadata +81 -31
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +0 -26
- data/lib/fog/openstack/requests/volume_v1/create_volume_snapshot.rb +0 -44
- data/lib/fog/openstack/requests/volume_v2/create_volume_snapshot.rb +0 -43
- data/tests/openstack/authenticate_tests.rb +0 -200
- data/tests/openstack/identity_version_tests.rb +0 -25
- data/tests/openstack/storage_tests.rb +0 -18
- data/tests/openstack/version_tests.rb +0 -55
- data/tests/openstack/volume_tests.rb +0 -18
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def action(id, data)
|
6
|
+
request(
|
7
|
+
:body => Fog::JSON.encode(data),
|
8
|
+
:expects => [200, 202],
|
9
|
+
:method => 'POST',
|
10
|
+
:path => "volumes/#{id}/action"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
private
|
6
|
+
|
7
|
+
def _create_snapshot(data)
|
8
|
+
request(
|
9
|
+
:body => Fog::JSON.encode(data),
|
10
|
+
:expects => [200, 202],
|
11
|
+
:method => 'POST',
|
12
|
+
:path => "snapshots"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def delete_metadata(volume_id, key_name)
|
6
|
+
request(
|
7
|
+
:expects => [200],
|
8
|
+
:method => 'DELETE',
|
9
|
+
:path => "volumes/#{volume_id}/metadata/#{key_name}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -4,17 +4,17 @@ module Fog
|
|
4
4
|
module Real
|
5
5
|
def delete_snapshot(snapshot_id)
|
6
6
|
request(
|
7
|
-
:expects
|
8
|
-
:method
|
9
|
-
:path
|
7
|
+
:expects => 202,
|
8
|
+
:method => 'DELETE',
|
9
|
+
:path => "snapshots/#{snapshot_id}"
|
10
10
|
)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
module Mock
|
15
|
-
def delete_snapshot(
|
15
|
+
def delete_snapshot(_snapshot_id)
|
16
16
|
response = Excon::Response.new
|
17
|
-
response.status =
|
17
|
+
response.status = 202
|
18
18
|
response
|
19
19
|
end
|
20
20
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def delete_snapshot_metadata(snapshot_id, key_name)
|
6
|
+
request(
|
7
|
+
:expects => [200],
|
8
|
+
:method => 'DELETE',
|
9
|
+
:path => "snapshots/#{snapshot_id}/metadata/#{key_name}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def replace_metadata(volume_id, metadata = {})
|
6
|
+
data = {
|
7
|
+
'metadata' => metadata
|
8
|
+
}
|
9
|
+
|
10
|
+
request(
|
11
|
+
:body => Fog::JSON.encode(data),
|
12
|
+
:expects => [200],
|
13
|
+
:method => 'PUT',
|
14
|
+
:path => "volumes/#{volume_id}/metadata"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def update_metadata(volume_id, metadata = {})
|
6
|
+
data = {
|
7
|
+
'metadata' => metadata
|
8
|
+
}
|
9
|
+
|
10
|
+
request(
|
11
|
+
:body => Fog::JSON.encode(data),
|
12
|
+
:expects => [200],
|
13
|
+
:method => 'POST',
|
14
|
+
:path => "volumes/#{volume_id}/metadata"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def update_snapshot(snapshot_id, data = {})
|
6
|
+
request(
|
7
|
+
:body => Fog::JSON.encode('snapshot' => data),
|
8
|
+
:expects => 200,
|
9
|
+
:method => 'PUT',
|
10
|
+
:path => "snapshots/#{snapshot_id}"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Mock
|
16
|
+
def update_snapshot(snapshot_id, options = {})
|
17
|
+
unless snapshot_id
|
18
|
+
raise ArgumentError, 'snapshot_id is required'
|
19
|
+
end
|
20
|
+
response = Excon::Response.new
|
21
|
+
if snapshot = data[:snapshots][snapshot_id]
|
22
|
+
response.status = 200
|
23
|
+
snapshot['display_name'] = options['display_name'] if options['display_name']
|
24
|
+
snapshot['display_description'] = options['display_description'] if options['display_description']
|
25
|
+
snapshot['name'] = options['name'] if options['name']
|
26
|
+
snapshot['description'] = options['description'] if options['description']
|
27
|
+
snapshot['metadata'] = options['metadata'] if options['metadata']
|
28
|
+
response.body = {'snapshot' => snapshot}
|
29
|
+
response
|
30
|
+
else
|
31
|
+
raise Fog::HP::BlockStorageV2::NotFound
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def update_snapshot_metadata(snapshot_id, metadata = {})
|
6
|
+
data = {
|
7
|
+
'metadata' => metadata
|
8
|
+
}
|
9
|
+
|
10
|
+
request(
|
11
|
+
:body => Fog::JSON.encode(data),
|
12
|
+
:expects => [200],
|
13
|
+
:method => 'POST',
|
14
|
+
:path => "snapshots/#{snapshot_id}/metadata"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
module Real
|
5
|
+
def update_volume(volume_id, data = {})
|
6
|
+
request(
|
7
|
+
:body => Fog::JSON.encode('volume' => data),
|
8
|
+
:expects => 200,
|
9
|
+
:method => 'PUT',
|
10
|
+
:path => "volumes/#{volume_id}"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Mock
|
16
|
+
def update_volume(volume_id, data = {})
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 200
|
19
|
+
response.body = {'volume' => data.merge('id' => volume_id)}
|
20
|
+
response
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'fog/openstack/requests/volume/create_snapshot'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Volume
|
5
|
+
class OpenStack
|
6
|
+
class V1
|
7
|
+
class Real
|
8
|
+
include Fog::Volume::OpenStack::Real
|
9
|
+
|
10
|
+
def create_snapshot(volume_id, name, description, force = false)
|
11
|
+
data = {
|
12
|
+
'snapshot' => {
|
13
|
+
'volume_id' => volume_id,
|
14
|
+
'display_name' => name,
|
15
|
+
'display_description' => description,
|
16
|
+
'force' => force.nil? ? false : force
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
_create_snapshot(data)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Mock
|
25
|
+
def create_snapshot(volume_id, name, description, _force = false)
|
26
|
+
response = Excon::Response.new
|
27
|
+
response.status = 202
|
28
|
+
response.body = {
|
29
|
+
"snapshot" => {
|
30
|
+
"status" => "creating",
|
31
|
+
"display_name" => name,
|
32
|
+
"created_at" => Time.now,
|
33
|
+
"display_description" => description,
|
34
|
+
"volume_id" => volume_id,
|
35
|
+
"id" => "5",
|
36
|
+
"size" => 1
|
37
|
+
}
|
38
|
+
}
|
39
|
+
response
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'fog/openstack/requests/volume/create_snapshot'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Volume
|
5
|
+
class OpenStack
|
6
|
+
class V2
|
7
|
+
class Real
|
8
|
+
include Fog::Volume::OpenStack::Real
|
9
|
+
|
10
|
+
def create_snapshot(volume_id, name, description, force = false)
|
11
|
+
data = {
|
12
|
+
'snapshot' => {
|
13
|
+
'volume_id' => volume_id,
|
14
|
+
'name' => name,
|
15
|
+
'description' => description,
|
16
|
+
'force' => force.nil? ? false : force
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
_create_snapshot(data)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Mock
|
25
|
+
def create_snapshot(volume_id, name, description, _force = false)
|
26
|
+
response = Excon::Response.new
|
27
|
+
response.status = 202
|
28
|
+
response.body = {
|
29
|
+
"snapshot" => {
|
30
|
+
"status" => "creating",
|
31
|
+
"name" => name,
|
32
|
+
"created_at" => Time.now,
|
33
|
+
"description" => description,
|
34
|
+
"volume_id" => volume_id,
|
35
|
+
"id" => "5",
|
36
|
+
"size" => 1
|
37
|
+
}
|
38
|
+
}
|
39
|
+
response
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
:openstack_api_key, :openstack_username, :openstack_identity_endpoint,
|
11
11
|
:current_user, :current_tenant, :openstack_region,
|
12
12
|
:openstack_endpoint_type, :openstack_auth_omit_default_port,
|
13
|
-
:openstack_project_name, :openstack_project_id,
|
13
|
+
:openstack_project_name, :openstack_project_id, :openstack_cache_ttl,
|
14
14
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
15
15
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
16
16
|
:openstack_identity_prefix, :openstack_temp_url_key
|
data/lib/fog/openstack/volume.rb
CHANGED
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
:openstack_tenant, :openstack_tenant_id,
|
9
9
|
:openstack_api_key, :openstack_username, :openstack_identity_endpoint,
|
10
10
|
:current_user, :current_tenant, :openstack_region,
|
11
|
-
:openstack_endpoint_type,
|
11
|
+
:openstack_endpoint_type, :openstack_cache_ttl,
|
12
12
|
:openstack_project_name, :openstack_project_id,
|
13
13
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
14
14
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'fog/openstack/core'
|
2
2
|
require 'fog/openstack/common'
|
3
3
|
require 'fog/openstack/volume'
|
4
4
|
|
@@ -23,6 +23,9 @@ module Fog
|
|
23
23
|
model :volume_type
|
24
24
|
collection :volume_types
|
25
25
|
|
26
|
+
model :snapshot
|
27
|
+
collection :snapshots
|
28
|
+
|
26
29
|
model :transfer
|
27
30
|
collection :transfers
|
28
31
|
|
@@ -32,6 +35,7 @@ module Fog
|
|
32
35
|
request :list_volumes
|
33
36
|
request :list_volumes_detailed
|
34
37
|
request :create_volume
|
38
|
+
request :update_volume
|
35
39
|
request :get_volume_details
|
36
40
|
request :extend_volume
|
37
41
|
request :delete_volume
|
@@ -43,11 +47,14 @@ module Fog
|
|
43
47
|
request :delete_volume_type
|
44
48
|
request :get_volume_type_details
|
45
49
|
|
46
|
-
request :
|
50
|
+
request :create_snapshot
|
51
|
+
request :update_snapshot
|
47
52
|
request :list_snapshots
|
48
53
|
request :list_snapshots_detailed
|
49
54
|
request :get_snapshot_details
|
50
55
|
request :delete_snapshot
|
56
|
+
request :update_snapshot_metadata
|
57
|
+
request :delete_snapshot_metadata
|
51
58
|
|
52
59
|
request :list_transfers
|
53
60
|
request :list_transfers_detailed
|
@@ -59,22 +66,26 @@ module Fog
|
|
59
66
|
request :update_quota
|
60
67
|
request :get_quota
|
61
68
|
request :get_quota_defaults
|
62
|
-
|
63
69
|
request :get_quota_usage
|
64
70
|
|
71
|
+
request :update_metadata
|
72
|
+
request :replace_metadata
|
73
|
+
request :delete_metadata
|
74
|
+
|
65
75
|
request :set_tenant
|
76
|
+
request :action
|
66
77
|
|
67
78
|
class Mock
|
68
79
|
def self.data
|
69
80
|
@data ||= Hash.new do |hash, key|
|
70
81
|
hash[key] = {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
82
|
+
:users => {},
|
83
|
+
:tenants => {},
|
84
|
+
:quota => {
|
85
|
+
'gigabytes' => 1000,
|
86
|
+
'volumes' => 10,
|
87
|
+
'snapshots' => 10
|
88
|
+
}
|
78
89
|
}
|
79
90
|
end
|
80
91
|
end
|
@@ -83,7 +94,7 @@ module Fog
|
|
83
94
|
@data = nil
|
84
95
|
end
|
85
96
|
|
86
|
-
def initialize(options={})
|
97
|
+
def initialize(options = {})
|
87
98
|
@openstack_username = options[:openstack_username]
|
88
99
|
@openstack_tenant = options[:openstack_tenant]
|
89
100
|
@openstack_auth_uri = URI.parse(options[:openstack_auth_url])
|
@@ -100,11 +111,11 @@ module Fog
|
|
100
111
|
unless @data[:users].find { |u| u['name'] == options[:openstack_username] }
|
101
112
|
id = Fog::Mock.random_numbers(6).to_s
|
102
113
|
@data[:users][id] = {
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
114
|
+
'id' => id,
|
115
|
+
'name' => options[:openstack_username],
|
116
|
+
'email' => "#{options[:openstack_username]}@mock.com",
|
117
|
+
'tenantId' => Fog::Mock.random_numbers(6).to_s,
|
118
|
+
'enabled' => true
|
108
119
|
}
|
109
120
|
end
|
110
121
|
end
|
@@ -132,7 +143,7 @@ module Fog
|
|
132
143
|
end
|
133
144
|
include Fog::OpenStack::Common
|
134
145
|
|
135
|
-
def initialize(options={})
|
146
|
+
def initialize(options = {})
|
136
147
|
initialize_identity options
|
137
148
|
|
138
149
|
@openstack_service_type = options[:openstack_service_type] || ['volume']
|
@@ -153,11 +164,8 @@ module Fog
|
|
153
164
|
@persistent = options[:persistent] || false
|
154
165
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
155
166
|
end
|
156
|
-
|
157
|
-
private
|
158
|
-
|
159
167
|
end
|
160
168
|
end
|
161
169
|
end
|
162
170
|
end
|
163
|
-
end
|
171
|
+
end
|