Ability to auto generate the filesystem store metadata file
After this path has been merged : https://review.openstack.org/#/c/190265/ The compute service has the ability to copy the image data from the mountpoint directly which can save image download time. This patch make the metadata file can be generated automatically if user specify the id and mountpoint. Change-Id: Ibd4cc2d15a97f8018fc7f0aa19e4f2c9d1da285c
This commit is contained in:
parent
abc47a3bb5
commit
f707472c4c
|
@ -114,6 +114,8 @@ Attributes for the Image service are in the ['openstack']['image'] namespace.
|
|||
* `openstack['image']['service_role']` - User role used by glance when interacting with keystone - used in the API and registry paste.ini files
|
||||
* `openstack['image']['notification_driver']` - Notification driver, default noop.
|
||||
* `openstack['image']['filesystem_store_metadata_file']` - A path to a JSON file that contains metadata describing the storage system.
|
||||
* `openstack['image']['filesystem_store_metadata_id']` - The unique id for the filesystem store the images.
|
||||
* `openstack['image']['filesystem_store_metadata_mountpoint']` - The mount point for the filesystem store the images;
|
||||
* `openstack['image']['api']['workers']` - Set the number of glance api workers.
|
||||
* `openstack['image']['api']['show_image_direct_url']` - Allow glance to return URL referencing where data is stored on the backend. Default 'False'
|
||||
* `openstack['image']['api']['container_formats']` - Supported container formats for glance.
|
||||
|
|
|
@ -136,6 +136,18 @@ default['openstack']['image']['api']['stores'] = ['file', 'http']
|
|||
|
||||
default['openstack']['image']['filesystem_store_datadir'] = '/var/lib/glance/images'
|
||||
default['openstack']['image']['filesystem_store_metadata_file'] = nil
|
||||
|
||||
# The following two attributes are only available when filesystem_store_metadata_file is specified but
|
||||
# not exist
|
||||
|
||||
# An opaque string. In order for this module to know that the remote FS is the same one that is mounted
|
||||
# locally it must share information with the nova-compute deployment. Both glance and nova-compute must
|
||||
# be configured with an unqiue matching string. For example: '00000000-0000-0000-0000-000000000000'
|
||||
default['openstack']['image']['filesystem_store_metadata_id'] = nil
|
||||
# The location at which the file system is locally mounted. Nova-compute will directly access Glance images
|
||||
# from this local filesystem path. For example: '/mount/some_fs/images'
|
||||
default['openstack']['image']['filesystem_store_metadata_mountpoint'] = nil
|
||||
|
||||
default['openstack']['image']['api']['swift']['container'] = 'glance'
|
||||
default['openstack']['image']['api']['swift']['large_object_size'] = '200'
|
||||
default['openstack']['image']['api']['swift']['large_object_chunk_size'] = '200'
|
||||
|
|
|
@ -159,6 +159,16 @@ unless node['openstack']['image']['api']['vmware']['vmware_server_host'].empty?
|
|||
vmware_server_password = get_password 'token', node['openstack']['image']['api']['vmware']['secret_name']
|
||||
end
|
||||
|
||||
if glance['filesystem_store_metadata_file']
|
||||
template glance['filesystem_store_metadata_file'] do
|
||||
source 'glance-metadata.json.erb'
|
||||
owner glance['user']
|
||||
group glance['group']
|
||||
mode 00640
|
||||
not_if { ::File.exist?(glance['filesystem_store_metadata_file']) }
|
||||
end
|
||||
end
|
||||
|
||||
template '/etc/glance/glance-api.conf' do
|
||||
source 'glance-api.conf.erb'
|
||||
owner node['openstack']['image']['user']
|
||||
|
|
|
@ -608,5 +608,34 @@ describe 'openstack-image::api' do
|
|||
expect(cron.minute).to eq '01'
|
||||
expect(cron.hour).to eq '00'
|
||||
end
|
||||
|
||||
describe 'glance-metadata.json' do
|
||||
let(:file) { chef_run.template('/etc/glance/glance-metadata.json') }
|
||||
|
||||
it 'not to create glance-metadata.json by default' do
|
||||
expect(chef_run).not_to create_template('/etc/glance/glance-metadata.json')
|
||||
end
|
||||
|
||||
context 'create right glance-metadata.json file' do
|
||||
before do
|
||||
node.set['openstack']['image']['filesystem_store_metadata_file'] = '/etc/glance/glance-metadata.json'
|
||||
end
|
||||
|
||||
it 'create glance-metadata.json' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: 00640
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure id and mountpoint for image filesystem metadata' do
|
||||
%w(id mountpoint).each do |attr|
|
||||
node.set['openstack']['image']["filesystem_store_metadata_#{attr}"] = "metadata_#{attr}_value"
|
||||
expect(chef_run).to render_file(file.name).with_content(/"#{attr}": "metadata_#{attr}_value"/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<%= node["openstack"]["image"]["custom_template_banner"] %>
|
||||
|
||||
{
|
||||
"id": "<%= node['openstack']['image']['filesystem_store_metadata_id'] %>",
|
||||
"mountpoint": "<%= node['openstack']['image']['filesystem_store_metadata_mountpoint'] %>"
|
||||
}
|
Loading…
Reference in New Issue