bosh_openstack_cpi 1.3033.0 → 1.3039.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ab5fe9e7caf41ec33a35feaf98e064e1248a071
4
- data.tar.gz: 4025247388ddde917d8905534720e6a0590cab30
3
+ metadata.gz: a4b4be6f3273b4e67b919cc550a49fd54a43fdc1
4
+ data.tar.gz: 3a04b00f00665a402df33090333755eec6ad8a9a
5
5
  SHA512:
6
- metadata.gz: a94fcbcf29f1b9944a3d6b1fae6e49b46602ed3cd9140ffc5ee0ab69ec4b4400d91a3177ee893caaf3df426c99b4b11435591979f720a477cf296ff2157f0572
7
- data.tar.gz: 13f3fd4b825878c6b198721fdb2a21bb071078017e5d945d89cc3f02468c2115fdb084a34fb1e887bd9c9ebc5b55f42cd2492de99b24754a2fb20856c629d6f6
6
+ metadata.gz: 751948c5de3e5eba400a1b1e6b8406f5aec0b58a3f8b6b3c38cdb59d756cddeef75bb7f36e5fee833b7275f16d5fe64a51a0f166220fa73e1c728418f11fd63e
7
+ data.tar.gz: 43498578e3f1e5c00420828e7574d6ed4b1ddd58f8a942821395660d700be0030fc04612c105abd197e07630caa1821108e017a0a729eb0ae7c4639a081bfba6
@@ -54,7 +54,7 @@ module Bosh::OpenStackCloud
54
54
 
55
55
  @openstack_properties['connection_options'] ||= {}
56
56
 
57
- extra_connection_options = {'instrumentor' => Bosh::OpenStackCloud::ExconLoggingInstrumentor}
57
+ @extra_connection_options = {'instrumentor' => Bosh::OpenStackCloud::ExconLoggingInstrumentor}
58
58
 
59
59
  openstack_params = {
60
60
  :provider => 'OpenStack',
@@ -64,19 +64,19 @@ module Bosh::OpenStackCloud
64
64
  :openstack_tenant => @openstack_properties['tenant'],
65
65
  :openstack_region => @openstack_properties['region'],
66
66
  :openstack_endpoint_type => @openstack_properties['endpoint_type'],
67
- :connection_options => @openstack_properties['connection_options'].merge(extra_connection_options)
67
+ :connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
68
68
  }
69
69
 
70
70
  connect_retry_errors = [Excon::Errors::GatewayTimeout]
71
71
 
72
- connect_retry_options = {
72
+ @connect_retry_options = {
73
73
  sleep: CONNECT_RETRY_DELAY,
74
74
  tries: CONNECT_RETRY_COUNT,
75
75
  on: connect_retry_errors,
76
76
  }
77
77
 
78
78
  begin
79
- Bosh::Common.retryable(connect_retry_options) do |tries, error|
79
+ Bosh::Common.retryable(@connect_retry_options) do |tries, error|
80
80
  @logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
81
81
  @openstack = Fog::Compute.new(openstack_params)
82
82
  end
@@ -96,11 +96,11 @@ module Bosh::OpenStackCloud
96
96
  :openstack_tenant => @openstack_properties['tenant'],
97
97
  :openstack_region => @openstack_properties['region'],
98
98
  :openstack_endpoint_type => @openstack_properties['endpoint_type'],
99
- :connection_options => @openstack_properties['connection_options'].merge(extra_connection_options)
99
+ :connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
100
100
  }
101
101
 
102
102
  begin
103
- Bosh::Common.retryable(connect_retry_options) do |tries, error|
103
+ Bosh::Common.retryable(@connect_retry_options) do |tries, error|
104
104
  @logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
105
105
  @glance = Fog::Image.new(glance_params)
106
106
  end
@@ -108,26 +108,6 @@ module Bosh::OpenStackCloud
108
108
  cloud_error('Unable to connect to the OpenStack Image Service API. Check task debug log for details.')
109
109
  end
110
110
 
111
- volume_params = {
112
- :provider => "OpenStack",
113
- :openstack_auth_url => @openstack_properties['auth_url'],
114
- :openstack_username => @openstack_properties['username'],
115
- :openstack_api_key => @openstack_properties['api_key'],
116
- :openstack_tenant => @openstack_properties['tenant'],
117
- :openstack_region => @openstack_properties['region'],
118
- :openstack_endpoint_type => @openstack_properties['endpoint_type'],
119
- :connection_options => @openstack_properties['connection_options'].merge(extra_connection_options)
120
- }
121
-
122
- begin
123
- Bosh::Common.retryable(connect_retry_options) do |tries, error|
124
- @logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
125
- @volume = Fog::Volume.new(volume_params)
126
- end
127
- rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError
128
- cloud_error('Unable to connect to the OpenStack Volume API. Check task debug log for details.')
129
- end
130
-
131
111
  @metadata_lock = Mutex.new
