@@ -38,16 +38,16 @@ node default {
|
||||
}
|
||||
|
||||
class role_glance_sqlite {
|
||||
|
||||
class { 'glance::api':
|
||||
log_verbose => 'True',
|
||||
log_debug => 'True',
|
||||
swift_store_user => 'foo_user',
|
||||
swift_store_key => 'foo_pass',
|
||||
auth_type => 'keystone',
|
||||
keystone_tenant => 'service',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => 'glance_password',
|
||||
}
|
||||
class { 'glance::backend::file': }
|
||||
|
||||
class { 'glance::registry':
|
||||
log_verbose => 'True',
|
||||
|
86
ext/glance.rb
Normal file
86
ext/glance.rb
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# test that we can upload and download files
|
||||
#
|
||||
require 'open3'
|
||||
require 'fileutils'
|
||||
|
||||
keystone_public = '127.0.0.1'
|
||||
image_dir='/tmp/images'
|
||||
|
||||
ENV['OS_USERNAME']='admin'
|
||||
ENV['OS_TENANT_NAME']='openstack'
|
||||
ENV['OS_PASSWORD']='ChangeMe'
|
||||
ENV['OS_AUTH_URL']='http://127.0.0.1:5000/v2.0/'
|
||||
ENV['OS_REGION_NAME']='RegionOne'
|
||||
|
||||
FileUtils.mkdir_p(image_dir)
|
||||
Dir.chdir(image_dir) do |dir|
|
||||
|
||||
kernel_id = nil
|
||||
initrd_id = nil
|
||||
|
||||
remote_image_url='http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz; tar -zxvf ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz'
|
||||
|
||||
wget_command = "wget #{remote_image_url}"
|
||||
|
||||
Open3.popen3(wget_command) do |stdin, stdout, stderr|
|
||||
puts "wget stdout: #{stdout.read}"
|
||||
puts "wget stderr: #{stderr.read}"
|
||||
end
|
||||
|
||||
add_kernel='disk_format=aki container_format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz'
|
||||
kernel_name='tty-linux-kernel'
|
||||
kernel_format='aki'
|
||||
|
||||
add_kernel_command="glance add name='#{kernel_name}' disk_format='#{kernel_format}' container_format=#{kernel_format} < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz"
|
||||
|
||||
Open3.popen3(add_kernel_command) do |stdin, stdout, stderr|
|
||||
stdout = stdout.read.split("\n")
|
||||
stdout.each do |line|
|
||||
if line =~ /Added new image with ID: (\w+)/
|
||||
kernel_id = $1
|
||||
end
|
||||
end
|
||||
puts stderr.read
|
||||
puts stdout
|
||||
end
|
||||
|
||||
raise(Exception, 'Did not add kernel successfully') unless kernel_id
|
||||
|
||||
initrd_id = nil
|
||||
add_initrd_command="glance add name='tty-linux-ramdisk' disk_format=ari container_format=ari < ttylinux-uec-amd64-12.1_2.6.35-22_1-loader"
|
||||
|
||||
Open3.popen3(add_initrd_command) do |stdin, stdout, stderr|
|
||||
stdout = stdout.read.split("\n")
|
||||
stdout.each do |line|
|
||||
if line =~ /Added new image with ID: (\w+)/
|
||||
initrd_id = $1
|
||||
end
|
||||
end
|
||||
puts stderr.read
|
||||
puts stdout
|
||||
end
|
||||
|
||||
raise(Exception, 'Did not add initrd successfully') unless initrd_id
|
||||
|
||||
add_image_command="glance add name='tty-linux' disk_format=ami container_format=ami kernel_id=#{kernel_id} ramdisk_id=#{initrd_id} < ttylinux-uec-amd64-12.1_2.6.35-22_1.img"
|
||||
|
||||
Open3.popen3(add_image_command) do |stdin, stdout, stderr|
|
||||
stdout = stdout.read.split("\n")
|
||||
stdout.each do |line|
|
||||
if line =~ /Added new image with ID: (\w+)/
|
||||
kernel_id = $1
|
||||
end
|
||||
end
|
||||
puts stderr.read
|
||||
puts stdout
|
||||
end
|
||||
|
||||
get_index='glance index'
|
||||
|
||||
Open3.popen3(get_index) do |stdin, stdout, stderr|
|
||||
puts stdout.read
|
||||
puts stderr.read
|
||||
end
|
||||
end
|
@@ -28,50 +28,30 @@
|
||||
# $log_file - The path of file used for logging
|
||||
# Optional. Default: /var/log/glance/api.log
|
||||
#
|
||||
# $filesystem_store_datadir - Location where dist images are stored when
|
||||
# default_store == file.
|
||||
# Optional. Default: /var/lib/glance/images/
|
||||
#
|
||||
# $swift_store_auth_address - Optional. Default: '127.0.0.1:8080/v1.0/',
|
||||
#
|
||||
# $swift_store_user - Optional. Default:'jdoe',
|
||||
#
|
||||
# $swift_store_key - Optional. Default: 'a86850deb2742ec3cb41518e26aa2d89',
|
||||
#
|
||||
# $swift_store_container - 'glance',
|
||||
#
|
||||
# $swift_store_create_container_on_put - 'False'
|
||||
#
|
||||
class glance::api(
|
||||
$log_verbose = 'False',
|
||||
$log_debug = 'False',
|
||||
$default_store = 'file',
|
||||
$bind_host = '0.0.0.0',
|
||||
$bind_port = '9292',
|
||||
$backlog = '4096',
|
||||
$workers = '0',
|
||||
$log_file = '/var/log/glance/api.log',
|
||||
$registry_host = '0.0.0.0',
|
||||
$registry_port = '9191',
|
||||
$log_file = '/var/log/glance/api.log',
|
||||
$filesystem_store_datadir = '/var/lib/glance/images/',
|
||||
$swift_store_auth_address = '127.0.0.1:8080/v1.0/',
|
||||
$swift_store_user = 'jdoe',
|
||||
$swift_store_key = 'a86850deb2742ec3cb41518e26aa2d89',
|
||||
$swift_store_container = 'glance',
|
||||
$swift_store_create_container_on_put = 'False',
|
||||
$auth_type = 'keystone',
|
||||
$service_protocol = 'http',
|
||||
$service_host = '127.0.0.1',
|
||||
$service_port = '5000',
|
||||
$auth_host = '127.0.0.1',
|
||||
$auth_port = '35357',
|
||||
$auth_protocol = 'http',
|
||||
$auth_uri = "http://127.0.0.1:5000/",
|
||||
$admin_token = '999888777666',
|
||||
# TODO - I should update this to use a glance specific keystone user
|
||||
$keystone_tenant = 'admin',
|
||||
$keystone_user = 'admin',
|
||||
$keystone_password = 'ChangeMe'
|
||||
) inherits glance {
|
||||
|
||||
include 'concat::setup'
|
||||
|
||||
# TODO I need to work with Chris to ensure that I understand
|
||||
# his auth requirements
|
||||
if($auth_type == 'keystone') {
|
||||
@@ -89,10 +69,34 @@ class glance::api(
|
||||
require => Class['glance'],
|
||||
}
|
||||
|
||||
file { '/etc/glance/glance-api.conf':
|
||||
content => template('glance/glance-api.conf.erb'),
|
||||
concat { '/etc/glance/glance-api.conf':
|
||||
owner => 'glance',
|
||||
group => 'root',
|
||||
mode => 640,
|
||||
require => Class['glance']
|
||||
}
|
||||
|
||||
glance::api::config { 'header':
|
||||
config => {
|
||||
'log_verbose' => $log_verbose,
|
||||
'log_debug' => $log_debug,
|
||||
'bind_host' => $bind_host,
|
||||
'bind_port' => $bind_port,
|
||||
'log_file' => $log_file,
|
||||
'backlog' => $backlog,
|
||||
'workers' => $workers,
|
||||
'registry_host' => $registry_host,
|
||||
'registry_port' => $registry_port
|
||||
},
|
||||
order => '01',
|
||||
}
|
||||
|
||||
glance::api::config { 'footer':
|
||||
config => {
|
||||
'auth_type' => $auth_type
|
||||
},
|
||||
order => '99'
|
||||
}
|
||||
file { '/etc/glance/glance-api-paste.ini':
|
||||
content => template('glance/glance-api-paste.ini.erb'),
|
||||
}
|
||||
@@ -107,7 +111,6 @@ class glance::api(
|
||||
enable => true,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
subscribe => File['/etc/glance/glance-api.conf'],
|
||||
require => Class['glance']
|
||||
subscribe => Concat['/etc/glance/glance-api.conf'],
|
||||
}
|
||||
}
|
||||
|
20
manifests/api/config.pp
Normal file
20
manifests/api/config.pp
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Can be used to specify configuration
|
||||
# sections in glance-api.conf
|
||||
#
|
||||
# It will assume that the config
|
||||
#
|
||||
#
|
||||
define glance::api::config(
|
||||
$config = {},
|
||||
$file_name = regsubst($name, ':', '_', 'G'),
|
||||
$content = template("glance/api/${name}.erb"),
|
||||
$order = undef
|
||||
) {
|
||||
concat::fragment { "glance-api-${name}":
|
||||
target => '/etc/glance/glance-api.conf',
|
||||
content => $content,
|
||||
order => $order,
|
||||
}
|
||||
}
|
||||
|
15
manifests/backend.pp
Normal file
15
manifests/backend.pp
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# used to model the line in the file
|
||||
# that configures which storage backend
|
||||
# to use
|
||||
#
|
||||
class glance::backend(
|
||||
$default_store
|
||||
) {
|
||||
glance::api::config { 'backend':
|
||||
config => {
|
||||
'default_store' => $default_store
|
||||
},
|
||||
order => '02',
|
||||
}
|
||||
}
|
23
manifests/backend/file.pp
Normal file
23
manifests/backend/file.pp
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# used to configure file backends for glance
|
||||
#
|
||||
# $filesystem_store_datadir - Location where dist images are stored when
|
||||
# default_store == file.
|
||||
# Optional. Default: /var/lib/glance/images/
|
||||
class glance::backend::file(
|
||||
$filesystem_store_datadir = '/var/lib/glance/images/'
|
||||
) inherits glance::api {
|
||||
|
||||
# set file as default store
|
||||
class { 'glance::backend':
|
||||
default_store => 'file',
|
||||
}
|
||||
|
||||
# configure directory where files should be stored
|
||||
glance::api::config { 'file':
|
||||
config => {
|
||||
'filesystem_store_datadir' => $filesystem_store_datadir
|
||||
},
|
||||
order => '05',
|
||||
}
|
||||
}
|
40
manifests/backend/swift.pp
Normal file
40
manifests/backend/swift.pp
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# configures the storage backend for glance
|
||||
# as a swift instance
|
||||
#
|
||||
# $swift_store_auth_address - Optional. Default: '127.0.0.1:8080/v1.0/',
|
||||
#
|
||||
# $swift_store_user - Optional. Default:'jdoe',
|
||||
#
|
||||
# $swift_store_key - Optional. Default: 'a86850deb2742ec3cb41518e26aa2d89',
|
||||
#
|
||||
# $swift_store_container - 'glance',
|
||||
#
|
||||
# $swift_store_create_container_on_put - 'False'
|
||||
class glance::backend::swift(
|
||||
$swift_store_user,
|
||||
$swift_store_key,
|
||||
$swift_store_auth_address = '127.0.0.1:8080/v1.0/',
|
||||
$swift_store_container = 'glance',
|
||||
$swift_store_create_container_on_put = 'False',
|
||||
) inherits glance::api {
|
||||
|
||||
# specify swift as backend
|
||||
class { 'glance::backend':
|
||||
default_store => 'swift',
|
||||
}
|
||||
|
||||
glance::api::config { 'swift':
|
||||
config => {
|
||||
'swift_store_user' => $swift_store_user,
|
||||
'swift_store_key' => $swift_store_key,
|
||||
'swift_store_auth_address' => $swift_store_auth_address,
|
||||
'swift_store_container' => $swift_store_container,
|
||||
'swift_store_create_container_on_put' => $swift_store_create_container_on_put
|
||||
},
|
||||
order => '05',
|
||||
# this just needs to configure a section
|
||||
# in glance-api.conf
|
||||
}
|
||||
|
||||
}
|
15
manifests/notify.pp
Normal file
15
manifests/notify.pp
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# used to model the line in the file
|
||||
# that configures which storage backend
|
||||
# to use
|
||||
#
|
||||
class glance::notify(
|
||||
$notifier_strategy
|
||||
) {
|
||||
glance::api::config { 'notify':
|
||||
config => {
|
||||
'notifier_strategy' => $notifier_strategy,
|
||||
},
|
||||
order => '06',
|
||||
}
|
||||
}
|
16
manifests/notify/qpid.pp
Normal file
16
manifests/notify/qpid.pp
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# used to configure qpid notifications for glance
|
||||
#
|
||||
class glance::notify::qpid(
|
||||
) inherits glance::api {
|
||||
|
||||
class { 'glance::notify':
|
||||
notifier_strategy => 'qpid',
|
||||
}
|
||||
|
||||
glance::api::config { 'qpid':
|
||||
config => {
|
||||
},
|
||||
order => '07',
|
||||
}
|
||||
}
|
17
manifests/notify/rabbitmq.pp
Normal file
17
manifests/notify/rabbitmq.pp
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# used to configure qpid notifications for glance
|
||||
#
|
||||
class glance::notify::rabbitmq(
|
||||
# TODO be able to pass in rabbitmq params
|
||||
) inherits glance::api {
|
||||
|
||||
class { 'glance::notify':
|
||||
notifier_strategy => 'rabbit',
|
||||
}
|
||||
|
||||
glance::api::config { 'rabbitmq':
|
||||
config => {
|
||||
},
|
||||
order => '07',
|
||||
}
|
||||
}
|
@@ -7,9 +7,6 @@ class glance::registry(
|
||||
$sql_connection = 'sqlite:///var/lib/glance/glance.sqlite',
|
||||
$sql_idle_timeout = '3600',
|
||||
$auth_type = 'keystone',
|
||||
$service_protocol = 'http',
|
||||
$service_host = '127.0.0.1',
|
||||
$service_port = '5000',
|
||||
$auth_host = '127.0.0.1',
|
||||
$auth_port = '35357',
|
||||
$auth_protocol = 'http',
|
||||
|
@@ -10,39 +10,27 @@ describe 'glance::api' do
|
||||
|
||||
let :default_params do
|
||||
{
|
||||
:log_verbose => 'false',
|
||||
:log_debug => 'false',
|
||||
:default_store => 'file',
|
||||
:bind_host => '0.0.0.0',
|
||||
:bind_port => '9292',
|
||||
:log_verbose => 'False',
|
||||
:log_debug => 'False',
|
||||
:bind_host => '0.0.0.0',
|
||||
:bind_port => '9292',
|
||||
:registry_host => '0.0.0.0',
|
||||
:registry_port => '9191',
|
||||
:log_file => '/var/log/glance/api.log',
|
||||
:filesystem_store_datadir => '/var/lib/glance/images/',
|
||||
:swift_store_auth_address => '127.0.0.1:8080/v1.0/',
|
||||
:swift_store_user => 'jdoe',
|
||||
:swift_store_key => 'a86850deb2742ec3cb41518e26aa2d89',
|
||||
:swift_store_container => 'glance',
|
||||
:swift_store_create_container_on_put => 'False'
|
||||
:log_file => '/var/log/glance/api.log',
|
||||
:auth_type => 'keystone'
|
||||
}
|
||||
end
|
||||
|
||||
[{},
|
||||
{
|
||||
:log_verbose => 'true',
|
||||
:log_debug => 'true',
|
||||
:default_store => 'file',
|
||||
:bind_host => '127.0.0.1',
|
||||
:bind_port => '9222',
|
||||
:log_verbose => 'true',
|
||||
:log_debug => 'true',
|
||||
:bind_host => '127.0.0.1',
|
||||
:bind_port => '9222',
|
||||
:registry_host => '127.0.0.1',
|
||||
:registry_port => '9111',
|
||||
:log_file => '/var/log/glance-api.log',
|
||||
:filesystem_store_datadir => '/var/lib/glance-images/',
|
||||
:swift_store_auth_address => '127.0.0.1:8080/v1.1/',
|
||||
:swift_store_user => 'dan',
|
||||
:swift_store_key => 'a',
|
||||
:swift_store_container => 'other',
|
||||
:swift_store_create_container_on_put => 'True'
|
||||
:log_file => '/var/log/glance-api.log',
|
||||
:auth_type => 'not_keystone'
|
||||
}
|
||||
].each do |param_set|
|
||||
|
||||
@@ -58,32 +46,36 @@ describe 'glance::api' do
|
||||
|
||||
it { should contain_class 'glance' }
|
||||
|
||||
it do should contain_service('glance-api').with(
|
||||
it { should contain_service('glance-api').with(
|
||||
'ensure' => 'running',
|
||||
'hasstatus' => 'true',
|
||||
'hasrestart' => 'true',
|
||||
'subscribe' => 'File[/etc/glance/glance-api.conf]'
|
||||
) end
|
||||
'subscribe' => 'Concat[/etc/glance/glance-api.conf]'
|
||||
) }
|
||||
|
||||
it 'should compile the template based on the class parameters' do
|
||||
content = param_value(subject, 'file', '/etc/glance/glance-api.conf', 'content')
|
||||
expected_lines = [
|
||||
"verbose = #{param_hash[:log_verbose]}",
|
||||
"debug = #{param_hash[:log_debug]}",
|
||||
"default_store = #{param_hash[:default_store]}",
|
||||
"bind_host = #{param_hash[:bind_host]}",
|
||||
"bind_port = #{param_hash[:bind_port]}",
|
||||
"registry_host = #{param_hash[:registry_host]}",
|
||||
"registry_port = #{param_hash[:registry_port]}",
|
||||
"log_file = #{param_hash[:log_file]}",
|
||||
"filesystem_store_datadir = #{param_hash[:filesystem_store_datadir]}",
|
||||
"swift_store_auth_address = #{param_hash[:swift_store_auth_address]}",
|
||||
"swift_store_user = #{param_hash[:swift_store_user]}",
|
||||
"swift_store_key = #{param_hash[:swift_store_key]}",
|
||||
"swift_store_container = #{param_hash[:swift_store_container]}",
|
||||
"swift_store_create_container_on_put = #{param_hash[:swift_store_create_container_on_put]}"
|
||||
]
|
||||
(content.split("\n") & expected_lines).should == expected_lines
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/01_header',
|
||||
[
|
||||
"verbose = #{param_hash[:log_verbose]}",
|
||||
"debug = #{param_hash[:log_debug]}",
|
||||
"bind_host = #{param_hash[:bind_host]}",
|
||||
"bind_port = #{param_hash[:bind_port]}",
|
||||
"log_file = #{param_hash[:log_file]}",
|
||||
"registry_host = #{param_hash[:registry_host]}",
|
||||
"registry_port = #{param_hash[:registry_port]}",
|
||||
]
|
||||
)
|
||||
end
|
||||
it 'should add paste deploy footers' do
|
||||
expected_lines = ['[paste_deploy]', 'flavor = keystone'] if params[:auth_type] = 'keystone'
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/99_footer',
|
||||
expected_lines
|
||||
)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
38
spec/classes/glance_backend_file_spec.rb
Normal file
38
spec/classes/glance_backend_file_spec.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'glance::backend::file' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian'
|
||||
}
|
||||
end
|
||||
it 'should set the default store to file' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/02_backend',
|
||||
['default_store = file']
|
||||
)
|
||||
end
|
||||
it 'should configure file backend settings' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/05_file',
|
||||
['filesystem_store_datadir = /var/lib/glance/images/']
|
||||
)
|
||||
end
|
||||
describe 'when datadir is overridden' do
|
||||
let :params do
|
||||
{
|
||||
:filesystem_store_datadir => '/var/lib/glance/images2'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should configure file backend settings with specified parameter' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/05_file',
|
||||
['filesystem_store_datadir = /var/lib/glance/images2']
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
60
spec/classes/glance_backend_swift_spec.rb
Normal file
60
spec/classes/glance_backend_swift_spec.rb
Normal file
@@ -0,0 +1,60 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'glance::backend::swift' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian'
|
||||
}
|
||||
end
|
||||
let :params do
|
||||
{
|
||||
'swift_store_user' => 'glance',
|
||||
'swift_store_key' => 'glance_key'
|
||||
}
|
||||
end
|
||||
it 'should set the default store to file' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/02_backend',
|
||||
['default_store = swift']
|
||||
)
|
||||
end
|
||||
it 'should configure swift settings with defaults' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/05_swift',
|
||||
[
|
||||
'swift_store_auth_address = 127.0.0.1:8080/v1.0/',
|
||||
'swift_store_user = glance',
|
||||
'swift_store_key = glance_key',
|
||||
'swift_store_container = glance',
|
||||
'swift_store_create_container_on_put = False'
|
||||
]
|
||||
)
|
||||
end
|
||||
describe 'when datadir is overridden' do
|
||||
let :params do
|
||||
{
|
||||
'swift_store_user' => 'glance',
|
||||
'swift_store_key' => 'glance_key',
|
||||
'swift_store_container' => 'glance2',
|
||||
'swift_store_auth_address' => '127.0.0.1:8080/v2.0/',
|
||||
'swift_store_create_container_on_put' => 'True'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should configure file backend settings with specified parameter' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/05_swift',
|
||||
[
|
||||
'swift_store_auth_address = 127.0.0.1:8080/v2.0/',
|
||||
'swift_store_user = glance',
|
||||
'swift_store_key = glance_key',
|
||||
'swift_store_container = glance2',
|
||||
'swift_store_create_container_on_put = True'
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
24
spec/classes/glance_notify_qpid_spec.rb
Normal file
24
spec/classes/glance_notify_qpid_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'spec_helper'
|
||||
describe 'glance::notify::qpid' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian'
|
||||
}
|
||||
end
|
||||
describe 'with default parameters' do
|
||||
it 'should set nofier strategy to qpid' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/06_notify',
|
||||
['notifier_strategy = qpid']
|
||||
)
|
||||
end
|
||||
it 'should use the current qpid template' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/07_qpid',
|
||||
['#qpid_port = 5672']
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
24
spec/classes/glance_notify_rabbitmq_spec.rb
Normal file
24
spec/classes/glance_notify_rabbitmq_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'spec_helper'
|
||||
describe 'glance::notify::rabbitmq' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian'
|
||||
}
|
||||
end
|
||||
describe 'with default parameters' do
|
||||
it 'should set nofier strategy to rabbit' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/06_notify',
|
||||
['notifier_strategy = rabbit']
|
||||
)
|
||||
end
|
||||
it 'should use the current rabbitmq template' do
|
||||
verify_contents(
|
||||
subject,
|
||||
'/var/lib/puppet/concat/_etc_glance_glance-api.conf/fragments/07_rabbitmq',
|
||||
['#rabbit_port = 5672']
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
@@ -10,12 +10,12 @@ describe 'glance::registry' do
|
||||
|
||||
let :default_params do
|
||||
{
|
||||
:log_verbose => 'false',
|
||||
:log_debug => 'false',
|
||||
:bind_host => '0.0.0.0',
|
||||
:bind_port => '9191',
|
||||
:log_file => '/var/log/glance/registry.log',
|
||||
:sql_connection => 'sqlite:///var/lib/glance/glance.sqlite',
|
||||
:log_verbose => 'False',
|
||||
:log_debug => 'False',
|
||||
:bind_host => '0.0.0.0',
|
||||
:bind_port => '9191',
|
||||
:log_file => '/var/log/glance/registry.log',
|
||||
:sql_connection => 'sqlite:///var/lib/glance/glance.sqlite',
|
||||
:sql_idle_timeout => '3600'
|
||||
}
|
||||
end
|
||||
|
0
spec/fixtures/manifests/site.pp
vendored
Normal file
0
spec/fixtures/manifests/site.pp
vendored
Normal file
@@ -6,6 +6,12 @@ def param_value(subject, type, title, param)
|
||||
subject.resource(type, title).send(:parameters)[param.to_sym]
|
||||
end
|
||||
|
||||
def verify_contents(subject, title, expected_lines)
|
||||
content = subject.resource('file', title).send(:parameters)[:content]
|
||||
(content.split("\n") & expected_lines).should == expected_lines
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests'))
|
||||
c.module_path = File.join(File.dirname(__FILE__), '../../')
|
||||
end
|
||||
|
5
templates/api/backend.erb
Normal file
5
templates/api/backend.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
# Which backend store should Glance use by default is not specified
|
||||
# in a request to add a new image to Glance? Default: 'file'
|
||||
# Available choices are 'file', 'swift', and 's3'
|
||||
# ================= Storage Backend ============================
|
||||
default_store = <%= config['default_store'] %>
|
5
templates/api/file.erb
Normal file
5
templates/api/file.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
# ============ Filesystem Store Options ========================
|
||||
|
||||
# Directory that the Filesystem backend store
|
||||
# writes image data to
|
||||
filesystem_store_datadir = <%= config['filesystem_store_datadir'] %>
|
21
templates/api/footer.erb
Normal file
21
templates/api/footer.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
# ============ Delayed Delete Options =============================
|
||||
|
||||
# Turn on/off delayed delete
|
||||
delayed_delete = False
|
||||
|
||||
# Delayed delete time in seconds
|
||||
scrub_time = 43200
|
||||
|
||||
# Directory that the scrubber will use to remind itself of what to delete
|
||||
# Make sure this is also set in glance-scrubber.conf
|
||||
scrubber_datadir = /var/lib/glance/scrubber
|
||||
|
||||
# =============== Image Cache Options =============================
|
||||
|
||||
# Base directory that the Image Cache uses
|
||||
image_cache_dir = /var/lib/glance/image-cache/
|
||||
|
||||
<% if config['auth_type'] == 'keystone' -%>
|
||||
[paste_deploy]
|
||||
flavor = keystone
|
||||
<% end -%>
|
82
templates/api/header.erb
Normal file
82
templates/api/header.erb
Normal file
@@ -0,0 +1,82 @@
|
||||
[DEFAULT]
|
||||
# Show more verbose log output (sets INFO log level output)
|
||||
verbose = <%= config['log_verbose'] %>
|
||||
|
||||
# Show debugging output in logs (sets DEBUG log level output)
|
||||
debug = <%= config['log_debug'] %>
|
||||
|
||||
# Address to bind the API server
|
||||
bind_host = <%= config['bind_host'] %>
|
||||
|
||||
# Port the bind the API server to
|
||||
bind_port = <%= config['bind_port'] %>
|
||||
|
||||
|
||||
# Log to this file. Make sure you do not set the same log
|
||||
# file for both the API and registry servers!
|
||||
log_file = <%= config['log_file'] %>
|
||||
|
||||
# Backlog requests when creating socket
|
||||
backlog = <%= config['backlog'] %>
|
||||
# Backlog requests when creating socket
|
||||
|
||||
# Number of Glance API worker processes to start.
|
||||
# On machines with more than one CPU increasing this value
|
||||
# may improve performance (especially if using SSL with
|
||||
# compression turned on). It is typically recommended to set
|
||||
# this value to the number of CPUs present on your machine.
|
||||
workers = <%= config['workers'] %>
|
||||
|
||||
# Role used to identify an authenticated user as administrator
|
||||
#admin_role = admin
|
||||
|
||||
# ================= Syslog Options ============================
|
||||
|
||||
# Send logs to syslog (/dev/log) instead of to file specified
|
||||
# by `log_file`
|
||||
use_syslog = False
|
||||
|
||||
# Facility to use. If unset defaults to LOG_USER.
|
||||
# syslog_log_facility = LOG_LOCAL0
|
||||
|
||||
# ================= SSL Options ===============================
|
||||
|
||||
# Certificate file to use when starting API server securely
|
||||
# cert_file = /path/to/certfile
|
||||
|
||||
# Private key file to use when starting API server securely
|
||||
# key_file = /path/to/keyfile
|
||||
|
||||
# ================= Security Options ==========================
|
||||
|
||||
# AES key for encrypting store 'location' metadata, including
|
||||
# -- if used -- Swift or S3 credentials
|
||||
# Should be set to a random string of length 16, 24 or 32 bytes
|
||||
# metadata_encryption_key = <16, 24 or 32 char registry metadata key>
|
||||
|
||||
# ============ Registry Options ===============================
|
||||
|
||||
# Address to find the registry server
|
||||
registry_host = <%= config['registry_host'] %>
|
||||
|
||||
# Port the registry server is listening on
|
||||
registry_port = <%= config['registry_port'] %>
|
||||
|
||||
# What protocol to use when connecting to the registry server?
|
||||
# Set to https for secure HTTP communication
|
||||
registry_client_protocol = http
|
||||
|
||||
# The path to the key file to use in SSL connections to the
|
||||
# registry server, if any. Alternately, you may set the
|
||||
# GLANCE_CLIENT_KEY_FILE environ variable to a filepath of the key file
|
||||
# registry_client_key_file = /path/to/key/file
|
||||
|
||||
# The path to the cert file to use in SSL connections to the
|
||||
# registry server, if any. Alternately, you may set the
|
||||
# GLANCE_CLIENT_CERT_FILE environ variable to a filepath of the cert file
|
||||
# registry_client_cert_file = /path/to/cert/file
|
||||
|
||||
# The path to the certifying authority cert file to use in SSL connections
|
||||
# to the registry server, if any. Alternately, you may set the
|
||||
# GLANCE_CLIENT_CA_FILE environ variable to a filepath of the CA cert file
|
||||
# registry_client_ca_file = /path/to/ca/file
|
7
templates/api/notify.erb
Normal file
7
templates/api/notify.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
# ============ Notification System Options =====================
|
||||
|
||||
# Notifications can be sent when images are create, updated or deleted.
|
||||
# There are three methods of sending notifications, logging (via the
|
||||
# log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid
|
||||
# message queue), or noop (no notifications sent, the default)
|
||||
notifier_strategy = <%= config['notifier_strategy'] %>
|
18
templates/api/qpid.erb
Normal file
18
templates/api/qpid.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
# Configuration options if sending notifications via Qpid (these are
|
||||
# the defaults)
|
||||
#qpid_notification_exchange = glance
|
||||
#qpid_notification_topic = glance_notifications
|
||||
#qpid_host = localhost
|
||||
#qpid_port = 5672
|
||||
#qpid_username =
|
||||
#qpid_password =
|
||||
#qpid_sasl_mechanisms =
|
||||
#qpid_reconnect_timeout = 0
|
||||
#qpid_reconnect_limit = 0
|
||||
#qpid_reconnect_interval_min = 0
|
||||
#qpid_reconnect_interval_max = 0
|
||||
#qpid_reconnect_interval = 0
|
||||
#qpid_heartbeat = 5
|
||||
# Set to 'ssl' to enable SSL
|
||||
#qpid_protocol = tcp
|
||||
#qpid_tcp_nodelay = True
|
10
templates/api/rabbitmq.erb
Normal file
10
templates/api/rabbitmq.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
# Configuration options if sending notifications via rabbitmq (these are
|
||||
# the defaults)
|
||||
#rabbit_host = localhost
|
||||
#rabbit_port = 5672
|
||||
#rabbit_use_ssl = false
|
||||
#rabbit_userid = guest
|
||||
#rabbit_password = guest
|
||||
#rabbit_virtual_host = /
|
||||
#rabbit_notification_exchange = glance
|
||||
#rabbit_notification_topic = glance_notifications
|
38
templates/api/swift.erb
Normal file
38
templates/api/swift.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
# ============ Swift Store Options =============================
|
||||
|
||||
# Address where the Swift authentication service lives
|
||||
swift_store_auth_address = <%= config['swift_store_auth_address'] %>
|
||||
|
||||
# User to authenticate against the Swift authentication service
|
||||
swift_store_user = <%= config['swift_store_user'] %>
|
||||
|
||||
# Auth key for the user authenticating against the
|
||||
# Swift authentication service
|
||||
swift_store_key = <%= config['swift_store_key'] %>
|
||||
|
||||
# Container within the account that the account should use
|
||||
# for storing images in Swift
|
||||
swift_store_container = <%= config['swift_store_container'] %>
|
||||
|
||||
# Do we create the container if it does not exist?
|
||||
swift_store_create_container_on_put = <%= config['swift_store_create_container_on_put'] %>
|
||||
|
||||
|
||||
# What size, in MB, should Glance start chunking image files
|
||||
# and do a large object manifest in Swift? By default, this is
|
||||
# the maximum object size in Swift, which is 5GB
|
||||
swift_store_large_object_size = 5120
|
||||
|
||||
# When doing a large object manifest, what size, in MB, should
|
||||
# Glance write chunks to Swift? This amount of data is written
|
||||
# to a temporary disk buffer during the process of chunking
|
||||
# the image file, and the default is 200MB
|
||||
swift_store_large_object_chunk_size = 200
|
||||
|
||||
# Whether to use ServiceNET to communicate with the Swift storage servers.
|
||||
# (If you aren't RACKSPACE, leave this False!)
|
||||
#
|
||||
# To use ServiceNET for authentication, prefix hostname of
|
||||
# `swift_store_auth_address` with 'snet-'.
|
||||
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
|
||||
swift_enable_snet = False
|
@@ -64,9 +64,6 @@ glance.filter_factory = glance.common.context:ContextMiddleware
|
||||
|
||||
[filter:authtoken]
|
||||
paste.filter_factory = keystone.middleware.auth_token:filter_factory
|
||||
service_protocol = <%= service_protocol %>
|
||||
service_host = <%= service_host %>
|
||||
service_port = <%= service_port %>
|
||||
auth_host = <%= auth_host %>
|
||||
auth_port = <%= auth_port %>
|
||||
auth_protocol = <%= auth_protocol %>
|
||||
|
@@ -1,240 +0,0 @@
|
||||
[DEFAULT]
|
||||
# Show more verbose log output (sets INFO log level output)
|
||||
verbose = <%= log_verbose %>
|
||||
|
||||
# Show debugging output in logs (sets DEBUG log level output)
|
||||
debug = <%= log_debug %>
|
||||
|
||||
# Which backend store should Glance use by default is not specified
|
||||
# in a request to add a new image to Glance? Default: 'file'
|
||||
# Available choices are 'file', 'swift', and 's3'
|
||||
default_store = <%= default_store %>
|
||||
|
||||
# Address to bind the API server
|
||||
bind_host = <%= bind_host %>
|
||||
|
||||
# Port the bind the API server to
|
||||
bind_port = <%= bind_port %>
|
||||
|
||||
# Log to this file. Make sure you do not set the same log
|
||||
# file for both the API and registry servers!
|
||||
log_file = <%= log_file %>
|
||||
|
||||
# Backlog requests when creating socket
|
||||
backlog = 4096
|
||||
|
||||
# Number of Glance API worker processes to start.
|
||||
# On machines with more than one CPU increasing this value
|
||||
# may improve performance (especially if using SSL with
|
||||
# compression turned on). It is typically recommended to set
|
||||
# this value to the number of CPUs present on your machine.
|
||||
workers = 0
|
||||
|
||||
# Role used to identify an authenticated user as administrator
|
||||
#admin_role = admin
|
||||
|
||||
# ================= Syslog Options ============================
|
||||
|
||||
# Send logs to syslog (/dev/log) instead of to file specified
|
||||
# by `log_file`
|
||||
use_syslog = False
|
||||
|
||||
# Facility to use. If unset defaults to LOG_USER.
|
||||
# syslog_log_facility = LOG_LOCAL0
|
||||
|
||||
# ================= SSL Options ===============================
|
||||
|
||||
# Certificate file to use when starting API server securely
|
||||
# cert_file = /path/to/certfile
|
||||
|
||||
# Private key file to use when starting API server securely
|
||||
# key_file = /path/to/keyfile
|
||||
|
||||
# ================= Security Options ==========================
|
||||
|
||||
# AES key for encrypting store 'location' metadata, including
|
||||
# -- if used -- Swift or S3 credentials
|
||||
# Should be set to a random string of length 16, 24 or 32 bytes
|
||||
# metadata_encryption_key = <16, 24 or 32 char registry metadata key>
|
||||
|
||||
# ============ Registry Options ===============================
|
||||
|
||||
# Address to find the registry server
|
||||
registry_host = <%= registry_host %>
|
||||
|
||||
# Port the registry server is listening on
|
||||
registry_port = <%= registry_port %>
|
||||
|
||||
# What protocol to use when connecting to the registry server?
|
||||
# Set to https for secure HTTP communication
|
||||
registry_client_protocol = http
|
||||
|
||||
# The path to the key file to use in SSL connections to the
|
||||
# registry server, if any. Alternately, you may set the
|
||||
# GLANCE_CLIENT_KEY_FILE environ variable to a filepath of the key file
|
||||
# registry_client_key_file = /path/to/key/file
|
||||
|
||||
# The path to the cert file to use in SSL connections to the
|
||||
# registry server, if any. Alternately, you may set the
|
||||
# GLANCE_CLIENT_CERT_FILE environ variable to a filepath of the cert file
|
||||
# registry_client_cert_file = /path/to/cert/file
|
||||
|
||||
# The path to the certifying authority cert file to use in SSL connections
|
||||
# to the registry server, if any. Alternately, you may set the
|
||||
# GLANCE_CLIENT_CA_FILE environ variable to a filepath of the CA cert file
|
||||
# registry_client_ca_file = /path/to/ca/file
|
||||
|
||||
# ============ Notification System Options =====================
|
||||
|
||||
# Notifications can be sent when images are create, updated or deleted.
|
||||
# There are three methods of sending notifications, logging (via the
|
||||
# log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid
|
||||
# message queue), or noop (no notifications sent, the default)
|
||||
notifier_strategy = noop
|
||||
|
||||
# TODO add event queue support
|
||||
# Configuration options if sending notifications via rabbitmq (these are
|
||||
# the defaults)
|
||||
#rabbit_host = localhost
|
||||
#rabbit_port = 5672
|
||||
#rabbit_use_ssl = false
|
||||
#rabbit_userid = guest
|
||||
#rabbit_password = guest
|
||||
#rabbit_virtual_host = /
|
||||
#rabbit_notification_exchange = glance
|
||||
#rabbit_notification_topic = glance_notifications
|
||||
|
||||
# Configuration options if sending notifications via Qpid (these are
|
||||
# the defaults)
|
||||
#qpid_notification_exchange = glance
|
||||
#qpid_notification_topic = glance_notifications
|
||||
#qpid_host = localhost
|
||||
#qpid_port = 5672
|
||||
#qpid_username =
|
||||
#qpid_password =
|
||||
#qpid_sasl_mechanisms =
|
||||
#qpid_reconnect_timeout = 0
|
||||
#qpid_reconnect_limit = 0
|
||||
#qpid_reconnect_interval_min = 0
|
||||
#qpid_reconnect_interval_max = 0
|
||||
#qpid_reconnect_interval = 0
|
||||
#qpid_heartbeat = 5
|
||||
# Set to 'ssl' to enable SSL
|
||||
#qpid_protocol = tcp
|
||||
#qpid_tcp_nodelay = True
|
||||
|
||||
|
||||
# ============ Filesystem Store Options ========================
|
||||
|
||||
# Directory that the Filesystem backend store
|
||||
# writes image data to
|
||||
filesystem_store_datadir = <%= filesystem_store_datadir %>
|
||||
|
||||
# ============ Swift Store Options =============================
|
||||
|
||||
# Address where the Swift authentication service lives
|
||||
swift_store_auth_address = <%= swift_store_auth_address %>
|
||||
|
||||
# User to authenticate against the Swift authentication service
|
||||
swift_store_user = <%= swift_store_user %>
|
||||
|
||||
# Auth key for the user authenticating against the
|
||||
# Swift authentication service
|
||||
swift_store_key = <%= swift_store_key %>
|
||||
|
||||
# Container within the account that the account should use
|
||||
# for storing images in Swift
|
||||
swift_store_container = <%= swift_store_container %>
|
||||
|
||||
# Do we create the container if it does not exist?
|
||||
swift_store_create_container_on_put = <%= swift_store_create_container_on_put %>
|
||||
|
||||
|
||||
# What size, in MB, should Glance start chunking image files
|
||||
# and do a large object manifest in Swift? By default, this is
|
||||
# the maximum object size in Swift, which is 5GB
|
||||
swift_store_large_object_size = 5120
|
||||
|
||||
# When doing a large object manifest, what size, in MB, should
|
||||
# Glance write chunks to Swift? This amount of data is written
|
||||
# to a temporary disk buffer during the process of chunking
|
||||
# the image file, and the default is 200MB
|
||||
swift_store_large_object_chunk_size = 200
|
||||
|
||||
# Whether to use ServiceNET to communicate with the Swift storage servers.
|
||||
# (If you aren't RACKSPACE, leave this False!)
|
||||
#
|
||||
# To use ServiceNET for authentication, prefix hostname of
|
||||
# `swift_store_auth_address` with 'snet-'.
|
||||
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
|
||||
swift_enable_snet = False
|
||||
|
||||
# ============ S3 Store Options =============================
|
||||
|
||||
# Address where the S3 authentication service lives
|
||||
# Valid schemes are 'http://' and 'https://'
|
||||
# If no scheme specified, default to 'http://'
|
||||
s3_store_host = 127.0.0.1:8080/v1.0/
|
||||
|
||||
# User to authenticate against the S3 authentication service
|
||||
s3_store_access_key = <20-char AWS access key>
|
||||
|
||||
# Auth key for the user authenticating against the
|
||||
# S3 authentication service
|
||||
s3_store_secret_key = <40-char AWS secret key>
|
||||
|
||||
# Container within the account that the account should use
|
||||
# for storing images in S3. Note that S3 has a flat namespace,
|
||||
# so you need a unique bucket name for your glance images. An
|
||||
# easy way to do this is append your AWS access key to "glance".
|
||||
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
|
||||
# your AWS access key if you use it in your bucket name below!
|
||||
s3_store_bucket = <lowercased 20-char aws access key>glance
|
||||
|
||||
# Do we create the bucket if it does not exist?
|
||||
s3_store_create_bucket_on_put = False
|
||||
|
||||
# When sending images to S3, the data will first be written to a
|
||||
# temporary buffer on disk. By default the platform's temporary directory
|
||||
# will be used. If required, an alternative directory can be specified here.
|
||||
# s3_store_object_buffer_dir = /path/to/dir
|
||||
|
||||
# ============ RBD Store Options =============================
|
||||
|
||||
# Ceph configuration file path
|
||||
# If using cephx authentication, this file should
|
||||
# include a reference to the right keyring
|
||||
# in a client.<USER> section
|
||||
rbd_store_ceph_conf = /etc/ceph/ceph.conf
|
||||
|
||||
# RADOS user to authenticate as (only applicable if using cephx)
|
||||
rbd_store_user = glance
|
||||
|
||||
# RADOS pool in which images are stored
|
||||
rbd_store_pool = images
|
||||
|
||||
# Images will be chunked into objects of this size (in megabytes).
|
||||
# For best performance, this should be a power of two
|
||||
rbd_store_chunk_size = 8
|
||||
|
||||
# ============ Delayed Delete Options =============================
|
||||
|
||||
# Turn on/off delayed delete
|
||||
delayed_delete = False
|
||||
|
||||
# Delayed delete time in seconds
|
||||
scrub_time = 43200
|
||||
|
||||
# Directory that the scrubber will use to remind itself of what to delete
|
||||
# Make sure this is also set in glance-scrubber.conf
|
||||
scrubber_datadir = /var/lib/glance/scrubber
|
||||
|
||||
# =============== Image Cache Options =============================
|
||||
|
||||
# Base directory that the Image Cache uses
|
||||
image_cache_dir = /var/lib/glance/image-cache/
|
||||
|
||||
<% if auth_type == 'keystone' -%>
|
||||
[paste_deploy]
|
||||
flavor = keystone
|
||||
<% end -%>
|
@@ -21,9 +21,6 @@ glance.filter_factory = glance.common.context:ContextMiddleware
|
||||
|
||||
[filter:authtoken]
|
||||
paste.filter_factory = keystone.middleware.auth_token:filter_factory
|
||||
service_protocol = <%= service_protocol %>
|
||||
service_host = <%= service_host %>
|
||||
service_port = <%= service_port %>
|
||||
auth_host = <%= auth_host %>
|
||||
auth_port = <%= auth_port %>
|
||||
auth_protocol = <%= auth_protocol %>
|
||||
|
Reference in New Issue
Block a user