bosh_openstack_cpi 1.3048.0 → 1.3050.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/USAGE.md +2 -0
- data/bin/openstack_cpi +13 -5
- data/lib/cloud/openstack/cloud.rb +35 -7
- data/lib/cloud/openstack/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77ef3e3b4dfd8a243a6c8984b890cfaac5e7d1c9
|
4
|
+
data.tar.gz: 74319c92621ba3e24b9b61ca0e0d6637f3b7f9cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb770f243c46fbfe17a2b97a36b75a35e7642823902d8064df6c7f5431e68386a45651a1b2d7bb992752d3f1adca419daae0beceaee25ec3768198105bd21829
|
7
|
+
data.tar.gz: 4229f2a405c25195deab289e26ca106de6d3f018986e1436cb423ff483656b71f9943d9468e4d8e724a1d55557702050718fee68bdba76c0cc3edf12dd1e8cfb
|
data/USAGE.md
CHANGED
@@ -20,6 +20,8 @@ The registry options are passed to the Openstack CPI by the BOSH director based
|
|
20
20
|
OpenStack API key
|
21
21
|
* `tenant` (required)
|
22
22
|
OpenStack tenant name
|
23
|
+
* `domain` (optional)
|
24
|
+
OpenStack domain name
|
23
25
|
* `region` (optional)
|
24
26
|
OpenStack region
|
25
27
|
* `endpoint_type` (optional)
|
data/bin/openstack_cpi
CHANGED
@@ -11,10 +11,18 @@ cloud_config = OpenStruct.new(:logger => Logger.new(STDERR))
|
|
11
11
|
|
12
12
|
Bosh::Clouds::Config.configure(cloud_config)
|
13
13
|
|
14
|
-
|
15
|
-
cloud_properties['cpi_log'] = StringIO.new
|
14
|
+
cpi_log = StringIO.new
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
cpi_lambda = lambda do
|
17
|
+
unless cpi_config.has_key?('cloud') && cpi_config['cloud'].has_key?('properties')
|
18
|
+
raise "Could not find cloud properties in the configuration"
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
+
cloud_properties = cpi_config['cloud']['properties']
|
22
|
+
cloud_properties['cpi_log'] = cpi_log
|
23
|
+
Bosh::Clouds::Openstack.new(cloud_properties)
|
24
|
+
end
|
25
|
+
|
26
|
+
cli = Bosh::Cpi::Cli.new(cpi_lambda, cpi_log, STDOUT)
|
27
|
+
|
28
|
+
cli.run(ARGF.read)
|
@@ -62,12 +62,13 @@ module Bosh::OpenStackCloud
|
|
62
62
|
:openstack_username => @openstack_properties['username'],
|
63
63
|
:openstack_api_key => @openstack_properties['api_key'],
|
64
64
|
:openstack_tenant => @openstack_properties['tenant'],
|
65
|
+
:openstack_domain_name => @openstack_properties['domain'],
|
65
66
|
:openstack_region => @openstack_properties['region'],
|
66
67
|
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
67
68
|
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
68
69
|
}
|
69
70
|
|
70
|
-
connect_retry_errors = [Excon::Errors::GatewayTimeout]
|
71
|
+
connect_retry_errors = [Excon::Errors::GatewayTimeout, Excon::Errors::SocketError]
|
71
72
|
|
72
73
|
@connect_retry_options = {
|
73
74
|
sleep: CONNECT_RETRY_DELAY,
|
@@ -94,6 +95,7 @@ module Bosh::OpenStackCloud
|
|
94
95
|
:openstack_username => @openstack_properties['username'],
|
95
96
|
:openstack_api_key => @openstack_properties['api_key'],
|
96
97
|
:openstack_tenant => @openstack_properties['tenant'],
|
98
|
+
:openstack_domain_name => @openstack_properties['domain'],
|
97
99
|
:openstack_region => @openstack_properties['region'],
|
98
100
|
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
99
101
|
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
@@ -230,9 +232,17 @@ module Bosh::OpenStackCloud
|
|
230
232
|
nics = network_configurator.nics
|
231
233
|
@logger.debug("Using NICs: `#{nics.join(', ')}'")
|
232
234
|
|
233
|
-
image =
|
234
|
-
|
235
|
-
|
235
|
+
image = nil
|
236
|
+
begin
|
237
|
+
Bosh::Common.retryable(@connect_retry_options) do |tries, error|
|
238
|
+
@logger.error("Unable to connect to OpenStack API to find image: `#{stemcell_id} due to: #{error.inspect}") unless error.nil?
|
239
|
+
image = with_openstack { @openstack.images.find { |i| i.id == stemcell_id } }
|
240
|
+
cloud_error("Image `#{stemcell_id}' not found") if image.nil?
|
241
|
+
@logger.debug("Using image: `#{stemcell_id}'")
|
242
|
+
end
|
243
|
+
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::SocketError => e
|
244
|
+
cloud_error("Unable to connect to OpenStack API to find image: `#{stemcell_id}'")
|
245
|
+
end
|
236
246
|
|
237
247
|
flavor = with_openstack { @openstack.flavors.find { |f| f.name == resource_pool['instance_type'] } }
|
238
248
|
cloud_error("Flavor `#{resource_pool['instance_type']}' not found") if flavor.nil?
|
@@ -472,6 +482,20 @@ module Bosh::OpenStackCloud
|
|
472
482
|
end
|
473
483
|
end
|
474
484
|
|
485
|
+
##
|
486
|
+
# Check whether an OpenStack volume exists or not
|
487
|
+
#
|
488
|
+
# @param [String] disk_id OpenStack volume UUID
|
489
|
+
# @return [bool] whether the specific disk is there or not
|
490
|
+
def has_disk?(disk_id)
|
491
|
+
with_thread_name("has_disk?(#{disk_id})") do
|
492
|
+
@logger.info("Check the presence of disk with id `#{disk_id}'...")
|
493
|
+
volume = with_openstack { @openstack.volumes.get(disk_id) }
|
494
|
+
|
495
|
+
!volume.nil?
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
475
499
|
##
|
476
500
|
# Deletes an OpenStack volume
|
477
501
|
#
|
@@ -532,9 +556,11 @@ module Bosh::OpenStackCloud
|
|
532
556
|
cloud_error("Server `#{server_id}' not found") unless server
|
533
557
|
|
534
558
|
volume = with_openstack { @openstack.volumes.get(disk_id) }
|
535
|
-
|
536
|
-
|
537
|
-
|
559
|
+
if volume.nil?
|
560
|
+
@logger.info("Disk `#{disk_id}' not found while trying to detach it from vm `#{server_id}'...")
|
561
|
+
else
|
562
|
+
detach_volume(server, volume)
|
563
|
+
end
|
538
564
|
|
539
565
|
update_agent_settings(server) do |settings|
|
540
566
|
settings['disks'] ||= {}
|
@@ -650,6 +676,7 @@ module Bosh::OpenStackCloud
|
|
650
676
|
:openstack_username => @openstack_properties['username'],
|
651
677
|
:openstack_api_key => @openstack_properties['api_key'],
|
652
678
|
:openstack_tenant => @openstack_properties['tenant'],
|
679
|
+
:openstack_domain_name => @openstack_properties['domain'],
|
653
680
|
:openstack_region => @openstack_properties['region'],
|
654
681
|
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
655
682
|
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
@@ -953,6 +980,7 @@ module Bosh::OpenStackCloud
|
|
953
980
|
'username' => String,
|
954
981
|
'api_key' => String,
|
955
982
|
'tenant' => String,
|
983
|
+
optional('domain') => String,
|
956
984
|
optional('region') => String,
|
957
985
|
optional('endpoint_type') => String,
|
958
986
|
optional('state_timeout') => Numeric,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_openstack_cpi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3050.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piston Cloud Computing / VMware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-aws
|
@@ -30,56 +30,56 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.31.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.31.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bosh_common
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.3050.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.3050.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bosh_cpi
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.3050.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.3050.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bosh-registry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.3050.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.3050.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: httpclient
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +180,7 @@ dependencies:
|
|
180
180
|
version: '0'
|
181
181
|
description: |-
|
182
182
|
BOSH OpenStack CPI
|
183
|
-
|
183
|
+
b92cdc
|
184
184
|
email: support@cloudfoundry.com
|
185
185
|
executables:
|
186
186
|
- bosh_openstack_console
|