fog-openstack 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +2 -2
- data/Rakefile +1 -8
- data/docs/orchestration.md +19 -0
- data/fog-openstack.gemspec +2 -1
- data/gemfiles/Gemfile-1.9 +2 -1
- data/lib/fog/dns/openstack/v2.rb +20 -0
- data/lib/fog/dns/openstack/v2/models/recordset.rb +55 -0
- data/lib/fog/dns/openstack/v2/models/recordsets.rb +30 -0
- data/lib/fog/dns/openstack/v2/models/zone.rb +50 -0
- data/lib/fog/dns/openstack/v2/models/zones.rb +30 -0
- data/lib/fog/dns/openstack/v2/requests/delete_recordset.rb +5 -3
- data/lib/fog/dns/openstack/v2/requests/delete_zone.rb +5 -3
- data/lib/fog/dns/openstack/v2/requests/get_quota.rb +4 -2
- data/lib/fog/dns/openstack/v2/requests/get_recordset.rb +4 -2
- data/lib/fog/dns/openstack/v2/requests/get_zone.rb +5 -3
- data/lib/fog/dns/openstack/v2/requests/list_recordsets.rb +29 -5
- data/lib/fog/dns/openstack/v2/requests/list_zones.rb +4 -1
- data/lib/fog/dns/openstack/v2/requests/update_quota.rb +4 -3
- data/lib/fog/dns/openstack/v2/requests/update_recordset.rb +4 -1
- data/lib/fog/dns/openstack/v2/requests/update_zone.rb +4 -1
- data/lib/fog/introspection/openstack.rb +3 -8
- data/lib/fog/monitoring/openstack.rb +7 -1
- data/lib/fog/monitoring/openstack/models/alarm.rb +0 -1
- data/lib/fog/monitoring/openstack/models/alarm_definition.rb +1 -0
- data/lib/fog/monitoring/openstack/models/dimension_value.rb +19 -0
- data/lib/fog/monitoring/openstack/models/dimension_values.rb +16 -0
- data/lib/fog/monitoring/openstack/models/metrics.rb +8 -0
- data/lib/fog/monitoring/openstack/models/notification_method.rb +8 -1
- data/lib/fog/monitoring/openstack/models/notification_methods.rb +4 -0
- data/lib/fog/monitoring/openstack/requests/list_dimension_values.rb +21 -0
- data/lib/fog/monitoring/openstack/requests/list_notification_method_types.rb +21 -0
- data/lib/fog/monitoring/openstack/requests/{update_notification_method.rb → patch_notification_method.rb} +1 -1
- data/lib/fog/monitoring/openstack/requests/put_notification_method.rb +19 -0
- data/lib/fog/network/openstack.rb +12 -8
- data/lib/fog/network/openstack/requests/create_network.rb +54 -63
- data/lib/fog/network/openstack/requests/update_network.rb +27 -8
- data/lib/fog/openstack.rb +44 -28
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/orchestration/openstack.rb +1 -0
- data/lib/fog/orchestration/openstack/models/stack.rb +4 -0
- data/lib/fog/orchestration/openstack/requests/cancel_update.rb +26 -0
- metadata +13 -30
- data/tests/fixtures/introspection.yaml +0 -287
- data/tests/helper.rb +0 -24
- data/tests/helpers/collection_helper.rb +0 -97
- data/tests/helpers/compute/flavors_helper.rb +0 -32
- data/tests/helpers/compute/server_helper.rb +0 -25
- data/tests/helpers/compute/servers_helper.rb +0 -10
- data/tests/helpers/formats_helper.rb +0 -98
- data/tests/helpers/formats_helper_tests.rb +0 -110
- data/tests/helpers/mock_helper.rb +0 -17
- data/tests/helpers/model_helper.rb +0 -31
- data/tests/helpers/responds_to_helper.rb +0 -11
- data/tests/helpers/schema_validator_tests.rb +0 -107
- data/tests/helpers/succeeds_helper.rb +0 -9
@@ -4,11 +4,14 @@ module Fog
|
|
4
4
|
class V2
|
5
5
|
class Real
|
6
6
|
def list_zones(options = {})
|
7
|
+
headers, options = Fog::DNS::OpenStack::V2.setup_headers(options)
|
8
|
+
|
7
9
|
request(
|
8
10
|
:expects => 200,
|
9
11
|
:method => 'GET',
|
10
12
|
:path => 'zones',
|
11
|
-
:query => options
|
13
|
+
:query => options,
|
14
|
+
:headers => headers
|
12
15
|
)
|
13
16
|
end
|
14
17
|
end
|
@@ -4,13 +4,14 @@ module Fog
|
|
4
4
|
class V2
|
5
5
|
class Real
|
6
6
|
def update_quota(project_id, options = {})
|
7
|
-
|
7
|
+
headers, options = Fog::DNS::OpenStack::V2.setup_headers(options)
|
8
|
+
|
8
9
|
request(
|
9
|
-
:headers => {"X-Auth-All-Projects" => all_projects},
|
10
10
|
:body => Fog::JSON.encode(options),
|
11
11
|
:expects => 200,
|
12
12
|
:method => 'PATCH',
|
13
|
-
:path => "quotas/#{project_id}"
|
13
|
+
:path => "quotas/#{project_id}",
|
14
|
+
:headers => headers
|
14
15
|
)
|
15
16
|
end
|
16
17
|
end
|
@@ -4,11 +4,14 @@ module Fog
|
|
4
4
|
class V2
|
5
5
|
class Real
|
6
6
|
def update_recordset(zone_id, id, options = {})
|
7
|
+
headers, options = Fog::DNS::OpenStack::V2.setup_headers(options)
|
8
|
+
|
7
9
|
request(
|
8
10
|
:body => Fog::JSON.encode(options),
|
9
11
|
:expects => 202,
|
10
12
|
:method => 'PUT',
|
11
|
-
:path => "zones/#{zone_id}/recordsets/#{id}"
|
13
|
+
:path => "zones/#{zone_id}/recordsets/#{id}",
|
14
|
+
:headers => headers
|
12
15
|
)
|
13
16
|
end
|
14
17
|
end
|
@@ -4,11 +4,14 @@ module Fog
|
|
4
4
|
class V2
|
5
5
|
class Real
|
6
6
|
def update_zone(id, options = {})
|
7
|
+
headers, options = Fog::DNS::OpenStack::V2.setup_headers(options)
|
8
|
+
|
7
9
|
request(
|
8
10
|
:body => Fog::JSON.encode(options),
|
9
11
|
:expects => 202,
|
10
12
|
:method => 'PATCH',
|
11
|
-
:path => "zones/#{id}"
|
13
|
+
:path => "zones/#{id}",
|
14
|
+
:headers => headers
|
12
15
|
)
|
13
16
|
end
|
14
17
|
end
|
@@ -43,7 +43,7 @@ module Fog
|
|
43
43
|
def self.data
|
44
44
|
@data ||= Hash.new do |hash, key|
|
45
45
|
# Introspection data is *huge* we load it from a yaml file
|
46
|
-
file = "../../../../
|
46
|
+
file = "../../../../test/fixtures/introspection.yaml"
|
47
47
|
hash[key] = YAML.load(File.read(File.expand_path(file, __FILE__)))
|
48
48
|
end
|
49
49
|
end
|
@@ -80,7 +80,7 @@ module Fog
|
|
80
80
|
def initialize(options = {})
|
81
81
|
initialize_identity options
|
82
82
|
|
83
|
-
@openstack_service_type = options[:openstack_service_type] || ['introspection']
|
83
|
+
@openstack_service_type = options[:openstack_service_type] || ['baremetal-introspection']
|
84
84
|
@openstack_service_name = options[:openstack_service_name]
|
85
85
|
|
86
86
|
@connection_options = options[:connection_options] || {}
|
@@ -94,12 +94,7 @@ module Fog
|
|
94
94
|
|
95
95
|
def set_api_path
|
96
96
|
unless @path.match(SUPPORTED_VERSIONS)
|
97
|
-
@path = "/"
|
98
|
-
SUPPORTED_VERSIONS,
|
99
|
-
@openstack_management_uri,
|
100
|
-
@auth_token,
|
101
|
-
@connection_options
|
102
|
-
)
|
97
|
+
@path = "/v1"
|
103
98
|
end
|
104
99
|
end
|
105
100
|
end
|
@@ -31,6 +31,7 @@ module Fog
|
|
31
31
|
collection :alarm_states
|
32
32
|
model :alarm_count
|
33
33
|
collection :alarm_counts
|
34
|
+
model :dimension_value
|
34
35
|
|
35
36
|
request_path 'fog/monitoring/openstack/requests'
|
36
37
|
request :create_metric
|
@@ -45,7 +46,8 @@ module Fog
|
|
45
46
|
request :create_notification_method
|
46
47
|
request :get_notification_method
|
47
48
|
request :list_notification_methods
|
48
|
-
request :
|
49
|
+
request :put_notification_method
|
50
|
+
request :patch_notification_method
|
49
51
|
request :delete_notification_method
|
50
52
|
|
51
53
|
request :create_alarm_definition
|
@@ -65,6 +67,10 @@ module Fog
|
|
65
67
|
request :list_alarm_state_history_for_specific_alarm
|
66
68
|
request :list_alarm_state_history_for_all_alarms
|
67
69
|
|
70
|
+
request :list_dimension_values
|
71
|
+
|
72
|
+
request :list_notification_method_types
|
73
|
+
|
68
74
|
class Real
|
69
75
|
include Fog::OpenStack::Core
|
70
76
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'fog/openstack/models/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Monitoring
|
5
|
+
class OpenStack
|
6
|
+
class DimensionValue < Fog::OpenStack::Model
|
7
|
+
identity :id
|
8
|
+
|
9
|
+
attribute :metric_name
|
10
|
+
attribute :dimension_name
|
11
|
+
attribute :values
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fog/openstack/models/collection'
|
2
|
+
require 'fog/monitoring/openstack/models/dimension_value'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Monitoring
|
6
|
+
class OpenStack
|
7
|
+
class DimensionValues < Fog::OpenStack::Collection
|
8
|
+
model Fog::Monitoring::OpenStack::DimensionValue
|
9
|
+
|
10
|
+
def all(dimension_name, options = {})
|
11
|
+
load_response(service.list_dimension_values(dimension_name, options), 'elements')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fog/openstack/models/collection'
|
2
2
|
require 'fog/monitoring/openstack/models/metric'
|
3
|
+
require 'fog/monitoring/openstack/models/dimension_values'
|
3
4
|
|
4
5
|
module Fog
|
5
6
|
module Monitoring
|
@@ -22,6 +23,13 @@ module Fog
|
|
22
23
|
def create_metric_array(metrics_list = [])
|
23
24
|
service.create_metric_array(metrics_list)
|
24
25
|
end
|
26
|
+
|
27
|
+
def list_dimension_values(dimension_name, options = {})
|
28
|
+
dimension_value = Fog::Monitoring::OpenStack::DimensionValues.new
|
29
|
+
dimension_value.load_response(
|
30
|
+
service.list_dimension_values(dimension_name, options), 'elements'
|
31
|
+
)
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
@@ -10,6 +10,7 @@ module Fog
|
|
10
10
|
attribute :links
|
11
11
|
attribute :type
|
12
12
|
attribute :address
|
13
|
+
attribute :period
|
13
14
|
|
14
15
|
def create
|
15
16
|
requires :name, :type, :address
|
@@ -21,7 +22,13 @@ module Fog
|
|
21
22
|
def update(attr = nil)
|
22
23
|
requires :name, :type, :address
|
23
24
|
merge_attributes(
|
24
|
-
service.
|
25
|
+
service.put_notification_method(id, attr || attributes).body
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def patch(attr = nil)
|
30
|
+
merge_attributes(
|
31
|
+
service.patch_notification_method(id, attr || attributes).body
|
25
32
|
)
|
26
33
|
end
|
27
34
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fog
|
2
|
+
module Monitoring
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def list_dimension_values(dimension_name, options = {})
|
6
|
+
request(
|
7
|
+
:expects => [200],
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "metrics/dimensions/names/values",
|
10
|
+
:query => options.merge(:dimension_name => dimension_name)
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
# def list_dimension_values(dimension_name, options = {})
|
17
|
+
# end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fog
|
2
|
+
module Monitoring
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def list_notification_method_types
|
6
|
+
request(
|
7
|
+
:expects => [200],
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "notification-methods/types"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
# def list_notification_method_types
|
16
|
+
#
|
17
|
+
# end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Fog
|
2
|
+
module Monitoring
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def put_notification_method(id, notification)
|
6
|
+
request(
|
7
|
+
:expects => [200],
|
8
|
+
:method => 'PUT',
|
9
|
+
:path => "notification-methods/#{id}",
|
10
|
+
:body => Fog::JSON.encode(notification)
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -185,6 +185,7 @@ module Fog
|
|
185
185
|
class Mock
|
186
186
|
def self.data
|
187
187
|
@data ||= Hash.new do |hash, key|
|
188
|
+
qos_policy_id = Fog::UUID.uuid
|
188
189
|
network_id = Fog::UUID.uuid
|
189
190
|
subnet_id = Fog::UUID.uuid
|
190
191
|
tenant_id = Fog::Mock.random_hex(8)
|
@@ -198,18 +199,21 @@ module Fog
|
|
198
199
|
'shared' => true,
|
199
200
|
'status' => 'ACTIVE',
|
200
201
|
'tenant_id' => tenant_id,
|
201
|
-
'
|
202
|
+
'provider:network:type' => 'vlan',
|
202
203
|
'router:external' => false,
|
203
204
|
'admin_state_up' => true,
|
205
|
+
'qos_policy_id' => qos_policy_id,
|
206
|
+
'port_security_enabled' => 'port_security_enabled'
|
204
207
|
},
|
205
208
|
'e624a36d-762b-481f-9b50-4154ceb78bbb' => {
|
206
|
-
'id'
|
207
|
-
'name'
|
208
|
-
'subnets'
|
209
|
-
'shared'
|
210
|
-
'status'
|
211
|
-
'admin_state_up'
|
212
|
-
'tenant_id'
|
209
|
+
'id' => 'e624a36d-762b-481f-9b50-4154ceb78bbb',
|
210
|
+
'name' => 'network_1',
|
211
|
+
'subnets' => ['2e4ec6a4-0150-47f5-8523-e899ac03026e'],
|
212
|
+
'shared' => false,
|
213
|
+
'status' => 'ACTIVE',
|
214
|
+
'admin_state_up' => true,
|
215
|
+
'tenant_id' => 'f8b26a6032bc47718a7702233ac708b9',
|
216
|
+
'router:external' => false,
|
213
217
|
}
|
214
218
|
},
|
215
219
|
:ports => {},
|
@@ -2,48 +2,57 @@ module Fog
|
|
2
2
|
module Network
|
3
3
|
class OpenStack
|
4
4
|
class Real
|
5
|
-
|
6
|
-
|
5
|
+
CREATE_OPTIONS = [
|
6
|
+
:name,
|
7
|
+
:shared,
|
8
|
+
:admin_state_up,
|
9
|
+
:qos_policy_id,
|
10
|
+
:port_security_enabled,
|
11
|
+
:tenant_id,
|
12
|
+
].freeze
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
# Advanced Features through API Extensions
|
15
|
+
#
|
16
|
+
# Not strictly required but commonly found in OpenStack
|
17
|
+
# installs with Quantum networking.
|
18
|
+
#
|
19
|
+
# @see http://docs.openstack.org/trunk/openstack-network/admin/content/provider_attributes.html
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
EXTENTED_OPTIONS = [
|
22
|
+
:provider_network_type,
|
23
|
+
:provider_segmentation_id,
|
24
|
+
:provider_physical_network,
|
25
|
+
:router_external,
|
26
|
+
].freeze
|
18
27
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
#
|
24
|
-
# @see http://docs.openstack.org/trunk/openstack-network/admin/content/provider_attributes.html
|
25
|
-
provider_options = [
|
26
|
-
:router_external,
|
27
|
-
:provider_network_type,
|
28
|
-
:provider_segmentation_id,
|
29
|
-
:provider_physical_network
|
30
|
-
]
|
28
|
+
# Map Fog::Network::OpenStack::Network
|
29
|
+
# model attributes to OpenStack provider attributes
|
30
|
+
ALIASES = {
|
31
|
+
:provider_network_type => 'provider:network_type',
|
31
32
|
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
:provider_segmentation_id => 'provider:segmentation_id',
|
39
|
-
:router_external => 'router:external'
|
40
|
-
}
|
33
|
+
# Not applicable to the "local" or "gre" network types
|
34
|
+
:provider_physical_network => 'provider:physical_network',
|
35
|
+
:provider_segmentation_id => 'provider:segmentation_id',
|
36
|
+
|
37
|
+
:router_external => 'router:external'
|
38
|
+
}.freeze
|
41
39
|
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
def self.create(options)
|
41
|
+
data = {}
|
42
|
+
CREATE_OPTIONS.reject { |o| options[o].nil? }.each do |key|
|
43
|
+
data[key.to_s] = options[key]
|
44
|
+
end
|
45
|
+
|
46
|
+
EXTENTED_OPTIONS.reject { |o| options[o].nil? }.each do |key|
|
47
|
+
aliased_key = ALIASES[key] || key
|
48
|
+
data[aliased_key] = options[key]
|
45
49
|
end
|
50
|
+
data
|
51
|
+
end
|
46
52
|
|
53
|
+
def create_network(options = {})
|
54
|
+
data = {}
|
55
|
+
data['network'] = self.class.create(options)
|
47
56
|
request(
|
48
57
|
:body => Fog::JSON.encode(data),
|
49
58
|
:expects => [201],
|
@@ -58,35 +67,17 @@ module Fog
|
|
58
67
|
response = Excon::Response.new
|
59
68
|
response.status = 201
|
60
69
|
data = {
|
61
|
-
'id'
|
62
|
-
'name'
|
63
|
-
'shared'
|
64
|
-
'subnets'
|
65
|
-
'status'
|
66
|
-
'admin_state_up'
|
67
|
-
'tenant_id'
|
68
|
-
|
69
|
-
|
70
|
-
# Add provider specific attributes when found
|
71
|
-
#
|
72
|
-
provider_options = [
|
73
|
-
:router_external,
|
74
|
-
:provider_network_type,
|
75
|
-
:provider_segmentation_id,
|
76
|
-
:provider_physical_network
|
77
|
-
]
|
78
|
-
aliases = {
|
79
|
-
:provider_network_type => 'provider:network_type',
|
80
|
-
# Not applicable to the "local" or "gre" network types
|
81
|
-
:provider_physical_network => 'provider:physical_network',
|
82
|
-
:provider_segmentation_id => 'provider:segmentation_id',
|
83
|
-
:router_external => 'router:external'
|
70
|
+
'id' => Fog::Mock.random_numbers(6).to_s,
|
71
|
+
'name' => options[:name],
|
72
|
+
'shared' => options[:shared],
|
73
|
+
'subnets' => [],
|
74
|
+
'status' => 'ACTIVE',
|
75
|
+
'admin_state_up' => options[:admin_state_up],
|
76
|
+
'tenant_id' => options[:tenant_id],
|
77
|
+
'qos_policy_id' => options[:qos_policy_id],
|
78
|
+
'port_security_enabled' => options[:port_security_enabled]
|
84
79
|
}
|
85
|
-
|
86
|
-
aliased_key = aliases[key] || key
|
87
|
-
data[aliased_key] = options[key]
|
88
|
-
end
|
89
|
-
|
80
|
+
data.merge!(Fog::Network::OpenStack::Real.create(options))
|
90
81
|
self.data[:networks][data['id']] = data
|
91
82
|
response.body = {'network' => data}
|
92
83
|
response
|