bosh_openstack_cpi 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloud/openstack/cloud.rb +176 -125
- data/lib/cloud/openstack/helpers.rb +15 -8
- data/lib/cloud/openstack/network_configurator.rb +1 -1
- metadata +4 -6
- data/README.md +0 -37
- data/USAGE.md +0 -143
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f6bbe71e06f095631885a4dc2d09b26c86ced6
|
4
|
+
data.tar.gz: 4cf9d421658bde0061f215d0c6defdb9911c2390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bac11fd8d51fd5d2c3abbad25ddf117ef512d54cda9ded5626718e04f7a5a1c2dcb00b99f606034b1265ec156552a8163e1d5bc4ca7d3b82aea5ce9126d411b2
|
7
|
+
data.tar.gz: ff6a9d7776a8ad6a40a87ec5adb9f718e71141f0c69007d97e5fc69e8efa2e3aa5bb3c7e4bca6d10cd764b28398d1f45607b874b9c8e458a655b67da40e1fb8d
|
@@ -49,24 +49,18 @@ module Bosh::OpenStackCloud
|
|
49
49
|
@use_dhcp = @openstack_properties.fetch('use_dhcp', true)
|
50
50
|
|
51
51
|
unless @openstack_properties['auth_url'].match(/\/tokens$/)
|
52
|
-
|
52
|
+
if is_v3
|
53
|
+
@openstack_properties['auth_url'] += '/auth/tokens'
|
54
|
+
else
|
55
|
+
@openstack_properties['auth_url'] += '/tokens'
|
56
|
+
end
|
53
57
|
end
|
54
58
|
|
55
59
|
@openstack_properties['connection_options'] ||= {}
|
56
60
|
|
57
61
|
@extra_connection_options = {'instrumentor' => Bosh::OpenStackCloud::ExconLoggingInstrumentor}
|
58
62
|
|
59
|
-
openstack_params =
|
60
|
-
:provider => 'OpenStack',
|
61
|
-
:openstack_auth_url => @openstack_properties['auth_url'],
|
62
|
-
:openstack_username => @openstack_properties['username'],
|
63
|
-
:openstack_api_key => @openstack_properties['api_key'],
|
64
|
-
:openstack_tenant => @openstack_properties['tenant'],
|
65
|
-
:openstack_domain_name => @openstack_properties['domain'],
|
66
|
-
:openstack_region => @openstack_properties['region'],
|
67
|
-
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
68
|
-
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
69
|
-
}
|
63
|
+
@openstack_params = openstack_params
|
70
64
|
|
71
65
|
connect_retry_errors = [Excon::Errors::GatewayTimeout, Excon::Errors::SocketError]
|
72
66
|
|
@@ -79,8 +73,10 @@ module Bosh::OpenStackCloud
|
|
79
73
|
begin
|
80
74
|
Bosh::Common.retryable(@connect_retry_options) do |tries, error|
|
81
75
|
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
82
|
-
@openstack = Fog::Compute.new(openstack_params)
|
76
|
+
@openstack = Fog::Compute.new(@openstack_params)
|
83
77
|
end
|
78
|
+
rescue Excon::Errors::SocketError => e
|
79
|
+
cloud_error(socket_error_msg + "#{e.message}")
|
84
80
|
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError
|
85
81
|
cloud_error('Unable to connect to the OpenStack Compute API. Check task debug log for details.')
|
86
82
|
end
|
@@ -89,23 +85,13 @@ module Bosh::OpenStackCloud
|
|
89
85
|
@openstack,
|
90
86
|
@openstack_properties["ignore_server_availability_zone"])
|
91
87
|
|
92
|
-
glance_params = {
|
93
|
-
:provider => 'OpenStack',
|
94
|
-
:openstack_auth_url => @openstack_properties['auth_url'],
|
95
|
-
:openstack_username => @openstack_properties['username'],
|
96
|
-
:openstack_api_key => @openstack_properties['api_key'],
|
97
|
-
:openstack_tenant => @openstack_properties['tenant'],
|
98
|
-
:openstack_domain_name => @openstack_properties['domain'],
|
99
|
-
:openstack_region => @openstack_properties['region'],
|
100
|
-
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
101
|
-
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
102
|
-
}
|
103
|
-
|
104
88
|
begin
|
105
89
|
Bosh::Common.retryable(@connect_retry_options) do |tries, error|
|
106
90
|
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
107
|
-
@glance = Fog::Image.new(
|
91
|
+
@glance = Fog::Image.new(@openstack_params)
|
108
92
|
end
|
93
|
+
rescue Excon::Errors::SocketError => e
|
94
|
+
cloud_error(socket_error_msg + "#{e.message}")
|
109
95
|
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError
|
110
96
|
cloud_error('Unable to connect to the OpenStack Image Service API. Check task debug log for details.')
|
111
97
|
end
|
@@ -113,6 +99,10 @@ module Bosh::OpenStackCloud
|
|
113
99
|
@metadata_lock = Mutex.new
|
114
100
|
end
|
115
101
|
|
102
|
+
def auth_url
|
103
|
+
@openstack_properties['auth_url']
|
104
|
+
end
|
105
|
+
|
116
106
|
##
|
117
107
|
# Creates a new OpenStack Image using stemcell image. It requires access
|
118
108
|
# to the OpenStack Glance service.
|
@@ -222,12 +212,21 @@ module Bosh::OpenStackCloud
|
|
222
212
|
|
223
213
|
network_configurator = NetworkConfigurator.new(network_spec)
|
224
214
|
|
215
|
+
network_spec_security_groups = network_configurator.security_groups
|
216
|
+
resource_pool_spec_security_groups = resource_pool_spec_security_groups(resource_pool)
|
217
|
+
|
218
|
+
if network_spec_security_groups.size > 0 && resource_pool_spec_security_groups.size > 0
|
219
|
+
cloud_error('Cannot define security groups in both network and resource pool.')
|
220
|
+
end
|
221
|
+
|
225
222
|
openstack_security_groups = with_openstack { @openstack.security_groups }.collect { |sg| sg.name }
|
226
|
-
|
227
|
-
|
223
|
+
network_security_groups = network_configurator.security_groups(@default_security_groups)
|
224
|
+
security_groups_to_be_used = resource_pool_spec_security_groups.size > 0 ? resource_pool_spec_security_groups : network_security_groups
|
225
|
+
|
226
|
+
security_groups_to_be_used.each do |sg|
|
228
227
|
cloud_error("Security group `#{sg}' not found") unless openstack_security_groups.include?(sg)
|
229
228
|
end
|
230
|
-
@logger.debug("Using security groups: `#{
|
229
|
+
@logger.debug("Using security groups: `#{security_groups_to_be_used.join(', ')}'")
|
231
230
|
|
232
231
|
nics = network_configurator.nics
|
233
232
|
@logger.debug("Using NICs: `#{nics.join(', ')}'")
|
@@ -261,9 +260,7 @@ module Bosh::OpenStackCloud
|
|
261
260
|
@logger.debug("Using flavor: `#{resource_pool['instance_type']}'")
|
262
261
|
|
263
262
|
keyname = resource_pool['key_name'] || @default_key_name
|
264
|
-
|
265
|
-
cloud_error("Key-pair `#{keyname}' not found") if keypair.nil?
|
266
|
-
@logger.debug("Using key-pair: `#{keypair.name}' (#{keypair.fingerprint})")
|
263
|
+
validate_key_exists(keyname)
|
267
264
|
|
268
265
|
use_config_drive = !!@openstack_properties.fetch("config_drive", nil)
|
269
266
|
|
@@ -275,8 +272,8 @@ module Bosh::OpenStackCloud
|
|
275
272
|
:name => server_name,
|
276
273
|
:image_ref => image.id,
|
277
274
|
:flavor_ref => flavor.id,
|
278
|
-
:key_name =>
|
279
|
-
:security_groups =>
|
275
|
+
:key_name => keyname,
|
276
|
+
:security_groups => security_groups_to_be_used,
|
280
277
|
:os_scheduler_hints => resource_pool['scheduler_hints'],
|
281
278
|
:nics => nics,
|
282
279
|
:config_drive => use_config_drive,
|
@@ -302,7 +299,25 @@ module Bosh::OpenStackCloud
|
|
302
299
|
end
|
303
300
|
|
304
301
|
@logger.debug("Using boot parms: `#{server_params.inspect}'")
|
305
|
-
|
302
|
+
begin
|
303
|
+
server = with_openstack { @openstack.servers.create(server_params) }
|
304
|
+
rescue Excon::Errors::Timeout => e
|
305
|
+
@logger.debug(e.backtrace)
|
306
|
+
cloud_error_message = "VM creation with name '#{server_params[:name]}' received a timeout. " +
|
307
|
+
"The VM might still have been created by OpenStack.\nOriginal message: "
|
308
|
+
raise Bosh::Clouds::VMCreationFailed.new(false), cloud_error_message + e.message
|
309
|
+
rescue Excon::Errors::NotFound, Fog::Compute::OpenStack::NotFound => e
|
310
|
+
not_existing_net_ids = not_existing_net_ids(nics)
|
311
|
+
if not_existing_net_ids.empty?
|
312
|
+
raise e
|
313
|
+
else
|
314
|
+
@logger.debug(e.backtrace)
|
315
|
+
cloud_error_message = "VM creation with name '#{server_params[:name]}' failed. Following network " +
|
316
|
+
"IDs are not existing or not accessible from this project: '#{not_existing_net_ids.join(",")}'. " +
|
317
|
+
"Make sure you do not use subnet IDs"
|
318
|
+
raise Bosh::Clouds::VMCreationFailed.new(false), cloud_error_message
|
319
|
+
end
|
320
|
+
end
|
306
321
|
|
307
322
|
@logger.info("Creating new server `#{server.id}'...")
|
308
323
|
begin
|
@@ -331,6 +346,22 @@ module Bosh::OpenStackCloud
|
|
331
346
|
end
|
332
347
|
end
|
333
348
|
|
349
|
+
def not_existing_net_ids(nics)
|
350
|
+
result = []
|
351
|
+
begin
|
352
|
+
network = connect_to_network_service
|
353
|
+
nics.each do |nic|
|
354
|
+
if nic["net_id"]
|
355
|
+
result << nic["net_id"] unless network.networks.get(nic["net_id"])
|
356
|
+
end
|
357
|
+
end
|
358
|
+
rescue Bosh::Clouds::CloudError => e
|
359
|
+
@logger.debug(e.backtrace)
|
360
|
+
end
|
361
|
+
result
|
362
|
+
end
|
363
|
+
|
364
|
+
|
334
365
|
##
|
335
366
|
# Terminates an OpenStack server and waits until it reports as terminated
|
336
367
|
#
|
@@ -387,22 +418,9 @@ module Bosh::OpenStackCloud
|
|
387
418
|
# @raise [Bosh::Clouds:NotSupported] If there's a network change that requires the recreation of the VM
|
388
419
|
def configure_networks(server_id, network_spec)
|
389
420
|
with_thread_name("configure_networks(#{server_id}, ...)") do
|
390
|
-
|
391
|
-
|
392
|
-
network_configurator = NetworkConfigurator.new(network_spec)
|
393
|
-
|
394
|
-
server = with_openstack { @openstack.servers.get(server_id) }
|
395
|
-
cloud_error("Server `#{server_id}' not found") unless server
|
396
|
-
|
397
|
-
compare_security_groups(server, network_configurator.security_groups(@default_security_groups))
|
398
|
-
|
399
|
-
compare_private_ip_addresses(server, network_configurator.private_ips)
|
400
|
-
|
401
|
-
network_configurator.configure(@openstack, server)
|
421
|
+
raise Bosh::Clouds::NotSupported,
|
422
|
+
'network configuration change requires VM recreation: %s' % [network_spec]
|
402
423
|
|
403
|
-
update_agent_settings(server) do |settings|
|
404
|
-
settings['networks'] = agent_network_spec(network_spec)
|
405
|
-
end
|
406
424
|
end
|
407
425
|
end
|
408
426
|
|
@@ -662,6 +680,10 @@ module Bosh::OpenStackCloud
|
|
662
680
|
@az_provider.select(volumes, resource_pool_az)
|
663
681
|
end
|
664
682
|
|
683
|
+
def is_v3
|
684
|
+
@options['openstack']['auth_url'].match(/\/v3(?=\/|$)/)
|
685
|
+
end
|
686
|
+
|
665
687
|
private
|
666
688
|
|
667
689
|
##
|
@@ -670,22 +692,10 @@ module Bosh::OpenStackCloud
|
|
670
692
|
#
|
671
693
|
#
|
672
694
|
def connect_to_volume_service
|
673
|
-
volume_params = {
|
674
|
-
:provider => "OpenStack",
|
675
|
-
:openstack_auth_url => @openstack_properties['auth_url'],
|
676
|
-
:openstack_username => @openstack_properties['username'],
|
677
|
-
:openstack_api_key => @openstack_properties['api_key'],
|
678
|
-
:openstack_tenant => @openstack_properties['tenant'],
|
679
|
-
:openstack_domain_name => @openstack_properties['domain'],
|
680
|
-
:openstack_region => @openstack_properties['region'],
|
681
|
-
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
682
|
-
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
683
|
-
}
|
684
|
-
|
685
695
|
begin
|
686
696
|
Bosh::Common.retryable(@connect_retry_options) do |tries, error|
|
687
697
|
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
688
|
-
@volume ||= Fog::Volume.new(
|
698
|
+
@volume ||= Fog::Volume.new(@openstack_params)
|
689
699
|
end
|
690
700
|
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError => e
|
691
701
|
cloud_error("Unable to connect to the OpenStack Volume API: #{e.message}. Check task debug log for details.")
|
@@ -694,6 +704,32 @@ module Bosh::OpenStackCloud
|
|
694
704
|
@volume
|
695
705
|
end
|
696
706
|
|
707
|
+
def connect_to_network_service
|
708
|
+
begin
|
709
|
+
Bosh::Common.retryable(@connect_retry_options) do |tries, error|
|
710
|
+
@logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
|
711
|
+
network ||= Fog::Network.new(@openstack_params)
|
712
|
+
end
|
713
|
+
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError => e
|
714
|
+
cloud_error("Unable to connect to the OpenStack Network API: #{e.message}. Check task debug log for details.")
|
715
|
+
end
|
716
|
+
end
|
717
|
+
|
718
|
+
def openstack_params
|
719
|
+
{
|
720
|
+
:provider => 'OpenStack',
|
721
|
+
:openstack_auth_url => @openstack_properties['auth_url'],
|
722
|
+
:openstack_username => @openstack_properties['username'],
|
723
|
+
:openstack_api_key => @openstack_properties['api_key'],
|
724
|
+
:openstack_tenant => @openstack_properties['tenant'],
|
725
|
+
:openstack_project_name => @openstack_properties['project'],
|
726
|
+
:openstack_domain_name => @openstack_properties['domain'],
|
727
|
+
:openstack_region => @openstack_properties['region'],
|
728
|
+
:openstack_endpoint_type => @openstack_properties['endpoint_type'],
|
729
|
+
:connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
|
730
|
+
}
|
731
|
+
end
|
732
|
+
|
697
733
|
##
|
698
734
|
# Generates an unique name
|
699
735
|
#
|
@@ -893,42 +929,6 @@ module Bosh::OpenStackCloud
|
|
893
929
|
end
|
894
930
|
end
|
895
931
|
|
896
|
-
##
|
897
|
-
# Compares actual server security groups with those specified at the network spec
|
898
|
-
#
|
899
|
-
# @param [Fog::Compute::OpenStack::Server] server OpenStack server
|
900
|
-
# @param [Array] specified_sg_names Security groups specified at the network spec
|
901
|
-
# @return [void]
|
902
|
-
# @raise [Bosh::Clouds:NotSupported] If the security groups change, we need to recreate the VM as you can't
|
903
|
-
# change the security group of a running server, so we need to send the InstanceUpdater a request to do it for us
|
904
|
-
def compare_security_groups(server, specified_sg_names)
|
905
|
-
actual_sg_names = with_openstack { server.security_groups }.collect { |sg| sg.name }
|
906
|
-
|
907
|
-
unless actual_sg_names.sort == specified_sg_names.sort
|
908
|
-
raise Bosh::Clouds::NotSupported,
|
909
|
-
'security groups change requires VM recreation: %s to %s' %
|
910
|
-
[actual_sg_names.join(', '), specified_sg_names.join(', ')]
|
911
|
-
end
|
912
|
-
end
|
913
|
-
|
914
|
-
##
|
915
|
-
# Compares actual server private IP addresses with the IP address specified at the network spec
|
916
|
-
#
|
917
|
-
# @param [Fog::Compute::OpenStack::Server] server OpenStack server
|
918
|
-
# @param [Array] specified_ip_addresses IP addresses specified at the network spec (if Manual network)
|
919
|
-
# @return [void]
|
920
|
-
# @raise [Bosh::Clouds:NotSupported] If the IP address change, we need to recreate the VM as you can't
|
921
|
-
# change the IP address of a running server, so we need to send the InstanceUpdater a request to do it for us
|
922
|
-
def compare_private_ip_addresses(server, specified_ip_addresses)
|
923
|
-
actual_ip_addresses = with_openstack { server.private_ip_addresses }
|
924
|
-
|
925
|
-
unless specified_ip_addresses.empty? || actual_ip_addresses.sort == specified_ip_addresses.sort
|
926
|
-
raise Bosh::Clouds::NotSupported,
|
927
|
-
'IP address change requires VM recreation: %s to %s' %
|
928
|
-
[actual_ip_addresses.join(', '), specified_ip_addresses.join(', ')]
|
929
|
-
end
|
930
|
-
end
|
931
|
-
|
932
932
|
##
|
933
933
|
# Checks if the OpenStack flavor has ephemeral disk
|
934
934
|
#
|
@@ -973,32 +973,62 @@ module Bosh::OpenStackCloud
|
|
973
973
|
# @return [void]
|
974
974
|
# @raise [ArgumentError] if options are not valid
|
975
975
|
def validate_options
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
'
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
'
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
976
|
+
if @options['openstack'] && is_v3
|
977
|
+
schema = Membrane::SchemaParser.parse do
|
978
|
+
{
|
979
|
+
'openstack' => {
|
980
|
+
'auth_url' => String,
|
981
|
+
'username' => String,
|
982
|
+
'api_key' => String,
|
983
|
+
'project' => String,
|
984
|
+
'domain' => String,
|
985
|
+
optional('region') => String,
|
986
|
+
optional('endpoint_type') => String,
|
987
|
+
optional('state_timeout') => Numeric,
|
988
|
+
optional('stemcell_public_visibility') => enum(String, bool),
|
989
|
+
optional('connection_options') => Hash,
|
990
|
+
optional('boot_from_volume') => bool,
|
991
|
+
optional('default_key_name') => String,
|
992
|
+
optional('default_security_groups') => [String],
|
993
|
+
optional('wait_resource_poll_interval') => Integer,
|
994
|
+
optional('config_drive') => enum('disk', 'cdrom'),
|
995
|
+
},
|
996
|
+
'registry' => {
|
997
|
+
'endpoint' => String,
|
998
|
+
'user' => String,
|
999
|
+
'password' => String,
|
1000
|
+
},
|
1001
|
+
optional('agent') => Hash,
|
1002
|
+
}
|
1003
|
+
end
|
1004
|
+
else
|
1005
|
+
schema = Membrane::SchemaParser.parse do
|
1006
|
+
{
|
1007
|
+
'openstack' => {
|
1008
|
+
'auth_url' => String,
|
1009
|
+
'username' => String,
|
1010
|
+
'api_key' => String,
|
1011
|
+
'tenant' => String,
|
1012
|
+
optional('domain') => String,
|
1013
|
+
optional('region') => String,
|
1014
|
+
optional('endpoint_type') => String,
|
1015
|
+
optional('state_timeout') => Numeric,
|
1016
|
+
optional('stemcell_public_visibility') => enum(String, bool),
|
1017
|
+
optional('connection_options') => Hash,
|
1018
|
+
optional('boot_from_volume') => bool,
|
1019
|
+
optional('default_key_name') => String,
|
1020
|
+
optional('default_security_groups') => [String],
|
1021
|
+
optional('wait_resource_poll_interval') => Integer,
|
1022
|
+
optional('config_drive') => enum('disk', 'cdrom'),
|
1023
|
+
},
|
1024
|
+
'registry' => {
|
1025
|
+
'endpoint' => String,
|
1026
|
+
'user' => String,
|
1027
|
+
'password' => String,
|
1028
|
+
},
|
1029
|
+
optional('agent') => Hash,
|
1030
|
+
}
|
1031
|
+
end
|
1002
1032
|
end
|
1003
1033
|
schema.validate(@options)
|
1004
1034
|
rescue Membrane::SchemaValidationError => e
|
@@ -1055,5 +1085,26 @@ module Bosh::OpenStackCloud
|
|
1055
1085
|
@logger.warn("Failed to destroy server: #{delete_server_error.inspect}\n#{delete_server_error.backtrace.join('\n')}")
|
1056
1086
|
end
|
1057
1087
|
end
|
1088
|
+
|
1089
|
+
def resource_pool_spec_security_groups(resource_pool_spec)
|
1090
|
+
if resource_pool_spec && resource_pool_spec.has_key?("security_groups")
|
1091
|
+
unless resource_pool_spec["security_groups"].is_a?(Array)
|
1092
|
+
raise ArgumentError, "security groups must be an Array"
|
1093
|
+
end
|
1094
|
+
return resource_pool_spec["security_groups"]
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
[]
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
def validate_key_exists(keyname)
|
1101
|
+
keypair = with_openstack { @openstack.key_pairs.find { |k| k.name == keyname } }
|
1102
|
+
cloud_error("Key-pair `#{keyname}' not found") if keypair.nil?
|
1103
|
+
@logger.debug("Using key-pair: `#{keypair.name}' (#{keypair.fingerprint})")
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
def socket_error_msg
|
1107
|
+
"Unable to connect to the OpenStack Keystone API #{@openstack_params[:openstack_auth_url]}\n"
|
1108
|
+
end
|
1058
1109
|
end
|
1059
1110
|
end
|
@@ -26,17 +26,24 @@ module Bosh::OpenStackCloud
|
|
26
26
|
yield
|
27
27
|
|
28
28
|
rescue Excon::Errors::RequestEntityTooLarge => e
|
29
|
-
|
29
|
+
message = "OpenStack API Request Entity Too Large error: \nCheck task debug log for details."
|
30
30
|
overlimit = parse_openstack_response(e.response, "overLimit", "overLimitFault")
|
31
|
-
|
32
|
-
|
31
|
+
|
32
|
+
if overlimit
|
33
|
+
message.insert(46, overlimit["message"])
|
33
34
|
details = "#{overlimit["message"]} - #{overlimit["details"]}"
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
|
36
|
+
if retries < MAX_RETRIES
|
37
|
+
wait_time = overlimit["retryAfter"] || e.response.headers["Retry-After"] || DEFAULT_RETRY_TIMEOUT
|
38
|
+
@logger.debug("OpenStack API Over Limit (#{details}), waiting #{wait_time} seconds before retrying") if @logger
|
39
|
+
sleep(wait_time.to_i)
|
40
|
+
retries += 1
|
41
|
+
retry
|
42
|
+
end
|
43
|
+
else
|
44
|
+
message.insert(46, e.response.body)
|
38
45
|
end
|
39
|
-
cloud_error(
|
46
|
+
cloud_error(message, e)
|
40
47
|
|
41
48
|
rescue Excon::Errors::ServiceUnavailable => e
|
42
49
|
unless retries >= MAX_RETRIES
|
@@ -110,7 +110,7 @@ module Bosh::OpenStackCloud
|
|
110
110
|
#
|
111
111
|
# @param [Array] default Default security groups
|
112
112
|
# @return [Array] security groups
|
113
|
-
def security_groups(default)
|
113
|
+
def security_groups(default = nil)
|
114
114
|
if @security_groups.empty? && default
|
115
115
|
default
|
116
116
|
else
|
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: 2.1.
|
4
|
+
version: 2.1.1
|
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:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_common
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
75
|
+
version: 2.7.1
|
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: 2.
|
82
|
+
version: 2.7.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: yajl-ruby
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,8 +116,6 @@ executables:
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
-
- README.md
|
120
|
-
- USAGE.md
|
121
119
|
- bin/bosh_openstack_console
|
122
120
|
- bin/openstack_cpi
|
123
121
|
- lib/bosh_openstack_cpi.rb
|
data/README.md
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# OpenStack BOSH Cloud Provider Interface
|
2
|
-
|
3
|
-
## Bringing the world’s most popular open source platform-as-a-service to the world’s most popular open source infrastructure-as-a-service platform
|
4
|
-
|
5
|
-
This repo contains software designed to manage the deployment of Cloud Foundry on top of OpenStack, using Cloud Foundry BOSH. Say what?
|
6
|
-
|
7
|
-
## OpenStack
|
8
|
-
|
9
|
-
OpenStack is a collection of interrelated open source projects that, together, form a pluggable framework for building massively-scalable infrastructure as a service clouds. OpenStack represents the world's largest and fastest-growing open cloud community, a global collaboration of over 150 leading companies.
|
10
|
-
|
11
|
-
## Cloud Foundry
|
12
|
-
|
13
|
-
Cloud Foundry is the leading open source platform-as-a-service (PaaS) offering with a fast growing ecosystem and strong enterprise demand.
|
14
|
-
|
15
|
-
## BOSH
|
16
|
-
|
17
|
-
Cloud Foundry BOSH is an open source tool chain for release engineering, deployment and lifecycle management of large scale distributed services. In this manual we describe the architecture, topology, configuration, and use of BOSH, as well as the structure and conventions used in packaging and deployment.
|
18
|
-
|
19
|
-
## OpenStack and Cloud Foundry, Together using BOSH
|
20
|
-
|
21
|
-
Cloud Foundry BOSH defines a Cloud Provider Interface API that enables platform-as-a-service deployment across multiple cloud providers - initially VMWare's vSphere and AWS. Piston Cloud has partnered with VMWare to provide a CPI for OpenStack, opening up Cloud Foundry deployment to an entire ecosystem of public and private OpenStack deployments.
|
22
|
-
|
23
|
-
Using a popular cloud-services client written in Ruby, the OpenStack CPI manages the deployment of a set of virtual machines and enables applications to be deployed dynamically using Cloud Foundry. A common image, called a stem-cell, allows Cloud Foundry BOSH to rapidly build new virtual machines enabling rapid scale-out.
|
24
|
-
|
25
|
-
We've partnered with VMWare to deliver this project, because the leading open-source platform-as-a-service offering should work seamlessly with deployments of the leading open-source infrastructure-as-a-service project. The work being done to develop this CPI, will enable customers of any OpenStack cloud to use Cloud Foundry to accelerate development of cloud applications and drive value by working against a common service API.
|
26
|
-
|
27
|
-
## Piston Cloud Computing, Inc.
|
28
|
-
|
29
|
-
Piston Cloud Computing, Inc. is the enterprise OpenStack™ company. Founded in early 2011 by technical team leads from NASA and Rackspace®, Piston Cloud is built around OpenStack, the fastest-growing, massively scalable cloud framework. Piston Enterprise OS™ (pentOS™) is the first fully- automated bare-metal cloud operating system built on OpenStack and the first OpenStack distribution specifically focused on security and easy operation of enterprise private clouds for the enterprise.
|
30
|
-
|
31
|
-
## Legal Stuff
|
32
|
-
|
33
|
-
This project, as well as OpenStack and Cloud Foundry, are Apache2-licensed Open Source.
|
34
|
-
|
35
|
-
VMware and Cloud Foundry are registered trademarks or trademarks of VMware, Inc. in the United States and/or other jurisdictions.
|
36
|
-
|
37
|
-
OpenStack is a registered trademark of OpenStack, LLC.
|
data/USAGE.md
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
# BOSH OpenStack Cloud Provider Interface
|
2
|
-
# Copyright (c) 2009-2013 VMware, Inc.
|
3
|
-
# Copyright (c) 2012 Piston Cloud Computing, Inc.
|
4
|
-
|
5
|
-
For online documentation see: http://rubydoc.info/gems/bosh_openstack_cpi/
|
6
|
-
|
7
|
-
## Options
|
8
|
-
|
9
|
-
These options are passed to the OpenStack CPI when it is instantiated.
|
10
|
-
|
11
|
-
### OpenStack options
|
12
|
-
|
13
|
-
The registry options are passed to the Openstack CPI by the BOSH director based on the settings in `director.yml`:
|
14
|
-
|
15
|
-
* `auth_url` (required)
|
16
|
-
URL of the OpenStack Identity endpoint to connect to
|
17
|
-
* `username` (required)
|
18
|
-
OpenStack user name
|
19
|
-
* `api_key` (required)
|
20
|
-
OpenStack API key
|
21
|
-
* `tenant` (required)
|
22
|
-
OpenStack tenant name
|
23
|
-
* `domain` (optional)
|
24
|
-
OpenStack domain name
|
25
|
-
* `region` (optional)
|
26
|
-
OpenStack region
|
27
|
-
* `endpoint_type` (optional)
|
28
|
-
OpenStack endpoint type (publicURL (default), adminURL, internalURL)
|
29
|
-
* `state_timeout` (optional)
|
30
|
-
Timeout (in seconds) for OpenStack resources desired state (by default 300)
|
31
|
-
* `stemcell_public_visibility` (optional)
|
32
|
-
Set public visibility for stemcells (true or false (default))
|
33
|
-
* `connection_options` (optional)
|
34
|
-
Hash containing optional connection parameters to the OpenStack API (`ssl_verify_peer`, `omit_default_port`, ...)
|
35
|
-
* `default_key_name` (required)
|
36
|
-
default OpenStack ssh key name to assign to created virtual machines
|
37
|
-
* `default_security_group` (required)
|
38
|
-
default OpenStack security group to assign to created virtual machines
|
39
|
-
* `ignore_server_availability_zone` (optional)
|
40
|
-
When creating a disk, do not use the availability zone of the server, fall back to Openstacks default. Commonly used if Ceph is used for block storage. Defaults to false.
|
41
|
-
|
42
|
-
### Registry options
|
43
|
-
|
44
|
-
The registry options are passed to the Openstack CPI by the BOSH director based on the settings in `director.yml`:
|
45
|
-
|
46
|
-
* `endpoint` (required)
|
47
|
-
OpenStack registry URL
|
48
|
-
* `user` (required)
|
49
|
-
OpenStack registry user
|
50
|
-
* `password` (required)
|
51
|
-
OpenStack registry password
|
52
|
-
|
53
|
-
### Agent options
|
54
|
-
|
55
|
-
The agent options are passed to the OpenStack CPI by the BOSH director based on the settings in `director.yml`:
|
56
|
-
|
57
|
-
## Network options
|
58
|
-
|
59
|
-
The OpenStack CPI supports these networks types:
|
60
|
-
|
61
|
-
* `type` (required)
|
62
|
-
can be `dynamic` for a DHCP assigned IP by OpenStack, `manual` for a static IP assigned manually at the BOSH deployment manifest or `vip` to use a Floating IP (which needs to be already allocated)
|
63
|
-
|
64
|
-
These options are specified under `cloud_properties` in the `networks` section of a BOSH deployment manifest:
|
65
|
-
|
66
|
-
* `security_groups` (optional)
|
67
|
-
the OpenStack security groups to assign to VMs. If not specified, it'll use the default security groups set at the OpenStack options
|
68
|
-
|
69
|
-
* `net_id` (required for `manual` networks)
|
70
|
-
the OpenStack Quantum network UUID to attach as a NIC to VMs.
|
71
|
-
|
72
|
-
## Resource pool options
|
73
|
-
|
74
|
-
These options are specified under `cloud_properties` in the `resource_pools` section of a BOSH deployment manifest:
|
75
|
-
|
76
|
-
* `instance_type` (required)
|
77
|
-
which type of instance (OpenStack flavor) the VMs should belong to
|
78
|
-
* `availability_zone` (optional)
|
79
|
-
the OpenStack availability zone the VMs should be created in
|
80
|
-
* `scheduler_hints` (optional)
|
81
|
-
[filters](http://docs.openstack.org/developer/nova/devref/filter_scheduler.html) that will be passed to Nova.
|
82
|
-
|
83
|
-
## Example
|
84
|
-
|
85
|
-
This is a sample of how OpenStack specific properties are used in a BOSH deployment manifest:
|
86
|
-
|
87
|
-
---
|
88
|
-
name: sample
|
89
|
-
director_uuid: 38ce80c3-e9e9-4aac-ba61-97c676631b91
|
90
|
-
|
91
|
-
...
|
92
|
-
|
93
|
-
networks:
|
94
|
-
- name: default
|
95
|
-
type: dynamic
|
96
|
-
cloud_properties:
|
97
|
-
security_groups:
|
98
|
-
- default
|
99
|
-
net_id: 2438bca2-24fa-450f-ae7b-ec2e53b51984
|
100
|
-
- name: static
|
101
|
-
type: manual
|
102
|
-
subnets:
|
103
|
-
- name: private
|
104
|
-
range: 10.0.1.0/24
|
105
|
-
gateway: 10.0.1.1
|
106
|
-
reserved:
|
107
|
-
- 10.0.1.2 - 10.0.1.9
|
108
|
-
static:
|
109
|
-
- 10.0.1.10 - 10.0.1.20
|
110
|
-
cloud_properties:
|
111
|
-
security_groups:
|
112
|
-
- default
|
113
|
-
net_id: 8d8b84b4-faa6-4605-9fbf-c179bdae4282
|
114
|
-
- name: floating
|
115
|
-
type: vip
|
116
|
-
cloud_properties: {}
|
117
|
-
...
|
118
|
-
|
119
|
-
resource_pools:
|
120
|
-
- name: common
|
121
|
-
network: default
|
122
|
-
size: 1
|
123
|
-
stemcell:
|
124
|
-
name: bosh-openstack-kvm-ubuntu
|
125
|
-
version: latest
|
126
|
-
cloud_properties:
|
127
|
-
instance_type: m1.small
|
128
|
-
availability_zone:
|
129
|
-
scheduler_hints:
|
130
|
-
group: af09abf2-2283-47d6-f2bd-2932a9ae949c
|
131
|
-
|
132
|
-
...
|
133
|
-
|
134
|
-
properties:
|
135
|
-
openstack:
|
136
|
-
auth_url: http://pistoncloud.com/:5000/v2.0
|
137
|
-
username: christopher
|
138
|
-
api_key: QRoqsenPsNGX6
|
139
|
-
tenant: Bosh
|
140
|
-
region: RegionOne
|
141
|
-
endpoint_type: publicURL
|
142
|
-
default_key_name: bosh
|
143
|
-
default_security_groups: ["bosh"]
|