bosh_cpi 0.5.1 → 1.1868.0
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.
- data/lib/bosh/cpi/tasks/spec.rake +10 -0
- data/lib/bosh/cpi/tasks.rb +1 -0
- data/lib/cloud/config.rb +2 -0
- data/lib/cloud/errors.rb +1 -0
- data/lib/cloud/provider.rb +3 -2
- data/lib/cloud/version.rb +1 -1
- data/lib/cloud.rb +49 -8
- metadata +17 -24
- data/Rakefile +0 -50
- data/spec/lib/cloud/spec.rb +0 -9
- data/spec/spec_helper.rb +0 -30
- data/spec/unit/config_spec.rb +0 -19
- data/spec/unit/provider_spec.rb +0 -19
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require 'rspec/core/rake_task'
|
|
3
|
+
|
|
4
|
+
namespace :spec do
|
|
5
|
+
desc 'Run VM lifecycle specs'
|
|
6
|
+
RSpec::Core::RakeTask.new(:lifecycle) do |t|
|
|
7
|
+
t.pattern = 'spec/integration/lifecycle_spec.rb'
|
|
8
|
+
t.rspec_opts = %w(--format documentation --color)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Dir.glob(File.expand_path('tasks/**/*.rake', File.dirname(__FILE__))).each { |r| import r }
|
data/lib/cloud/config.rb
CHANGED
data/lib/cloud/errors.rb
CHANGED
data/lib/cloud/provider.rb
CHANGED
|
@@ -4,9 +4,10 @@ module Bosh::Clouds
|
|
|
4
4
|
def self.create(plugin, options)
|
|
5
5
|
begin
|
|
6
6
|
require "cloud/#{plugin}"
|
|
7
|
-
rescue LoadError
|
|
8
|
-
raise CloudError, "Could not
|
|
7
|
+
rescue LoadError => error
|
|
8
|
+
raise CloudError, "Could not load Cloud Provider Plugin: #{plugin}"
|
|
9
9
|
end
|
|
10
|
+
|
|
10
11
|
Bosh::Clouds.const_get(plugin.capitalize).new(options)
|
|
11
12
|
end
|
|
12
13
|
|
data/lib/cloud/version.rb
CHANGED
data/lib/cloud.rb
CHANGED
|
@@ -27,6 +27,14 @@ module Bosh
|
|
|
27
27
|
def initialize(options)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
##
|
|
31
|
+
# Get the vm_id of this host
|
|
32
|
+
#
|
|
33
|
+
# @return [String] opaque id later used by other methods of the CPI
|
|
34
|
+
def current_vm_id
|
|
35
|
+
not_implemented(:current_vm_id)
|
|
36
|
+
end
|
|
37
|
+
|
|
30
38
|
##
|
|
31
39
|
# Creates a stemcell
|
|
32
40
|
#
|
|
@@ -42,7 +50,7 @@ module Bosh
|
|
|
42
50
|
# Deletes a stemcell
|
|
43
51
|
#
|
|
44
52
|
# @param [String] stemcell stemcell id that was once returned by {#create_stemcell}
|
|
45
|
-
# @return
|
|
53
|
+
# @return [void]
|
|
46
54
|
def delete_stemcell(stemcell_id)
|
|
47
55
|
not_implemented(:delete_stemcell)
|
|
48
56
|
end
|
|
@@ -92,17 +100,26 @@ module Bosh
|
|
|
92
100
|
# Deletes a VM
|
|
93
101
|
#
|
|
94
102
|
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
95
|
-
# @return
|
|
103
|
+
# @return [void]
|
|
96
104
|
def delete_vm(vm_id)
|
|
97
105
|
not_implemented(:delete_vm)
|
|
98
106
|
end
|
|
99
107
|
|
|
108
|
+
##
|
|
109
|
+
# Checks if a VM exists
|
|
110
|
+
#
|
|
111
|
+
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
112
|
+
# @return [Boolean] True if the vm exists
|
|
113
|
+
def has_vm?(vm_id)
|
|
114
|
+
not_implemented(:has_vm?)
|
|
115
|
+
end
|
|
116
|
+
|
|
100
117
|
##
|
|
101
118
|
# Reboots a VM
|
|
102
119
|
#
|
|
103
120
|
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
104
121
|
# @param [Optional, Hash] CPI specific options (e.g hard/soft reboot)
|
|
105
|
-
# @return
|
|
122
|
+
# @return [void]
|
|
106
123
|
def reboot_vm(vm_id)
|
|
107
124
|
not_implemented(:reboot_vm)
|
|
108
125
|
end
|
|
@@ -114,7 +131,7 @@ module Bosh
|
|
|
114
131
|
#
|
|
115
132
|
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
116
133
|
# @param [Hash] metadata metadata key/value pairs
|
|
117
|
-
# @return
|
|
134
|
+
# @return [void]
|
|
118
135
|
def set_vm_metadata(vm, metadata)
|
|
119
136
|
not_implemented(:set_vm_metadata)
|
|
120
137
|
end
|
|
@@ -125,7 +142,7 @@ module Bosh
|
|
|
125
142
|
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
126
143
|
# @param [Hash] networks list of networks and their settings needed for this VM,
|
|
127
144
|
# same as the networks argument in {#create_vm}
|
|
128
|
-
# @return
|
|
145
|
+
# @return [void]
|
|
129
146
|
def configure_networks(vm_id, networks)
|
|
130
147
|
not_implemented(:configure_networks)
|
|
131
148
|
end
|
|
@@ -148,7 +165,7 @@ module Bosh
|
|
|
148
165
|
# Will raise an exception if the disk is attached to a VM
|
|
149
166
|
#
|
|
150
167
|
# @param [String] disk disk id that was once returned by {#create_disk}
|
|
151
|
-
# @return
|
|
168
|
+
# @return [void]
|
|
152
169
|
def delete_disk(disk_id)
|
|
153
170
|
not_implemented(:delete_disk)
|
|
154
171
|
end
|
|
@@ -158,21 +175,45 @@ module Bosh
|
|
|
158
175
|
#
|
|
159
176
|
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
160
177
|
# @param [String] disk disk id that was once returned by {#create_disk}
|
|
161
|
-
# @return
|
|
178
|
+
# @return [void]
|
|
162
179
|
def attach_disk(vm_id, disk_id)
|
|
163
180
|
not_implemented(:attach_disk)
|
|
164
181
|
end
|
|
165
182
|
|
|
183
|
+
# Take snapshot of disk
|
|
184
|
+
# @param [String] disk_id disk id of the disk to take the snapshot of
|
|
185
|
+
# @return [String] snapshot id
|
|
186
|
+
def snapshot_disk(disk_id, metadata={})
|
|
187
|
+
not_implemented(:snapshot_disk)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Delete a disk snapshot
|
|
191
|
+
# @param [String] snapshot_id snapshot id to delete
|
|
192
|
+
def delete_snapshot(snapshot_id)
|
|
193
|
+
not_implemented(:delete_snapshot)
|
|
194
|
+
end
|
|
195
|
+
|
|
166
196
|
##
|
|
167
197
|
# Detaches a disk
|
|
168
198
|
#
|
|
169
199
|
# @param [String] vm vm id that was once returned by {#create_vm}
|
|
170
200
|
# @param [String] disk disk id that was once returned by {#create_disk}
|
|
171
|
-
# @return
|
|
201
|
+
# @return [void]
|
|
172
202
|
def detach_disk(vm_id, disk_id)
|
|
173
203
|
not_implemented(:detach_disk)
|
|
174
204
|
end
|
|
175
205
|
|
|
206
|
+
##
|
|
207
|
+
# List the attached disks of the VM.
|
|
208
|
+
#
|
|
209
|
+
# @param [String] vm_id is the CPI-standard vm_id (eg, returned from current_vm_id)
|
|
210
|
+
#
|
|
211
|
+
# @return [array[String]] list of opaque disk_ids that can be used with the
|
|
212
|
+
# other disk-related methods on the CPI
|
|
213
|
+
def get_disks(vm_id)
|
|
214
|
+
not_implemented(:get_disks)
|
|
215
|
+
end
|
|
216
|
+
|
|
176
217
|
##
|
|
177
218
|
# Validates the deployment
|
|
178
219
|
# @api not_yet_used
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bosh_cpi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1868.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bosh_common
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
21
|
+
version: 1.1868.0
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -26,26 +26,26 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ~>
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
30
|
-
description: BOSH CPI
|
|
31
|
-
|
|
29
|
+
version: 1.1868.0
|
|
30
|
+
description: ! 'BOSH CPI
|
|
31
|
+
|
|
32
|
+
f69423'
|
|
33
|
+
email: support@cloudfoundry.com
|
|
32
34
|
executables: []
|
|
33
35
|
extensions: []
|
|
34
36
|
extra_rdoc_files: []
|
|
35
37
|
files:
|
|
38
|
+
- lib/bosh/cpi/tasks.rb
|
|
39
|
+
- lib/bosh/cpi/tasks/spec.rake
|
|
36
40
|
- lib/cloud.rb
|
|
37
41
|
- lib/cloud/config.rb
|
|
38
42
|
- lib/cloud/errors.rb
|
|
39
43
|
- lib/cloud/provider.rb
|
|
40
44
|
- lib/cloud/version.rb
|
|
41
45
|
- README
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
- spec/unit/config_spec.rb
|
|
46
|
-
- spec/unit/provider_spec.rb
|
|
47
|
-
homepage: http://www.vmware.com
|
|
48
|
-
licenses: []
|
|
46
|
+
homepage: https://github.com/cloudfoundry/bosh
|
|
47
|
+
licenses:
|
|
48
|
+
- Apache 2.0
|
|
49
49
|
post_install_message:
|
|
50
50
|
rdoc_options: []
|
|
51
51
|
require_paths:
|
|
@@ -55,10 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
55
55
|
requirements:
|
|
56
56
|
- - ! '>='
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
version:
|
|
59
|
-
segments:
|
|
60
|
-
- 0
|
|
61
|
-
hash: 899826630051890030
|
|
58
|
+
version: 1.9.3
|
|
62
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
60
|
none: false
|
|
64
61
|
requirements:
|
|
@@ -67,15 +64,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
67
64
|
version: '0'
|
|
68
65
|
segments:
|
|
69
66
|
- 0
|
|
70
|
-
hash:
|
|
67
|
+
hash: -918673474998975466
|
|
71
68
|
requirements: []
|
|
72
69
|
rubyforge_project:
|
|
73
|
-
rubygems_version: 1.8.
|
|
70
|
+
rubygems_version: 1.8.23
|
|
74
71
|
signing_key:
|
|
75
72
|
specification_version: 3
|
|
76
73
|
summary: BOSH CPI
|
|
77
|
-
test_files:
|
|
78
|
-
- spec/lib/cloud/spec.rb
|
|
79
|
-
- spec/spec_helper.rb
|
|
80
|
-
- spec/unit/config_spec.rb
|
|
81
|
-
- spec/unit/provider_spec.rb
|
|
74
|
+
test_files: []
|
data/Rakefile
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, 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
|
-
require "bundler_task"
|
|
18
|
-
require "ci_task"
|
|
19
|
-
|
|
20
|
-
gem_helper = Bundler::GemHelper.new(Dir.pwd)
|
|
21
|
-
|
|
22
|
-
desc "Build CPI gem into the pkg directory"
|
|
23
|
-
task "build" do
|
|
24
|
-
gem_helper.build_gem
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
desc "Build and install CPI into system gems"
|
|
28
|
-
task "install" do
|
|
29
|
-
Rake::Task["bundler:install"].invoke
|
|
30
|
-
gem_helper.install_gem
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
BundlerTask.new
|
|
34
|
-
|
|
35
|
-
if defined?(RSpec)
|
|
36
|
-
namespace :spec do
|
|
37
|
-
desc "Run Unit Tests"
|
|
38
|
-
rspec_task = RSpec::Core::RakeTask.new(:unit) do |t|
|
|
39
|
-
t.pattern = "spec/unit/**/*_spec.rb"
|
|
40
|
-
t.rspec_opts = %w(--format progress --colour)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
CiTask.new do |task|
|
|
44
|
-
task.rspec_task = rspec_task
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
desc "Run tests"
|
|
49
|
-
task :spec => %w(spec:unit)
|
|
50
|
-
end
|
data/spec/lib/cloud/spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
|
2
|
-
|
|
3
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
|
|
4
|
-
|
|
5
|
-
require "rubygems"
|
|
6
|
-
require "bundler"
|
|
7
|
-
Bundler.setup(:default, :test)
|
|
8
|
-
|
|
9
|
-
require "rspec"
|
|
10
|
-
require "cloud"
|
|
11
|
-
require "logger"
|
|
12
|
-
|
|
13
|
-
class CloudSpecConfig
|
|
14
|
-
|
|
15
|
-
attr_accessor :db, :uuid
|
|
16
|
-
|
|
17
|
-
def logger
|
|
18
|
-
if @logger.nil?
|
|
19
|
-
@logger = Logger.new(STDOUT)
|
|
20
|
-
@logger.level = Logger::ERROR
|
|
21
|
-
end
|
|
22
|
-
@logger
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def uuid
|
|
26
|
-
@uuid ||= self.class.name
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Bosh::Clouds::Config.configure(CloudSpecConfig.new)
|
data/spec/unit/config_spec.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require File.expand_path("../../spec_helper", __FILE__)
|
|
2
|
-
|
|
3
|
-
describe Bosh::Clouds::Config do
|
|
4
|
-
it "should configure a logger" do
|
|
5
|
-
Bosh::Clouds::Config.logger.should be_kind_of(Logger)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "should configure a uuid" do
|
|
9
|
-
Bosh::Clouds::Config.uuid.should be_kind_of(String)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should not have a db configured" do
|
|
13
|
-
Bosh::Clouds::Config.db.should be_nil
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "should configure a task_checkpoint" do
|
|
17
|
-
Bosh::Clouds::Config.respond_to?(:task_checkpoint).should be_true
|
|
18
|
-
end
|
|
19
|
-
end
|
data/spec/unit/provider_spec.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require File.expand_path("../../spec_helper", __FILE__)
|
|
2
|
-
$:.unshift(File.expand_path("../../lib", __FILE__))
|
|
3
|
-
|
|
4
|
-
describe Bosh::Clouds::Provider do
|
|
5
|
-
it "should create a provider instance" do
|
|
6
|
-
|
|
7
|
-
provider = Bosh::Clouds::Provider.create("spec", {})
|
|
8
|
-
provider.should be_kind_of(Bosh::Clouds::Spec)
|
|
9
|
-
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should fail to create an invalid provider" do
|
|
13
|
-
|
|
14
|
-
lambda {
|
|
15
|
-
Bosh::Clouds::Provider.create("enoent", {})
|
|
16
|
-
}.should raise_error(Bosh::Clouds::CloudError)
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
end
|