fog-openstack 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/orchestration.md +23 -0
- data/examples/event/basics.rb +22 -0
- data/gemfiles/Gemfile-1.9 +1 -0
- data/lib/fog/compute/openstack.rb +28 -2
- data/lib/fog/compute/openstack/models/os_interface.rb +15 -0
- data/lib/fog/compute/openstack/models/os_interfaces.rb +28 -0
- data/lib/fog/compute/openstack/models/server.rb +5 -0
- data/lib/fog/compute/openstack/requests/create_os_interface.rb +42 -0
- data/lib/fog/compute/openstack/requests/delete_key_pair.rb +1 -1
- data/lib/fog/compute/openstack/requests/delete_os_interface.rb +24 -0
- data/lib/fog/compute/openstack/requests/get_hypervisor.rb +64 -0
- data/lib/fog/compute/openstack/requests/get_key_pair.rb +1 -1
- data/lib/fog/compute/openstack/requests/get_os_interface.rb +24 -0
- data/lib/fog/compute/openstack/requests/list_hypervisor_servers.rb +42 -0
- data/lib/fog/compute/openstack/requests/list_hypervisors.rb +27 -0
- data/lib/fog/compute/openstack/requests/list_hypervisors_detail.rb +71 -0
- data/lib/fog/compute/openstack/requests/list_os_interfaces.rb +24 -0
- data/lib/fog/dns/openstack/v2/requests/create_zone.rb +1 -1
- data/lib/fog/event/openstack.rb +120 -0
- data/lib/fog/event/openstack/models/event.rb +16 -0
- data/lib/fog/event/openstack/models/events.rb +23 -0
- data/lib/fog/event/openstack/requests/get_event.rb +27 -0
- data/lib/fog/event/openstack/requests/list_events.rb +42 -0
- data/lib/fog/identity/openstack/v3/models/domains.rb +23 -11
- data/lib/fog/key_manager/openstack.rb +1 -1
- data/lib/fog/metering/openstack.rb +1 -0
- data/lib/fog/network/openstack.rb +10 -0
- data/lib/fog/network/openstack/models/subnet_pool.rb +47 -0
- data/lib/fog/network/openstack/models/subnet_pools.rb +33 -0
- data/lib/fog/network/openstack/requests/create_subnet_pool.rb +56 -0
- data/lib/fog/network/openstack/requests/delete_subnet_pool.rb +28 -0
- data/lib/fog/network/openstack/requests/get_subnet_pool.rb +29 -0
- data/lib/fog/network/openstack/requests/list_subnet_pools.rb +25 -0
- data/lib/fog/network/openstack/requests/update_subnet_pool.rb +46 -0
- data/lib/fog/openstack.rb +90 -68
- data/lib/fog/openstack/core.rb +53 -7
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/shared_file_system/openstack.rb +51 -8
- data/lib/fog/shared_file_system/openstack/models/share.rb +28 -0
- data/lib/fog/shared_file_system/openstack/models/share_access_rule.rb +35 -0
- data/lib/fog/shared_file_system/openstack/models/share_access_rules.rb +30 -0
- data/lib/fog/shared_file_system/openstack/requests/extend_share.rb +24 -0
- data/lib/fog/shared_file_system/openstack/requests/get_limits.rb +45 -0
- data/lib/fog/shared_file_system/openstack/requests/get_quota.rb +26 -0
- data/lib/fog/shared_file_system/openstack/requests/grant_share_access.rb +34 -0
- data/lib/fog/shared_file_system/openstack/requests/list_share_access_rules.rb +29 -0
- data/lib/fog/shared_file_system/openstack/requests/revoke_share_access.rb +24 -0
- data/lib/fog/shared_file_system/openstack/requests/share_action.rb +16 -0
- data/lib/fog/shared_file_system/openstack/requests/shrink_share.rb +24 -0
- data/lib/fog/shared_file_system/openstack/requests/update_quota.rb +30 -0
- metadata +36 -2
@@ -2,6 +2,7 @@ module Fog
|
|
2
2
|
module SharedFileSystem
|
3
3
|
class OpenStack < Fog::Service
|
4
4
|
SUPPORTED_VERSIONS = /v2(\.0)*/
|
5
|
+
SUPPORTED_MICROVERSION = '2.15'.freeze
|
5
6
|
|
6
7
|
requires :openstack_auth_url
|
7
8
|
recognizes :openstack_auth_token, :openstack_management_url,
|
@@ -13,7 +14,7 @@ module Fog
|
|
13
14
|
:openstack_project_name, :openstack_project_id,
|
14
15
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
15
16
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
16
|
-
:openstack_identity_prefix
|
17
|
+
:openstack_identity_prefix, :openstack_shared_file_system_microversion
|
17
18
|
|
18
19
|
model_path 'fog/shared_file_system/openstack/models'
|
19
20
|
model :network
|
@@ -22,6 +23,8 @@ module Fog
|
|
22
23
|
collection :shares
|
23
24
|
model :snapshot
|
24
25
|
collection :snapshots
|
26
|
+
model :share_access_rule
|
27
|
+
collection :share_access_rules
|
25
28
|
|
26
29
|
request_path 'fog/shared_file_system/openstack/requests'
|
27
30
|
# share networks
|
@@ -39,6 +42,12 @@ module Fog
|
|
39
42
|
request :create_share
|
40
43
|
request :update_share
|
41
44
|
request :delete_share
|
45
|
+
request :share_action
|
46
|
+
request :grant_share_access
|
47
|
+
request :revoke_share_access
|
48
|
+
request :list_share_access_rules
|
49
|
+
request :extend_share
|
50
|
+
request :shrink_share
|
42
51
|
|
43
52
|
# snapshots
|
44
53
|
request :list_snapshots
|
@@ -48,6 +57,11 @@ module Fog
|
|
48
57
|
request :update_snapshot
|
49
58
|
request :delete_snapshot
|
50
59
|
|
60
|
+
# quota + limits
|
61
|
+
request :get_limits
|
62
|
+
request :get_quota
|
63
|
+
request :update_quota
|
64
|
+
|
51
65
|
# rubocop:disable LineLength, Metrics/MethodLength, Metrics/ClassLength, Metrics/AbcSize
|
52
66
|
class Mock
|
53
67
|
def self.data
|
@@ -189,7 +203,27 @@ module Fog
|
|
189
203
|
"id" => "086a1aa6-c425-4ecd-9612-391a3b1b9375",
|
190
204
|
"size" => 1
|
191
205
|
}
|
192
|
-
]
|
206
|
+
],
|
207
|
+
:access_rules => [
|
208
|
+
{
|
209
|
+
"share_id" => "406ea93b-32e9-4907-a117-148b3945749f",
|
210
|
+
"created_at" => "2015-09-07T09:14:48.000000",
|
211
|
+
"updated_at" => '',
|
212
|
+
"access_type" => "ip",
|
213
|
+
"access_to" => "0.0.0.0/0",
|
214
|
+
"access_level" => "rw",
|
215
|
+
"access_key" => '',
|
216
|
+
"id" => "a25b2df3-90bd-4add-afa6-5f0dbbd50452"
|
217
|
+
}
|
218
|
+
],
|
219
|
+
:quota => {
|
220
|
+
"gigabytes" => 1000,
|
221
|
+
"shares" => 50,
|
222
|
+
"snapshot_gigabytes" => 1000,
|
223
|
+
"snapshots" => 50,
|
224
|
+
"share_networks" => 10,
|
225
|
+
"id" => "16e1ab15c35a457e9c2b2aa189f544e1"
|
226
|
+
}
|
193
227
|
}
|
194
228
|
end
|
195
229
|
end
|
@@ -250,28 +284,37 @@ module Fog
|
|
250
284
|
end
|
251
285
|
|
252
286
|
def initialize(options = {})
|
253
|
-
|
287
|
+
@supported_versions = SUPPORTED_VERSIONS
|
288
|
+
@supported_microversion = SUPPORTED_MICROVERSION
|
289
|
+
@fixed_microversion = options[:openstack_shared_file_system_microversion]
|
290
|
+
@microversion_key = 'X-Openstack-Manila-Api-Version'.freeze
|
254
291
|
|
255
|
-
|
256
|
-
@openstack_service_name = options[:openstack_service_name]
|
292
|
+
initialize_identity options
|
257
293
|
|
258
|
-
@
|
294
|
+
@openstack_service_type = options[:openstack_service_type] || ['sharev2']
|
295
|
+
@openstack_service_name = options[:openstack_service_name]
|
296
|
+
@connection_options = options[:connection_options] || {}
|
259
297
|
|
260
298
|
authenticate
|
261
299
|
set_api_path
|
300
|
+
set_microversion
|
262
301
|
|
263
302
|
@persistent = options[:persistent] || false
|
264
303
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
265
304
|
end
|
266
305
|
|
267
306
|
def set_api_path
|
268
|
-
unless @path.match(
|
269
|
-
@path = Fog::OpenStack.get_supported_version_path(
|
307
|
+
unless @path.match(@supported_versions)
|
308
|
+
@path = Fog::OpenStack.get_supported_version_path(@supported_versions,
|
270
309
|
@openstack_management_uri,
|
271
310
|
@auth_token,
|
272
311
|
@connection_options)
|
273
312
|
end
|
274
313
|
end
|
314
|
+
|
315
|
+
def action_prefix
|
316
|
+
microversion_newer_than?('2.6') ? '' : 'os-'
|
317
|
+
end
|
275
318
|
end
|
276
319
|
end
|
277
320
|
end
|
@@ -57,6 +57,34 @@ module Fog
|
|
57
57
|
def ready?
|
58
58
|
status == 'available'
|
59
59
|
end
|
60
|
+
|
61
|
+
def extend(size)
|
62
|
+
requires :id
|
63
|
+
service.extend_share(id, size)
|
64
|
+
true
|
65
|
+
end
|
66
|
+
|
67
|
+
def shrink(size)
|
68
|
+
requires :id
|
69
|
+
service.shrink_share(id, size)
|
70
|
+
true
|
71
|
+
end
|
72
|
+
|
73
|
+
def grant_access(access_to, access_type, access_level)
|
74
|
+
requires :id
|
75
|
+
service.grant_share_access(id, access_to, access_type, access_level)
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
def revoke_access(access_id)
|
80
|
+
requires :id
|
81
|
+
service.revoke_share_access(id, access_id)
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
def access_rules
|
86
|
+
service.share_access_rules(:share => self)
|
87
|
+
end
|
60
88
|
end
|
61
89
|
end
|
62
90
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'fog/openstack/models/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module SharedFileSystem
|
5
|
+
class OpenStack
|
6
|
+
class ShareAccessRule < Fog::OpenStack::Model
|
7
|
+
attr_accessor :share
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
|
11
|
+
attribute :access_level
|
12
|
+
attribute :access_type
|
13
|
+
attribute :access_to
|
14
|
+
attribute :state
|
15
|
+
|
16
|
+
def save
|
17
|
+
requires :share, :access_level, :access_type, :access_to
|
18
|
+
raise Fog::Errors::Error, 'Resaving an existing object may create a duplicate' if persisted?
|
19
|
+
merge_attributes(service.grant_share_access(@share.id, access_to, access_type, access_level).body['access'])
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def destroy
|
24
|
+
requires :id, :share
|
25
|
+
service.revoke_share_access(@share.id, id)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def ready?
|
30
|
+
state == 'active'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fog/openstack/models/collection'
|
2
|
+
require 'fog/shared_file_system/openstack/models/share_access_rule'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module SharedFileSystem
|
6
|
+
class OpenStack
|
7
|
+
class ShareAccessRules < Fog::OpenStack::Collection
|
8
|
+
model Fog::SharedFileSystem::OpenStack::ShareAccessRule
|
9
|
+
|
10
|
+
attr_accessor :share
|
11
|
+
|
12
|
+
def all
|
13
|
+
requires :share
|
14
|
+
load_response(service.list_share_access_rules(@share.id), 'access_list')
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_by_id(id)
|
18
|
+
all.find { |rule| rule.id == id }
|
19
|
+
end
|
20
|
+
|
21
|
+
alias get find_by_id
|
22
|
+
|
23
|
+
def new(attributes = {})
|
24
|
+
requires :share
|
25
|
+
super({:share => @share}.merge!(attributes))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def extend_share(share_id, new_size)
|
6
|
+
action = {
|
7
|
+
"#{action_prefix}extend" => {
|
8
|
+
'new_size' => new_size
|
9
|
+
}
|
10
|
+
}
|
11
|
+
share_action(share_id, action)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def extend_share(_share_id, _new_size)
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 202
|
19
|
+
response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def get_limits
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:path => 'limits'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def get_limits
|
16
|
+
absolute_limits = {
|
17
|
+
# Max
|
18
|
+
'maxTotalShareGigabytes' => 1000,
|
19
|
+
'maxTotalShareNetworks' => 10,
|
20
|
+
'maxTotalShares' => 50,
|
21
|
+
'maxTotalSnapshotGigabytes' => 1000,
|
22
|
+
'maxTotalShareSnapshots' => 50,
|
23
|
+
|
24
|
+
# Used
|
25
|
+
'totalShareNetworksUsed' => 0,
|
26
|
+
'totalSharesUsed' => 0,
|
27
|
+
'totalShareGigabytesUsed' => 0,
|
28
|
+
'totalShareSnapshotsUsed' => 0,
|
29
|
+
'totalSnapshotGigabytesUsed' => 0
|
30
|
+
}
|
31
|
+
|
32
|
+
Excon::Response.new(
|
33
|
+
:status => 200,
|
34
|
+
:body => {
|
35
|
+
'limits' => {
|
36
|
+
'rate' => [],
|
37
|
+
'absolute' => absolute_limits
|
38
|
+
}
|
39
|
+
}
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def get_quota(project_id)
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "#{action_prefix}quota-sets/#{project_id}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def get_quota(project_id)
|
16
|
+
response = Excon::Response.new
|
17
|
+
response.status = 200
|
18
|
+
quota_data = data[:quota_updated] || data[:quota]
|
19
|
+
quota_data['id'] = project_id
|
20
|
+
response.body = {'quota_set' => quota_data}
|
21
|
+
response
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def grant_share_access(share_id, access_to = '0.0.0.0/0', access_type = 'ip', access_level = 'rw')
|
6
|
+
action = {
|
7
|
+
"#{action_prefix}allow_access" => {
|
8
|
+
'access_to' => access_to,
|
9
|
+
'access_type' => access_type,
|
10
|
+
'access_level' => access_level
|
11
|
+
}
|
12
|
+
}
|
13
|
+
share_action(share_id, action, 200)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Mock
|
18
|
+
def grant_share_access(share_id, access_to, access_type, access_level)
|
19
|
+
response = Excon::Response.new
|
20
|
+
response.status = 200
|
21
|
+
|
22
|
+
access = data[:access_rules].first
|
23
|
+
access[:share_id] = share_id
|
24
|
+
access[:access_level] = access_level
|
25
|
+
access[:access_type] = access_type
|
26
|
+
access[:access_to] = access_to
|
27
|
+
|
28
|
+
response.body = {'access' => access}
|
29
|
+
response
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def list_share_access_rules(share_id)
|
6
|
+
action = {
|
7
|
+
"#{action_prefix}access_list" => nil
|
8
|
+
}
|
9
|
+
share_action(share_id, action, 200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
def list_share_access_rules(share_id)
|
15
|
+
response = Excon::Response.new
|
16
|
+
response.status = 200
|
17
|
+
|
18
|
+
rules = data[:access_rules]
|
19
|
+
rules.each do |rule|
|
20
|
+
rule[:share_id] = share_id
|
21
|
+
end
|
22
|
+
|
23
|
+
response.body = {'access_list' => rules}
|
24
|
+
response
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def revoke_share_access(share_id, access_id)
|
6
|
+
action = {
|
7
|
+
"#{action_prefix}deny_access" => {
|
8
|
+
'access_id' => access_id
|
9
|
+
}
|
10
|
+
}
|
11
|
+
share_action(share_id, action)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def revoke_share_access(_share_id, _access_id)
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 202
|
19
|
+
response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def share_action(id, options = {}, expects_status = 202)
|
6
|
+
request(
|
7
|
+
:body => Fog::JSON.encode(options),
|
8
|
+
:expects => expects_status,
|
9
|
+
:method => 'POST',
|
10
|
+
:path => "shares/#{id}/action"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module SharedFileSystem
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def shrink_share(share_id, new_size)
|
6
|
+
action = {
|
7
|
+
"#{action_prefix}shrink" => {
|
8
|
+
'new_size' => new_size
|
9
|
+
}
|
10
|
+
}
|
11
|
+
share_action(share_id, action)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def shrink_share(_share_id, _new_size)
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 202
|
19
|
+
response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|