Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Enable show_multiple_loations option for glance when using Ceph
Browse files Browse the repository at this point in the history
When using Ceph as storage backend, to take the benefit of Ceph
inside snapshot, show_multiple_locations option needs to be enabled
so image snapshot can be done using ceph clone.

Change-Id: I8ecfcbd7b0df518f5dcf046693203bd7815efbb2
Closes-Bug: #1641572
  • Loading branch information
yaguangtang committed Nov 17, 2016
1 parent f8bba32 commit 220566b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 34 deletions.
48 changes: 26 additions & 22 deletions deployment/puppet/openstack_tasks/manifests/glance/glance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,18 @@
if ($storage_hash['images_ceph'] and !$ironic_hash['enabled']) {
$glance_backend = 'ceph'
$known_stores = [ 'glance.store.rbd.Store', 'glance.store.http.Store' ]
$show_multiple_locations = pick($glance_hash['show_multiple_locations'], true)
$show_image_direct_url = pick($glance_hash['show_image_direct_url'], true)
} elsif ($storage_hash['images_vcenter']) {
$glance_backend = 'vmware'
$known_stores = [ 'glance.store.vmware_datastore.Store', 'glance.store.http.Store' ]
$show_multiple_locations = pick($glance_hash['show_multiple_locations'], true)
$show_image_direct_url = pick($glance_hash['show_image_direct_url'], true)
} else {
$glance_backend = 'swift'
$known_stores = [ 'glance.store.swift.Store', 'glance.store.http.Store' ]
$swift_store_large_object_size = $glance_large_object_size
$show_multiple_locations = pick($glance_hash['show_multiple_locations'], false)
$show_image_direct_url = pick($glance_hash['show_image_direct_url'], false)
}

Expand Down Expand Up @@ -166,28 +169,29 @@

# Install and configure glance-api
class { '::glance::api':
debug => $debug,
bind_host => $api_bind_host,
auth_strategy => 'keystone',
database_connection => $db_connection,
enabled => $enabled,
workers => $service_workers,
registry_host => $glance_endpoint,
use_syslog => $use_syslog,
use_stderr => $use_stderr,
log_facility => $syslog_log_facility,
database_idle_timeout => $idle_timeout,
database_max_pool_size => $max_pool_size,
database_max_retries => $max_retries,
database_max_overflow => $max_overflow,
show_image_direct_url => $show_image_direct_url,
pipeline => $pipeline,
stores => $known_stores,
os_region_name => $region,
delayed_delete => false,
scrub_time => '43200',
image_cache_stall_time => '86400',
image_cache_max_size => $glance_image_cache_max_size,
debug => $debug,
bind_host => $api_bind_host,
auth_strategy => 'keystone',
database_connection => $db_connection,
enabled => $enabled,
workers => $service_workers,
registry_host => $glance_endpoint,
use_syslog => $use_syslog,
use_stderr => $use_stderr,
log_facility => $syslog_log_facility,
database_idle_timeout => $idle_timeout,
database_max_pool_size => $max_pool_size,
database_max_retries => $max_retries,
database_max_overflow => $max_overflow,
show_image_direct_url => $show_image_direct_url,
show_multiple_locations => $show_multiple_locations,
pipeline => $pipeline,
stores => $known_stores,
os_region_name => $region,
delayed_delete => false,
scrub_time => '43200',
image_cache_stall_time => '86400',
image_cache_max_size => $glance_image_cache_max_size,
}

class { '::glance::glare::logging':
Expand Down
49 changes: 37 additions & 12 deletions tests/noop/spec/hosts/glance/glance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,17 @@
end

if storage_config && storage_config.has_key?('images_ceph') && storage_config['images_ceph']
if glance_config && glance_config.has_key?('show_image_direct_url')
show_image_direct_url = glance_config['show_image_direct_url']
else
show_image_direct_url = true
if glance_config
if glance_config.has_key?('show_image_direct_url')
show_image_direct_url = glance_config['show_image_direct_url']
else
show_image_direct_url = true
if glance_config.has_key?('show_multiple_locations')
show_multiple_locations = glance_config['show_multiple_locations']
else
show_multiple_locations = true
end

if ironic_enabled
it 'should declare swift backend' do
should contain_class('glance::backend::swift').with(:glare_enabled => true)
Expand All @@ -252,11 +258,19 @@
it 'should configure show_image_direct_url' do
should contain_glance_api_config('DEFAULT/show_image_direct_url').with_value(show_image_direct_url)
end
it 'should configure show_multiple_locations' do
should contain_glance_api_config('DEFAULT/show_multiple_locations').with_value(show_multiple_locations)
end
elsif storage_config && storage_config.has_key?('images_vcenter') && storage_config['images_vcenter']
if glance_config && glance_config.has_key?('show_image_direct_url')
show_image_direct_url = glance_config['show_image_direct_url']
else
show_image_direct_url = true
if glance_config
if glance_config.has_key?('show_image_direct_url')
show_image_direct_url = glance_config['show_image_direct_url']
else
show_image_direct_url = true
if glance_config.has_key?('show_multiple_locations')
show_multiple_locations = glance_config['show_multiple_locations']
else
show_multiple_locations = true
end
let :params do { :glance_backend => 'vmware', } end
it 'should declare vmware backend' do
Expand Down Expand Up @@ -313,11 +327,19 @@
it 'should configure show_image_direct_url' do
should contain_glance_api_config('DEFAULT/show_image_direct_url').with_value(show_image_direct_url)
end
it 'should configure show_multiple_locations' do
should contain_glance_api_config('DEFAULT/show_multiple_locations').with_value(show_multiple_locations)
end
else
if glance_config && glance_config.has_key?('show_image_direct_url')
show_image_direct_url = glance_config['show_image_direct_url']
else
show_image_direct_url = false
if glance_config
if glance_config.has_key?('show_image_direct_url')
show_image_direct_url = glance_config['show_image_direct_url']
else
show_image_direct_url = false
if glance_config.has_key?('show_multiple_locations')
show_multiple_locations = glance_config['show_multiple_locations']
else
show_multiple_locations = false
end
let :params do { :glance_backend => 'swift', } end
it 'should declare swift backend' do
Expand All @@ -330,6 +352,9 @@
it 'should configure show_image_direct_url' do
should contain_glance_api_config('DEFAULT/show_image_direct_url').with_value(show_image_direct_url)
end
it 'should configure show_multiple_locations' do
should contain_glance_api_config('DEFAULT/show_multiple_locations').with_value(show_multiple_locations)
end
end

it 'should contain oslo_messaging_notifications "driver" option' do
Expand Down

0 comments on commit 220566b

Please sign in to comment.