bosh_openstack_cpi 0.0.7 → 1.5.0.pre.1113
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -5
- data/USAGE.md +55 -27
- data/bin/bosh_openstack_console +2 -10
- data/lib/bosh_openstack_cpi.rb +1 -0
- data/lib/cloud/openstack.rb +7 -2
- data/lib/cloud/openstack/cloud.rb +345 -261
- data/lib/cloud/openstack/dynamic_network.rb +1 -0
- data/lib/cloud/openstack/helpers.rb +77 -19
- data/lib/cloud/openstack/manual_network.rb +35 -0
- data/lib/cloud/openstack/network.rb +1 -0
- data/lib/cloud/openstack/network_configurator.rb +76 -37
- data/lib/cloud/openstack/tag_manager.rb +17 -0
- data/lib/cloud/openstack/version.rb +2 -1
- data/lib/cloud/openstack/vip_network.rb +15 -12
- metadata +40 -75
- data/Rakefile +0 -62
- data/bosh_cpi.md +0 -82
- data/lib/cloud/openstack/registry_client.rb +0 -127
- data/spec/assets/sample_config.yml +0 -14
- data/spec/integration/cpi_test.rb +0 -119
- data/spec/spec_helper.rb +0 -146
- data/spec/unit/attach_disk_spec.rb +0 -111
- data/spec/unit/cloud_spec.rb +0 -31
- data/spec/unit/configure_networks_spec.rb +0 -106
- data/spec/unit/create_disk_spec.rb +0 -82
- data/spec/unit/create_stemcell_spec.rb +0 -315
- data/spec/unit/create_vm_spec.rb +0 -252
- data/spec/unit/delete_disk_spec.rb +0 -37
- data/spec/unit/delete_stemcell_spec.rb +0 -80
- data/spec/unit/delete_vm_spec.rb +0 -25
- data/spec/unit/detach_disk_spec.rb +0 -78
- data/spec/unit/helpers_spec.rb +0 -74
- data/spec/unit/network_configurator_spec.rb +0 -57
- data/spec/unit/reboot_vm_spec.rb +0 -32
- data/spec/unit/set_vm_metadata_spec.rb +0 -34
- data/spec/unit/validate_deployment_spec.rb +0 -17
metadata
CHANGED
@@ -1,96 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_openstack_cpi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.5.0.pre.1113
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Piston Cloud Computing
|
8
|
+
- Piston Cloud Computing / VMware
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.14.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: 1.14.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bosh_common
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 1.5.0.pre.1113
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 1.5.0.pre.1113
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: bosh_cpi
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 1.5.0.pre.1113
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.5.0.pre.1113
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: bosh-registry
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 1.5.0.pre.1113
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 1.5.0.pre.1113
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: httpclient
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - '='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 2.
|
85
|
+
version: 2.2.4
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - '='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 2.
|
93
|
+
version: 2.2.4
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: yajl-ruby
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,8 +107,10 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 0.8.2
|
110
|
-
description: BOSH OpenStack CPI
|
111
|
-
|
110
|
+
description: ! 'BOSH OpenStack CPI
|
111
|
+
|
112
|
+
cfd471'
|
113
|
+
email: support@cloudfoundry.com
|
112
114
|
executables:
|
113
115
|
- bosh_openstack_console
|
114
116
|
extensions: []
|
@@ -120,35 +122,17 @@ files:
|
|
120
122
|
- lib/cloud/openstack/cloud.rb
|
121
123
|
- lib/cloud/openstack/dynamic_network.rb
|
122
124
|
- lib/cloud/openstack/helpers.rb
|
125
|
+
- lib/cloud/openstack/manual_network.rb
|
123
126
|
- lib/cloud/openstack/network.rb
|
124
127
|
- lib/cloud/openstack/network_configurator.rb
|
125
|
-
- lib/cloud/openstack/
|
128
|
+
- lib/cloud/openstack/tag_manager.rb
|
126
129
|
- lib/cloud/openstack/version.rb
|
127
130
|
- lib/cloud/openstack/vip_network.rb
|
128
131
|
- README.md
|
129
132
|
- USAGE.md
|
130
|
-
|
131
|
-
|
132
|
-
-
|
133
|
-
- spec/integration/cpi_test.rb
|
134
|
-
- spec/spec_helper.rb
|
135
|
-
- spec/unit/attach_disk_spec.rb
|
136
|
-
- spec/unit/cloud_spec.rb
|
137
|
-
- spec/unit/configure_networks_spec.rb
|
138
|
-
- spec/unit/create_disk_spec.rb
|
139
|
-
- spec/unit/create_stemcell_spec.rb
|
140
|
-
- spec/unit/create_vm_spec.rb
|
141
|
-
- spec/unit/delete_disk_spec.rb
|
142
|
-
- spec/unit/delete_stemcell_spec.rb
|
143
|
-
- spec/unit/delete_vm_spec.rb
|
144
|
-
- spec/unit/detach_disk_spec.rb
|
145
|
-
- spec/unit/helpers_spec.rb
|
146
|
-
- spec/unit/network_configurator_spec.rb
|
147
|
-
- spec/unit/reboot_vm_spec.rb
|
148
|
-
- spec/unit/set_vm_metadata_spec.rb
|
149
|
-
- spec/unit/validate_deployment_spec.rb
|
150
|
-
homepage: http://www.pistoncloud.com
|
151
|
-
licenses: []
|
133
|
+
homepage: https://github.com/cloudfoundry/bosh
|
134
|
+
licenses:
|
135
|
+
- Apache 2.0
|
152
136
|
post_install_message:
|
153
137
|
rdoc_options: []
|
154
138
|
require_paths:
|
@@ -158,36 +142,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
142
|
requirements:
|
159
143
|
- - ! '>='
|
160
144
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
145
|
+
version: 1.9.3
|
162
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
147
|
none: false
|
164
148
|
requirements:
|
165
|
-
- - ! '
|
149
|
+
- - ! '>'
|
166
150
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
151
|
+
version: 1.3.1
|
168
152
|
requirements: []
|
169
153
|
rubyforge_project:
|
170
|
-
rubygems_version: 1.8.
|
154
|
+
rubygems_version: 1.8.23
|
171
155
|
signing_key:
|
172
156
|
specification_version: 3
|
173
157
|
summary: BOSH OpenStack CPI
|
174
|
-
test_files:
|
175
|
-
- spec/assets/sample_config.yml
|
176
|
-
- spec/integration/cpi_test.rb
|
177
|
-
- spec/spec_helper.rb
|
178
|
-
- spec/unit/attach_disk_spec.rb
|
179
|
-
- spec/unit/cloud_spec.rb
|
180
|
-
- spec/unit/configure_networks_spec.rb
|
181
|
-
- spec/unit/create_disk_spec.rb
|
182
|
-
- spec/unit/create_stemcell_spec.rb
|
183
|
-
- spec/unit/create_vm_spec.rb
|
184
|
-
- spec/unit/delete_disk_spec.rb
|
185
|
-
- spec/unit/delete_stemcell_spec.rb
|
186
|
-
- spec/unit/delete_vm_spec.rb
|
187
|
-
- spec/unit/detach_disk_spec.rb
|
188
|
-
- spec/unit/helpers_spec.rb
|
189
|
-
- spec/unit/network_configurator_spec.rb
|
190
|
-
- spec/unit/reboot_vm_spec.rb
|
191
|
-
- spec/unit/set_vm_metadata_spec.rb
|
192
|
-
- spec/unit/validate_deployment_spec.rb
|
193
|
-
has_rdoc:
|
158
|
+
test_files: []
|
data/Rakefile
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# Copyright (c) 2012 Piston Cloud Computing, Inc.
|
2
|
-
|
3
|
-
$:.unshift(File.expand_path("../../rake", __FILE__))
|
4
|
-
|
5
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __FILE__)
|
6
|
-
|
7
|
-
require "rubygems"
|
8
|
-
require "bundler"
|
9
|
-
Bundler.setup(:default, :test)
|
10
|
-
|
11
|
-
require "rake"
|
12
|
-
begin
|
13
|
-
require "rspec/core/rake_task"
|
14
|
-
rescue LoadError
|
15
|
-
end
|
16
|
-
|
17
|
-
begin
|
18
|
-
require "bundler_task"
|
19
|
-
rescue LoadError
|
20
|
-
end
|
21
|
-
|
22
|
-
begin
|
23
|
-
require "ci_task"
|
24
|
-
rescue LoadError
|
25
|
-
end
|
26
|
-
|
27
|
-
gem_helper = Bundler::GemHelper.new(Dir.pwd)
|
28
|
-
|
29
|
-
desc "Build CPI gem into the pkg directory"
|
30
|
-
task "build" do
|
31
|
-
gem_helper.build_gem
|
32
|
-
end
|
33
|
-
|
34
|
-
if defined?(BundlerTask)
|
35
|
-
BundlerTask.new
|
36
|
-
|
37
|
-
desc "Build and install CPI into system gems"
|
38
|
-
task "install" do
|
39
|
-
Rake::Task["bundler:install"].invoke
|
40
|
-
gem_helper.install_gem
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
if defined?(RSpec)
|
45
|
-
namespace :spec do
|
46
|
-
desc "Run Unit Tests"
|
47
|
-
rspec_task = RSpec::Core::RakeTask.new(:unit) do |t|
|
48
|
-
t.pattern = "spec/unit/**/*_spec.rb"
|
49
|
-
t.rspec_opts = %w(--format progress --colour)
|
50
|
-
end
|
51
|
-
|
52
|
-
if defined?(CiTask)
|
53
|
-
CiTask.new do |task|
|
54
|
-
task.rspec_task = rspec_task
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
desc "Run tests"
|
60
|
-
task :spec => %w(spec:unit)
|
61
|
-
task :default => :spec
|
62
|
-
end
|
data/bosh_cpi.md
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
#OpenStack CPI Implementation #
|
2
|
-
OpenStack CPI is an implementation of BOSH CPI. It allows BOSH to interface with various services in OpenStack like glance, controller and registry. In the sections below we outline the implementation details for each of the method in CPI interface.
|
3
|
-
|
4
|
-
##Initialize ##
|
5
|
-
|
6
|
-
Implementation of `def initialize(options)` method.
|
7
|
-
|
8
|
-
1. Validate the `options` passed to this method
|
9
|
-
2. In the second step the parameters are extracted from `options` object to populate the following properties
|
10
|
-
+ `@agent_properties`
|
11
|
-
+ `@openstack_properties`
|
12
|
-
+ `@registry_propertiess`
|
13
|
-
3. Populate the `openstack_params` and connect to remove Nova Service
|
14
|
-
1. Instantiate `Fog::Compute` instance
|
15
|
-
2. `Fog::Compute::OpenStack` instance is created
|
16
|
-
3. A New `Fog::Connection` object connects with the remove Nova Compute Service
|
17
|
-
4. Populate the `glance_params`and connect to remove Glance service
|
18
|
-
1. Instantiate `Fog::Image` instance
|
19
|
-
2. `Fog::Image::OpenStack` instance is created
|
20
|
-
3. A New `Fog::Connection` object connects with the remove Glance Service
|
21
|
-
5. Instantiate `Registry_Client`.
|
22
|
-
|
23
|
-
Figure below shows the flow of control.
|
24
|
-
|
25
|
-
![openstack_cpi_initialize](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_initialize.png)
|
26
|
-
|
27
|
-
##Create Stemcell ##
|
28
|
-
|
29
|
-
Implementation of method `create_stemcell(image_path, cloud_properties)`
|
30
|
-
Steps outlined below are the flow control implemented to extract and upload kernel image, ramdisk and stem cell image.
|
31
|
-
|
32
|
-
1. Extract parameters from the `cloud_properties`. Check if `kernel_file` parameter exists, instantiate `kernel_image` object
|
33
|
-
2. Construct `kernel_params`
|
34
|
-
3. Upload `kernel_image` to glance service by calling the method `upload_image(kernel_params)`
|
35
|
-
4. If params contain `ramdisk_file`
|
36
|
-
5. Instantiate ramdisk_image object and populate `ramdisk_parama`
|
37
|
-
6. Upload the `ramdisk_image` to glance service by calling `upload(ramdisk_params)`
|
38
|
-
7. Populate `image_params` for the stem cell to be uploaded to glance service
|
39
|
-
8. Call the method `upload_image(image_params)`
|
40
|
-
|
41
|
-
Figure below shows the flow control for the method `create_stemcell(image_path, cloud_properties)`
|
42
|
-
|
43
|
-
![openstack_cpi_createstemcell](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_createstemcell.png)
|
44
|
-
|
45
|
-
##Delete Stemcell
|
46
|
-
|
47
|
-
![openstack_cpi_deletestemcell](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_deletestemcell.png)
|
48
|
-
|
49
|
-
##Create VM ##
|
50
|
-
|
51
|
-
![openstack_cpi_create_vm](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_create_vm.png)
|
52
|
-
|
53
|
-
##Delete VM ##
|
54
|
-
|
55
|
-
Implementation of `delete_vm(server_id)`. This method deletes the VM created in Nova Compute.
|
56
|
-
|
57
|
-
1. Get the `server_id` of the VM to be deleted
|
58
|
-
* 1.1, 1.2 : Send the request `get_server_details` to Compute API Server through `Fog::Connection`
|
59
|
-
2. If `server` object returned is not null call `server.destroy`. This will send `delete_server` request to Nova Compute.
|
60
|
-
* 2.1, 2.2 : Create and send the `delete_server` request through `Fog::Connection`
|
61
|
-
3. Delete the settings from Registry by calling `delete_settings` method.
|
62
|
-
|
63
|
-
Figure below shows the flow control for `delete_vm` method
|
64
|
-
|
65
|
-
![openstack_cpi_delete_vm](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_delete_vm.png)
|
66
|
-
|
67
|
-
##Create Disk ##
|
68
|
-
|
69
|
-
1. Check if size passed is integer, is greater than 1024 and less than 1024*1000, else throw an error
|
70
|
-
2. Create `volume_params`
|
71
|
-
3. Call `create()volume_params)` on `Fog::Compute` service
|
72
|
-
1. `create_volume` request on `Fog::Volume::OpenStack`
|
73
|
-
2. Opens a `Fog::Connection` request to access the remote service and create a volume.
|
74
|
-
|
75
|
-
Figure below shows the flow control of `create_disk` method
|
76
|
-
|
77
|
-
![openstack_cpi_create_disk](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_create_disk.png)
|
78
|
-
|
79
|
-
##Delete Disk##
|
80
|
-
|
81
|
-
This method deletes the volume created in OpenStack Nova Volume
|
82
|
-
![openstack_cpi_delete_disk](https://raw.github.com/piston/openstack-bosh-cpi/master/images/openstack_cpi_delete_disk.png)
|
@@ -1,127 +0,0 @@
|
|
1
|
-
# Copyright (c) 2012 Piston Cloud Computing, Inc.
|
2
|
-
|
3
|
-
module Bosh::OpenStackCloud
|
4
|
-
##
|
5
|
-
# Represents OpenStack Registry Client. It performs CRUD operations against
|
6
|
-
# the OpenStack Registry.
|
7
|
-
#
|
8
|
-
# Settings example:
|
9
|
-
# settings = {
|
10
|
-
# "vm" => {
|
11
|
-
# "name" => server_name
|
12
|
-
# },
|
13
|
-
# "agent_id" => agent_id,
|
14
|
-
# "networks" => network_spec,
|
15
|
-
# "disks" => {
|
16
|
-
# "system" => "/dev/vda",
|
17
|
-
# "ephemeral" => "/dev/vdb",
|
18
|
-
# "persistent" => {"volume_id" => device_name}
|
19
|
-
# }
|
20
|
-
# }
|
21
|
-
class RegistryClient
|
22
|
-
include Helpers
|
23
|
-
|
24
|
-
attr_reader :endpoint
|
25
|
-
attr_reader :user
|
26
|
-
attr_reader :password
|
27
|
-
|
28
|
-
##
|
29
|
-
# Creates a new Registry client
|
30
|
-
#
|
31
|
-
# @param [String] endpoint Registry endpoint URL
|
32
|
-
# @param [String] user Registry user
|
33
|
-
# @param [String] password Registry password
|
34
|
-
def initialize(endpoint, user, password)
|
35
|
-
@endpoint = endpoint
|
36
|
-
|
37
|
-
unless @endpoint =~ /^http:\/\//
|
38
|
-
@endpoint = "http://#{@endpoint}"
|
39
|
-
end
|
40
|
-
|
41
|
-
@user = user
|
42
|
-
@password = password
|
43
|
-
auth = Base64.encode64("#{@user}:#{@password}").gsub("\n", "")
|
44
|
-
|
45
|
-
@headers = {
|
46
|
-
"Accept" => "application/json",
|
47
|
-
"Authorization" => "Basic #{auth}"
|
48
|
-
}
|
49
|
-
|
50
|
-
@client = HTTPClient.new
|
51
|
-
end
|
52
|
-
|
53
|
-
##
|
54
|
-
# Update server settings in the registry
|
55
|
-
#
|
56
|
-
# @param [String] server_id OpenStack server id
|
57
|
-
# @param [Hash] settings New agent settings
|
58
|
-
# @return [Boolean]
|
59
|
-
def update_settings(server_id, settings)
|
60
|
-
unless settings.is_a?(Hash)
|
61
|
-
raise ArgumentError, "Invalid settings format, " \
|
62
|
-
"Hash expected, #{settings.class} given"
|
63
|
-
end
|
64
|
-
|
65
|
-
payload = Yajl::Encoder.encode(settings)
|
66
|
-
url = "#{@endpoint}/servers/#{server_id}/settings"
|
67
|
-
|
68
|
-
response = @client.put(url, {:body => payload, :header => @headers})
|
69
|
-
if response.status != 200
|
70
|
-
cloud_error("Cannot update settings for `#{server_id}', " \
|
71
|
-
"got HTTP #{response.status}")
|
72
|
-
end
|
73
|
-
|
74
|
-
true
|
75
|
-
end
|
76
|
-
|
77
|
-
##
|
78
|
-
# Read server settings from the registry
|
79
|
-
#
|
80
|
-
# @param [String] server_id OpenStack server id
|
81
|
-
# @return [Hash] Agent settings
|
82
|
-
def read_settings(server_id)
|
83
|
-
url = "#{@endpoint}/servers/#{server_id}/settings"
|
84
|
-
|
85
|
-
response = @client.get(url, {:header => @headers})
|
86
|
-
if response.status != 200
|
87
|
-
cloud_error("Cannot read settings for `#{server_id}', " \
|
88
|
-
"got HTTP #{response.status}")
|
89
|
-
end
|
90
|
-
|
91
|
-
body = Yajl::Parser.parse(response.body)
|
92
|
-
unless body.is_a?(Hash)
|
93
|
-
cloud_error("Invalid registry response, Hash expected, " \
|
94
|
-
"got #{body.class}: #{body}")
|
95
|
-
end
|
96
|
-
|
97
|
-
settings = Yajl::Parser.parse(body["settings"])
|
98
|
-
unless settings.is_a?(Hash)
|
99
|
-
cloud_error("Invalid settings format, " \
|
100
|
-
"Hash expected, got #{settings.class}: " \
|
101
|
-
"#{settings}")
|
102
|
-
end
|
103
|
-
|
104
|
-
settings
|
105
|
-
rescue Yajl::ParseError
|
106
|
-
cloud_error("Cannot parse settings for `#{server_id}'")
|
107
|
-
end
|
108
|
-
|
109
|
-
##
|
110
|
-
# Delete server settings from the registry
|
111
|
-
#
|
112
|
-
# @param [String] server_id OpenStack server id
|
113
|
-
# @return [Boolean]
|
114
|
-
def delete_settings(server_id)
|
115
|
-
url = "#{@endpoint}/servers/#{server_id}/settings"
|
116
|
-
|
117
|
-
response = @client.delete(url, {:header => @headers})
|
118
|
-
if response.status != 200
|
119
|
-
cloud_error("Cannot delete settings for `#{server_id}', " \
|
120
|
-
"got HTTP #{response.status}")
|
121
|
-
end
|
122
|
-
|
123
|
-
true
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
end
|