fog-openstack 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50563e6b22ba89f6fa72a25141b465c03a062362
|
4
|
+
data.tar.gz: 1fe391d2160e4030614e710cf97763ed44caf90b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f31a8b75f9508e32dfeffffa991e8ef74389454acabe7b0bca5f1bc9117d33dc310c089b16cef778b909461d24cc44eefd1fb67ad82c1fbc294f9507b2a47697
|
7
|
+
data.tar.gz: f5e1ccdc99e2be0ac021c0cc40202b3e6fbf30641328abae2b6879c95c63c72d06ba6f087eaba7fe7a1ef06d999ae166e31fc070cc80582fdd4b0aec9a476f15
|
data/docs/orchestration.md
CHANGED
@@ -116,6 +116,29 @@ It can be also obtained through the details method of a simple stack object
|
|
116
116
|
stack.details
|
117
117
|
```
|
118
118
|
|
119
|
+
To update a stack while manipulating a Stack object from the Stack Collection:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
heat_template = { "template": { "description": "Updated description" } }
|
123
|
+
stack.save(heat_template)
|
124
|
+
```
|
125
|
+
|
126
|
+
`save` uses the `update_stack` request method, although it expects a Stack object as well:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
heat_template = { "template": { "description": "Updated description" } }
|
130
|
+
service.update_stack(stack, heat_template)
|
131
|
+
```
|
132
|
+
|
133
|
+
Alternatively a request only approach can be used, providing a stack id and name:
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
id = "49b83314-d341-468a-aef4-44bbccce251e"
|
137
|
+
name = "stack_name"
|
138
|
+
heat_template = { "template": { "description": "Other update description" } }
|
139
|
+
service.update_stack(id, name, heat_template)
|
140
|
+
```
|
141
|
+
|
119
142
|
A stack knows about related `events`:
|
120
143
|
|
121
144
|
```ruby
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'fog/openstack'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
auth_url = "http://10.0.0.101:5000/v2.0/tokens"
|
5
|
+
username = 'admin'
|
6
|
+
password = 'D78JVyRnzJG8j7Mb6fgpeUMp7'
|
7
|
+
|
8
|
+
@connection_params = {
|
9
|
+
:openstack_auth_url => auth_url,
|
10
|
+
:openstack_username => username,
|
11
|
+
:openstack_api_key => password,
|
12
|
+
}
|
13
|
+
|
14
|
+
puts "### SERVICE CONNECTION ###"
|
15
|
+
|
16
|
+
event_service = Fog::Event::OpenStack.new(@connection_params)
|
17
|
+
|
18
|
+
p event_service
|
19
|
+
|
20
|
+
puts "### LIST EVENTS ###"
|
21
|
+
|
22
|
+
p event_service.events.all
|
data/gemfiles/Gemfile-1.9
CHANGED
@@ -54,6 +54,8 @@ module Fog
|
|
54
54
|
collection :hosts
|
55
55
|
model :server_group
|
56
56
|
collection :server_groups
|
57
|
+
model :os_interface
|
58
|
+
collection :os_interfaces
|
57
59
|
|
58
60
|
## REQUESTS
|
59
61
|
#
|
@@ -147,6 +149,10 @@ module Fog
|
|
147
149
|
|
148
150
|
# Hypervisor
|
149
151
|
request :get_hypervisor_statistics
|
152
|
+
request :get_hypervisor
|
153
|
+
request :list_hypervisors
|
154
|
+
request :list_hypervisors_detail
|
155
|
+
request :list_hypervisor_servers
|
150
156
|
|
151
157
|
# Metadata
|
152
158
|
request :list_metadata
|
@@ -233,6 +239,12 @@ module Fog
|
|
233
239
|
request :create_server_group
|
234
240
|
request :delete_server_group
|
235
241
|
|
242
|
+
# Server Os Interfaces
|
243
|
+
request :list_os_interfaces
|
244
|
+
request :get_os_interface
|
245
|
+
request :create_os_interface
|
246
|
+
request :delete_os_interface
|
247
|
+
|
236
248
|
class Mock
|
237
249
|
attr_reader :auth_token
|
238
250
|
attr_reader :auth_token_expiration
|
@@ -310,8 +322,22 @@ module Fog
|
|
310
322
|
'ram' => 51200
|
311
323
|
},
|
312
324
|
:volumes => {},
|
313
|
-
:snapshots => {}
|
314
|
-
|
325
|
+
:snapshots => {},
|
326
|
+
:os_interfaces => [
|
327
|
+
{
|
328
|
+
"fixed_ips" => [
|
329
|
+
{
|
330
|
+
"ip_address" => "192.168.1.3",
|
331
|
+
"subnet_id" => "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
|
332
|
+
}
|
333
|
+
],
|
334
|
+
"mac_addr" => "fa:16:3e:4c:2c:30",
|
335
|
+
"net_id" => "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
|
336
|
+
"port_id" => "ce531f90-199f-48c0-816c-13e38010b442",
|
337
|
+
"port_state" => "ACTIVE"
|
338
|
+
}
|
339
|
+
]
|
340
|
+
}
|
315
341
|
end
|
316
342
|
end
|
317
343
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fog/openstack/models/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class OpenStack
|
6
|
+
class OsInterface < Fog::OpenStack::Model
|
7
|
+
identity :port_id
|
8
|
+
attribute :fixed_ips, :type => :array
|
9
|
+
attribute :mac_addr
|
10
|
+
attribute :net_id
|
11
|
+
attribute :port_state
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fog/openstack/models/collection'
|
2
|
+
require 'fog/compute/openstack/models/os_interface'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class OpenStack
|
7
|
+
class OsInterfaces < Fog::OpenStack::Collection
|
8
|
+
model Fog::Compute::OpenStack::OsInterface
|
9
|
+
|
10
|
+
attribute :server
|
11
|
+
|
12
|
+
def all
|
13
|
+
requires :server
|
14
|
+
|
15
|
+
data = service.list_os_interfaces(server.id)
|
16
|
+
load_response(data, 'interfaceAttachments')
|
17
|
+
end
|
18
|
+
|
19
|
+
def get(port_id)
|
20
|
+
requires :server
|
21
|
+
|
22
|
+
data = service.get_os_interface(server.id,port_id)
|
23
|
+
load_response(data, 'interfaceAttachment')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -108,6 +108,11 @@ module Fog
|
|
108
108
|
@all_addresses ||= service.list_all_addresses.body["floating_ips"].select { |data| data['instance_id'] == id }
|
109
109
|
end
|
110
110
|
|
111
|
+
def os_interfaces
|
112
|
+
requires :id
|
113
|
+
service.os_interfaces(:server => self)
|
114
|
+
end
|
115
|
+
|
111
116
|
def reload
|
112
117
|
@all_addresses = nil
|
113
118
|
super
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
# === Parameters
|
6
|
+
# * server_id <~String>
|
7
|
+
# * options <~Hash>
|
8
|
+
def create_os_interface(server_id, options={})
|
9
|
+
body = {
|
10
|
+
'interfaceAttachment' => {}
|
11
|
+
}
|
12
|
+
|
13
|
+
if options[:port_id]
|
14
|
+
body['interfaceAttachment']['port_id'] = options[:port_id]
|
15
|
+
elsif options[:net_id]
|
16
|
+
body['interfaceAttachment']['net_id'] = options[:net_id]
|
17
|
+
end
|
18
|
+
|
19
|
+
if options[:ip_address]
|
20
|
+
body['interfaceAttachment']['fixed_ips'] = {ip_address: options[:ip_address]}
|
21
|
+
end
|
22
|
+
|
23
|
+
request(
|
24
|
+
:body => Fog::JSON.encode(body),
|
25
|
+
:expects => [200, 201, 202, 204],
|
26
|
+
:method => 'POST',
|
27
|
+
:path => "servers/#{server_id}/os-interface"
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
def create_os_interface(server_id, options={})
|
34
|
+
Excon::Response.new(
|
35
|
+
:body => {'interfaceAttachment' => data[:os_interfaces].first},
|
36
|
+
:status => 200
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
# === Parameters
|
6
|
+
# * server_id <~String>
|
7
|
+
# * port_id <~String>
|
8
|
+
def delete_os_interface(server_id, port_id)
|
9
|
+
request(
|
10
|
+
:expects => [200, 202,204],
|
11
|
+
:method => 'DELETE',
|
12
|
+
:path => "servers/#{server_id}/os-interface/#{port_id}"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Mock
|
18
|
+
def delete_os_interface(server_id, port_id)
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def get_hypervisor(hypervisor_id)
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "os-hypervisors/#{hypervisor_id}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def get_hypervisor(hypervisor_id)
|
16
|
+
response = Excon::Response.new
|
17
|
+
response.status = 200
|
18
|
+
response.body = {
|
19
|
+
"hypervisor" => {
|
20
|
+
"cpu_info" => {
|
21
|
+
"arch" => "x86_64",
|
22
|
+
"model" => "Nehalem",
|
23
|
+
"vendor" => "Intel",
|
24
|
+
"features" => [
|
25
|
+
"pge",
|
26
|
+
"clflush"
|
27
|
+
],
|
28
|
+
"topology" => {
|
29
|
+
"cores" => 1,
|
30
|
+
"threads" => 1,
|
31
|
+
"sockets" => 4
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"current_workload" => 0,
|
35
|
+
"status" => "enabled",
|
36
|
+
"state" => "up",
|
37
|
+
"disk_available_least" => 0,
|
38
|
+
"host_ip" => "1.1.1.1",
|
39
|
+
"free_disk_gb" => 1028,
|
40
|
+
"free_ram_mb" => 7680,
|
41
|
+
"hypervisor_hostname" => "fake-mini",
|
42
|
+
"hypervisor_type" => "fake",
|
43
|
+
"hypervisor_version" => 1000,
|
44
|
+
"id" => hypervisor_id,
|
45
|
+
"local_gb" => 1028,
|
46
|
+
"local_gb_used" => 0,
|
47
|
+
"memory_mb" => 8192,
|
48
|
+
"memory_mb_used" => 512,
|
49
|
+
"running_vms" => 0,
|
50
|
+
"service" => {
|
51
|
+
"host" => "host1",
|
52
|
+
"id" => 7,
|
53
|
+
"disabled_reason" => null
|
54
|
+
},
|
55
|
+
"vcpus" => 1,
|
56
|
+
"vcpus_used" => 0
|
57
|
+
}
|
58
|
+
}
|
59
|
+
response
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def get_os_interface(server_id,port_id)
|
6
|
+
request(
|
7
|
+
:expects => [200, 202, 203],
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "servers/#{server_id}/os-interface/#{port_id}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def get_os_interface(server_id,port_id)
|
16
|
+
Excon::Response.new(
|
17
|
+
:body => {'interfaceAttachment' => data[:os_interfaces].first},
|
18
|
+
:status => 200
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def list_hypervisor_servers(hypervisor_id, options = {})
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "os-hypervisors/#{hypervisor_id}/servers",
|
10
|
+
:query => options
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def list_hypervisor_servers(hypervisor_id, _options = {})
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 200
|
19
|
+
response.body = {'hypervisors' => [
|
20
|
+
{
|
21
|
+
"hypervisor_hostname" => "fake-mini",
|
22
|
+
"id" => hypervisor_id,
|
23
|
+
"state" => "up",
|
24
|
+
"status" => "enabled",
|
25
|
+
"servers" => [
|
26
|
+
{
|
27
|
+
"name" => "test_server1",
|
28
|
+
"uuid" => "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"name" => "test_server2",
|
32
|
+
"uuid" => "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
]}
|
37
|
+
response
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def list_hypervisors(options = {})
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:path => 'os-hypervisors',
|
10
|
+
:query => options
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def list_hypervisors(_options = {})
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 200
|
19
|
+
response.body = {'hypervisors' => [
|
20
|
+
{"hypervisor_hostname" => "fake-mini", "id" => 2, "state" => "up", "status" => "enabled"}
|
21
|
+
]}
|
22
|
+
response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def list_hypervisors_detail(options = {})
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:path => 'os-hypervisors/detail',
|
10
|
+
:query => options
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def list_hypervisors_detail(_options = {})
|
17
|
+
response = Excon::Response.new
|
18
|
+
response.status = 200
|
19
|
+
response.body = {
|
20
|
+
"hypervisors" => [{
|
21
|
+
"cpu_info" => {
|
22
|
+
"arch" => "x86_64",
|
23
|
+
"model" => "Nehalem",
|
24
|
+
"vendor" => "Intel",
|
25
|
+
"features" => [
|
26
|
+
"pge",
|
27
|
+
"clflush"
|
28
|
+
],
|
29
|
+
"topology" => {
|
30
|
+
"cores" => 1,
|
31
|
+
"threads" => 1,
|
32
|
+
"sockets" => 4
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"current_workload" => 0,
|
36
|
+
"status" => "enabled",
|
37
|
+
"state" => "up",
|
38
|
+
"disk_available_least" => 0,
|
39
|
+
"host_ip" => "1.1.1.1",
|
40
|
+
"free_disk_gb" => 1028,
|
41
|
+
"free_ram_mb" => 7680,
|
42
|
+
"hypervisor_hostname" => "fake-mini",
|
43
|
+
"hypervisor_type" => "fake",
|
44
|
+
"hypervisor_version" => 1000,
|
45
|
+
"id" => 2,
|
46
|
+
"local_gb" => 1028,
|
47
|
+
"local_gb_used" => 0,
|
48
|
+
"memory_mb" => 8192,
|
49
|
+
"memory_mb_used" => 512,
|
50
|
+
"running_vms" => 0,
|
51
|
+
"service" => {
|
52
|
+
"host" => "host1",
|
53
|
+
"id" => 7,
|
54
|
+
"disabled_reason" => null
|
55
|
+
},
|
56
|
+
"vcpus" => 1,
|
57
|
+
"vcpus_used" => 0
|
58
|
+
}],
|
59
|
+
"hypervisors_links" => [
|
60
|
+
{
|
61
|
+
"href" => "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/hypervisors/detail?limit=1&marker=2",
|
62
|
+
"rel" => "next"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
response
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|