132
112
  end
133
113
 
@@ -424,6 +404,7 @@ module Bosh::OpenStackCloud
424
404
  # this disk will be attached to
425
405
  # @return [String] OpenStack volume UUID
426
406
  def create_disk(size, cloud_properties, server_id = nil)
407
+ volume_service_client = connect_to_volume_service
427
408
  with_thread_name("create_disk(#{size}, #{cloud_properties}, #{server_id})") do
428
409
  raise ArgumentError, 'Disk size needs to be an integer' unless size.kind_of?(Integer)
429
410
  cloud_error('Minimum disk size is 1 GiB') if (size < 1024)
@@ -446,7 +427,7 @@ module Bosh::OpenStackCloud
446
427
  end
447
428
 
448
429
  @logger.info('Creating new volume...')
449
- new_volume = with_openstack { @volume.volumes.create(volume_params) }
430
+ new_volume = with_openstack { volume_service_client.volumes.create(volume_params) }
450
431
 
451
432
  @logger.info("Creating new volume `#{new_volume.id}'...")
452
433
  wait_resource(new_volume, :available)
@@ -465,6 +446,7 @@ module Bosh::OpenStackCloud
465
446
  # @param [optional, String] volume_type to be passed to the volume API
466
447
  # @return [String] OpenStack volume UUID
467
448
  def create_boot_disk(size, stemcell_id, availability_zone = nil, boot_volume_cloud_properties = {})
449
+ volume_service_client = connect_to_volume_service
468
450
  with_thread_name("create_boot_disk(#{size}, #{stemcell_id}, #{availability_zone}, #{boot_volume_cloud_properties})") do
469
451
  raise ArgumentError, "Disk size needs to be an integer" unless size.kind_of?(Integer)
470
452
  cloud_error("Minimum disk size is 1 GiB") if (size < 1024)
@@ -481,7 +463,7 @@ module Bosh::OpenStackCloud
481
463
  volume_params[:volume_type] = boot_volume_cloud_properties["type"] if boot_volume_cloud_properties["type"]
482
464
 
483
465
  @logger.info("Creating new boot volume...")
484
- boot_volume = with_openstack { @volume.volumes.create(volume_params) }
466
+ boot_volume = with_openstack { volume_service_client.volumes.create(volume_params) }
485
467
 
486
468
  @logger.info("Creating new boot volume `#{boot_volume.id}'...")
487
469
  wait_resource(boot_volume, :available)
@@ -656,6 +638,35 @@ module Bosh::OpenStackCloud
656
638
 
657
639
  private
658
640
 
641
+ ##
642
+ # Creates a client for the OpenStack volume service, or return
643
+ # the existing connectuion
644
+ #
645
+ #
646
+ def connect_to_volume_service
647
+ volume_params = {
648
+ :provider => "OpenStack",
649
+ :openstack_auth_url => @openstack_properties['auth_url'],
650
+ :openstack_username => @openstack_properties['username'],
651
+ :openstack_api_key => @openstack_properties['api_key'],
652
+ :openstack_tenant => @openstack_properties['tenant'],
653
+ :openstack_region => @openstack_properties['region'],
654
+ :openstack_endpoint_type => @openstack_properties['endpoint_type'],
655
+ :connection_options => @openstack_properties['connection_options'].merge(@extra_connection_options)
656
+ }
657
+
658
+ begin
659
+ Bosh::Common.retryable(@connect_retry_options) do |tries, error|
660
+ @logger.error("Failed #{tries} times, last failure due to: #{error.inspect}") unless error.nil?
661
+ @volume ||= Fog::Volume.new(volume_params)
662
+ end
663
+ rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError => e
664
+ cloud_error("Unable to connect to the OpenStack Volume API: #{e.message}. Check task debug log for details.")
665
+ end
666
+
667
+ @volume
668
+ end
669
+
659
670
  ##
660
671
  # Generates an unique name
661
672
  #
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Bosh
5
5
  module OpenStackCloud
6
- VERSION = '1.3033.0'
6
+ VERSION = '1.3039.0'
7
7
  end
8
8
  end
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.3033.0
4
+ version: 1.3039.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-04 00:00:00.000000000 Z
11
+ date: 2015-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-aws
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3033.0
47
+ version: 1.3039.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.3033.0
54
+ version: 1.3039.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.3033.0
61
+ version: 1.3039.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.3033.0
68
+ version: 1.3039.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.3033.0
75
+ version: 1.3039.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.3033.0
82
+ version: 1.3039.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
- 2c1c13
183
+ e8cf4e
184
184
  email: support@cloudfoundry.com
185
185
  executables:
186
186
  - bosh_openstack_console