initial commit for glance.

This code was contributed by Chris Blumentritt <cblument@gmail.com>
This commit is contained in:
Dan Bode 2011-06-14 17:55:48 -07:00
commit d30cd28ccf
10 changed files with 270 additions and 0 deletions

View File

@ -0,0 +1,32 @@
class glance::api(
$verbose = 'false',
$default_store = 'file',
$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'
) inherits glance {
file { "/etc/glance/glance-api.conf":
ensure => present,
owner => 'glance',
group => 'root',
mode => 640,
content => template('glance/glance-api.conf.erb'),
require => Class["glance"]
}
service { "glance-api":
ensure => running,
enable => true,
subscribe => File["/etc/glance/glance-api.conf"],
require => Class["glance"]
}
}

View File

@ -0,0 +1,10 @@
class glance {
file { '/etc/glance/':
ensure => directory,
owner => 'glance',
group => 'root',
mode => 770,
require => Package['glance']
}
package { 'glance': ensure => present }
}

View File

@ -0,0 +1,25 @@
class glance::registry(
$verbose = 'true',
$debug = 'true',
$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'
) inherits glance {
file { "/etc/glance/glance-registry.conf":
ensure => present,
owner => 'glance',
group => 'root',
mode => 640,
content => template('glance/glance-registry.conf.erb'),
require => Class["glance"]
}
service { "glance-registry":
ensure => running,
enable => true,
subscribe => File["/etc/glance/glance-registry.conf"],
require => Class["glance"]
}
}

View File

@ -0,0 +1,67 @@
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = False
# 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 = file
# Address to bind the API server
bind_host = 0.0.0.0
# Port the bind the API server to
bind_port = 9292
# Address to find the registry server
registry_host = 0.0.0.0
# Port the registry server is listening on
registry_port = 9191
# Log to this file. Make sure you do not set the same log
# file for both the API and registry servers!
log_file = /var/log/glance/api.log
# ============ Filesystem Store Options ========================
# Directory that the Filesystem backend store
# writes image data to
filesystem_store_datadir = /var/lib/glance/images/
# ============ Swift Store Options =============================
# Address where the Swift authentication service lives
swift_store_auth_address = 127.0.0.1:8080/v1.0/
# User to authenticate against the Swift authentication service
swift_store_user = jdoe
# Auth key for the user authenticating against the
# Swift authentication service
swift_store_key = a86850deb2742ec3cb41518e26aa2d89
# Container within the account that the account should use
# for storing images in Swift
swift_store_container = glance
# Do we create the container if it does not exist?
swift_store_create_container_on_put = False
[pipeline:glance-api]
pipeline = versionnegotiation apiv1app
[pipeline:versions]
pipeline = versionsapp
[app:versionsapp]
paste.app_factory = glance.api.versions:app_factory
[app:apiv1app]
paste.app_factory = glance.api.v1:app_factory
[filter:versionnegotiation]
paste.filter_factory = glance.api.middleware.version_negotiation:filter_factory

View File

@ -0,0 +1,67 @@
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = <%= verbose %>
# Show debugging output in logs (sets DEBUG log level output)
debug = False
# 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 %>
# Address to find the registry server
registry_host = <%= registry_host %>
# Port the registry server is listening on
registry_port = <%= registry_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 %>
# ============ 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 %>
[pipeline:glance-api]
pipeline = versionnegotiation apiv1app
[pipeline:versions]
pipeline = versionsapp
[app:versionsapp]
paste.app_factory = glance.api.versions:app_factory
[app:apiv1app]
paste.app_factory = glance.api.v1:app_factory
[filter:versionnegotiation]
paste.filter_factory = glance.api.middleware.version_negotiation:filter_factory

View File

@ -0,0 +1,33 @@
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = False
# Address to bind the registry server
bind_host = 0.0.0.0
# Port the bind the registry server to
bind_port = 9191
# Log to this file. Make sure you do not set the same log
# file for both the API and registry servers!
log_file = /var/log/glance/registry.log
# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.
# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
sql_connection = sqlite:///glance.sqlite
# Period in seconds after which SQLAlchemy should reestablish its connection
# to the database.
#
# MySQL uses a default `wait_timeout` of 8 hours, after which it will drop
# idle connections. This can result in 'MySQL Gone Away' exceptions. If you
# notice this, you can lower this value to ensure that SQLAlchemy reconnects
# before MySQL can drop the connection.
sql_idle_timeout = 3600
[app:glance-registry]
paste.app_factory = glance.registry.server:app_factory

View File

@ -0,0 +1,33 @@
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = <%= verbose %>
# Show debugging output in logs (sets DEBUG log level output)
debug = False
# Address to bind the registry server
bind_host = 0.0.0.0
# Port the bind the registry 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 = /var/log/glance/registry.log
# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.
# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
sql_connection = sqlite:///glance.sqlite
# Period in seconds after which SQLAlchemy should reestablish its connection
# to the database.
#
# MySQL uses a default `wait_timeout` of 8 hours, after which it will drop
# idle connections. This can result in 'MySQL Gone Away' exceptions. If you
# notice this, you can lower this value to ensure that SQLAlchemy reconnects
# before MySQL can drop the connection.
sql_idle_timeout = <%= sql_idle_timeout %>
[app:glance-registry]
paste.app_factory = glance.registry.server:app_factory

View File

@ -0,0 +1 @@
class { 'glance::api': }

View File

@ -0,0 +1 @@
class { 'glance': }

View File

@ -0,0 +1 @@
class { 'glance::registry': }