Changed coobook name to openstack-image

Changed the cookbook name to openstack-image, fixed all tests, and
addressed attributes. Also addressed calls to external services,
primarily keystone -> openstack-identity.

All tests pass.

Change-Id: I6338342a570000b3fb0ae610f1a1bb5aa15ae3e9
This commit is contained in:
Craig Tracey 2013-05-15 16:15:28 -04:00
parent f0bf38f1ed
commit c85a817fb6
29 changed files with 266 additions and 260 deletions

View File

@ -1,6 +1,6 @@
metadata
cookbook "keystone",
git: "git@github.com:att-cloud/cookbook-keystone.git"
cookbook "openstack-identity",
git: "git://github.com/stackforge/cookbook-openstack-identity.git"
cookbook "openstack-common",
git: "git@github.com:att-cloud/cookbook-openstack-common.git"
git: "git://github.com/stackforge/cookbook-openstack-common.git"

View File

@ -19,20 +19,20 @@ Cookbooks
The following cookbooks are dependencies:
* database
* keystone">= 2012.2.1"
* openstack-identity">= 2012.2.1"
* mysql
* openstack-common >= 0.1.7
* openstack-common >= 0.2.0
Usage
=====
api
------
-Installs the glance-api server
-Installs the image-api server
registry
--------
-Installs the glance-registry server
-Installs the image-registry server
keystone-registration
---------------------
@ -50,7 +50,7 @@ Files
-----
```json
"glance": {
"openstack-image": {
"api": {
"default_store": "file"
},
@ -65,7 +65,7 @@ Swift
-----
```json
"glance": {
"openstack-image": {
"api": {
"default_store": "swift"
},
@ -84,41 +84,41 @@ Providers
- `:image_url`: Location of the image to be loaded into Glance.
- `:image_name`: A name for the image.
- `:image_type`: `qcow2` or `ami`. Defaults to `qcow2`.
- `:keystone_user`: Username of the Keystone admin user.
- `:keystone_pass`: Password for the Keystone admin user.
- `:keystone_tenant`: Name of the Keystone admin user's tenant.
- `:keystone_uri`: URI of the Identity API endpoint.
- `:identity_user`: Username of the Keystone admin user.
- `:identity_pass`: Password for the Keystone admin user.
- `:identity_tenant`: Name of the Keystone admin user's tenant.
- `:identity_uri`: URI of the Identity API endpoint.
Attributes
==========
* `glance["verbose"]` - Enables/disables verbose output for glance services.
* `glance["debug"]` - Enables/disables debug output for glance services.
* `glance["keystone_service_chef_role"]` - The name of the Chef role that installs the Keystone Service API
* `glance["user"] - User glance runs as
* `glance["group"] - Group glance runs as
* `glance["glance_api_chef_role"]` - The name of the Chef role that installs the Glance API service
* `glance["db"]["username"]` - Username for glance database access
* `glance["api"]["adminURL"]` - Used when registering image endpoint with keystone
* `glance["api"]["internalURL"]` - Used when registering image endpoint with keystone
* `glance["api"]["publicURL"]` - Used when registering image endpoint with keystone
* `glance["service_tenant_name"]` - Tenant name used by glance when interacting with keystone - used in the API and registry paste.ini files
* `glance["service_user"]` - User name used by glance when interacting with keystone - used in the API and registry paste.ini files
* `glance["service_role"]` - User role used by glance when interacting with keystone - used in the API and registry paste.ini files
* `default["glance"]["api"]["auth"]["cache_dir"]` - Defaults to `/var/cache/glance/api`. Directory where `auth_token` middleware writes certificates for glance-api
* `default["glance"]["registry"]["auth"]["cache_dir"]` - Defaults to `/var/cache/glance/registry`. Directory where `auth_token` middleware writes certificates for glance-registry
* `glance["image_upload"]` - Toggles whether to automatically upload images in the `glance["images"]` array
* `glance["images"]` - Default list of images to upload to the glance repository as part of the install
* `glance["image]["<imagename>"]` - URL location of the `<imagename>` image. There can be multiple instances of this line to define multiple imagess (eg natty, maverick, fedora17 etc)
--- example `glance["image]["natty"]` - "http://c250663.r63.cf1.rackcdn.com/ubuntu-11.04-server-uec-amd64-multinic.tar.gz"
* `glance["api"]["default_store"]` - Toggles the backend storage type. Currently supported is "file" and "swift"
* `glance["api"]["swift"]["store_container"]` - Set the container used by glance to store images and snapshots. Defaults to "glance"
* `glance["api"]["swift"]["store_large_object_size"]` - Set the size at which glance starts to chunnk files. Defaults to "200" MB
* `glance["api"]["swift"]["store_large_object_chunk_size"]` - Set the chunk size for glance. Defaults to "200" MB
* `glance["api"]["rbd"]["rbd_store_ceph_conf"]` - Default location of ceph.conf
* `glance["api"]["rbd"]["rbd_store_user"]` - User for connecting to ceph store
* `glance["api"]["rbd"]["rbd_store_pool"]` - RADOS pool for images
* `glance["api"]["rbd"]["rbd_store_chunk_size"]` - Size in MB of chunks for RADOS Store, should be a power of 2
* `openstack-image["verbose"]` - Enables/disables verbose output for glance services.
* `openstack-image["debug"]` - Enables/disables debug output for glance services.
* `openstack-image["identity_service_chef_role"]` - The name of the Chef role that installs the Keystone Service API
* `openstack-image["user"] - User glance runs as
* `openstack-image["group"] - Group glance runs as
* `openstack-image["glance_api_chef_role"]` - The name of the Chef role that installs the Glance API service
* `openstack-image["db"]["username"]` - Username for glance database access
* `openstack-image["api"]["adminURL"]` - Used when registering image endpoint with keystone
* `openstack-image["api"]["internalURL"]` - Used when registering image endpoint with keystone
* `openstack-image["api"]["publicURL"]` - Used when registering image endpoint with keystone
* `openstack-image["service_tenant_name"]` - Tenant name used by glance when interacting with keystone - used in the API and registry paste.ini files
* `openstack-image["service_user"]` - User name used by glance when interacting with keystone - used in the API and registry paste.ini files
* `openstack-image["service_role"]` - User role used by glance when interacting with keystone - used in the API and registry paste.ini files
* `default["openstack-image"]["api"]["auth"]["cache_dir"]` - Defaults to `/var/cache/glance/api`. Directory where `auth_token` middleware writes certificates for glance-api
* `default["openstack-image"]["registry"]["auth"]["cache_dir"]` - Defaults to `/var/cache/glance/registry`. Directory where `auth_token` middleware writes certificates for glance-registry
* `openstack-image["image_upload"]` - Toggles whether to automatically upload images in the `openstack-image["images"]` array
* `openstack-image["images"]` - Default list of images to upload to the glance repository as part of the install
* `openstack-image["image]["<imagename>"]` - URL location of the `<imagename>` image. There can be multiple instances of this line to define multiple imagess (eg natty, maverick, fedora17 etc)
--- example `openstack-image["image]["natty"]` - "http://c250663.r63.cf1.rackcdn.com/ubuntu-11.04-server-uec-amd64-multinic.tar.gz"
* `openstack-image["api"]["default_store"]` - Toggles the backend storage type. Currently supported is "file" and "swift"
* `openstack-image["api"]["swift"]["store_container"]` - Set the container used by glance to store images and snapshots. Defaults to "glance"
* `openstack-image["api"]["swift"]["store_large_object_size"]` - Set the size at which glance starts to chunnk files. Defaults to "200" MB
* `openstack-image["api"]["swift"]["store_large_object_chunk_size"]` - Set the chunk size for glance. Defaults to "200" MB
* `openstack-image["api"]["rbd"]["rbd_store_ceph_conf"]` - Default location of ceph.conf
* `openstack-image["api"]["rbd"]["rbd_store_user"]` - User for connecting to ceph store
* `openstack-image["api"]["rbd"]["rbd_store_pool"]` - RADOS pool for images
* `openstack-image["api"]["rbd"]["rbd_store_chunk_size"]` - Size in MB of chunks for RADOS Store, should be a power of 2
Testing
=====
@ -142,10 +142,12 @@ Author:: Evan Callicoat (<evan.callicoat@rackspace.com>)
Author:: Matt Ray (<matt@opscode.com>)
Author:: Jay Pipes (<jaypipes@att.com>)
Author:: John Dewey (<jdewey@att.com>)
Author:: Craig Tracey (<craigtracey@gmail.com>)
Copyright 2012, Rackspace US, Inc.
Copyright 2012, Opscode, Inc.
Copyright 2012-2013, AT&T Services, Inc.
Copyright 2013, Craig Tracey <craigtracey@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -1,8 +1,9 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Attributes:: default
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -19,105 +20,105 @@
# Set to some text value if you want templated config files
# to contain a custom banner at the top of the written file
default["glance"]["custom_template_banner"] = "
default["openstack-image"]["custom_template_banner"] = "
# This file autogenerated by Chef
# Do not edit, changes will be overwritten
"
default["glance"]["verbose"] = "False"
default["glance"]["debug"] = "False"
default["openstack-image"]["verbose"] = "False"
default["openstack-image"]["debug"] = "False"
# This is the name of the Chef role that will install the Keystone Service API
default["glance"]["keystone_service_chef_role"] = "keystone"
default["openstack-image"]["identity_service_chef_role"] = "os-identity"
# Gets set in the Image Endpoint when registering with Keystone
default["glance"]["region"] = "RegionOne"
default["openstack-image"]["region"] = "RegionOne"
# The name of the Chef role that knows about the message queue server
# that Glance uses
default["glance"]["rabbit_server_chef_role"] = "rabbitmq-server"
default["openstack-image"]["rabbit_server_chef_role"] = "rabbitmq-server"
default["glance"]["db"]["username"] = "glance"
default["openstack-image"]["db"]["username"] = "glance"
default["glance"]["service_tenant_name"] = "service"
default["glance"]["service_user"] = "glance"
default["glance"]["service_role"] = "admin"
default["openstack-image"]["service_tenant_name"] = "service"
default["openstack-image"]["service_user"] = "glance"
default["openstack-image"]["service_role"] = "admin"
# Keystone PKI signing directories
# XXX keystoneclient wants these dirs to exist even if it doesn't use them
default["glance"]["api"]["auth"]["cache_dir"] = "/var/cache/glance/api"
default["glance"]["registry"]["auth"]["cache_dir"] = "/var/cache/glance/registry"
default["openstack-image"]["api"]["auth"]["cache_dir"] = "/var/cache/glance/api"
default["openstack-image"]["registry"]["auth"]["cache_dir"] = "/var/cache/glance/registry"
default["glance"]["api"]["default_store"] = "file"
default["openstack-image"]["api"]["default_store"] = "file"
# If set, glance API service will bind to the address on this interface,
# otherwise it will bind to the API endpoint's host.
default["glance"]["api"]["bind_interface"] = nil
default["glance"]["api"]["swift"]["container"] = "glance"
default["glance"]["api"]["swift"]["large_object_size"] = "200"
default["glance"]["api"]["swift"]["large_object_chunk_size"] = "200"
default["glance"]["api"]["cache"]["image_cache_max_size"] = "10737418240"
default["openstack-image"]["api"]["bind_interface"] = 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"
default["openstack-image"]["api"]["cache"]["image_cache_max_size"] = "10737418240"
# Ceph Options
default["glance"]["api"]["rbd"]["rbd_store_ceph_conf"] = "/etc/ceph/ceph.conf"
default["glance"]["api"]["rbd"]["rbd_store_user"] = "glance"
default["glance"]["api"]["rbd"]["rbd_store_pool"] = "images"
default["glance"]["api"]["rbd"]["rbd_store_chunk_size"] = "8"
default["openstack-image"]["api"]["rbd"]["rbd_store_ceph_conf"] = "/etc/ceph/ceph.conf"
default["openstack-image"]["api"]["rbd"]["rbd_store_user"] = "glance"
default["openstack-image"]["api"]["rbd"]["rbd_store_pool"] = "images"
default["openstack-image"]["api"]["rbd"]["rbd_store_chunk_size"] = "8"
# If set, glance registry service will bind to the address on this interface,
# otherwise it will bind to the API endpoint's host.
default["glance"]["registry"]["bind_interface"] = nil
default["openstack-image"]["registry"]["bind_interface"] = nil
# Default Image Locations
default["glance"]["image_upload"] = false
default["glance"]["images"] = [ "cirros" ]
default["glance"]["image"]["precise"] = "http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img"
default["glance"]["image"]["oneiric"] = "http://cloud-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64-disk1.img"
default["glance"]["image"]["natty"] = "http://cloud-images.ubuntu.com/natty/current/natty-server-cloudimg-amd64-disk1.img"
default["glance"]["image"]["cirros"] = "https://launchpadlibrarian.net/83305348/cirros-0.3.0-x86_64-disk.img"
default["openstack-image"]["image_upload"] = false
default["openstack-image"]["images"] = [ "cirros" ]
default["openstack-image"]["image"]["precise"] = "http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img"
default["openstack-image"]["image"]["oneiric"] = "http://cloud-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64-disk1.img"
default["openstack-image"]["image"]["natty"] = "http://cloud-images.ubuntu.com/natty/current/natty-server-cloudimg-amd64-disk1.img"
default["openstack-image"]["image"]["cirros"] = "https://launchpadlibrarian.net/83305348/cirros-0.3.0-x86_64-disk.img"
# more images available at https://github.com/rackerjoe/oz-image-build
default["glance"]["image"]["centos"] = "http://c250663.r63.cf1.rackcdn.com/centos60_x86_64.qcow2"
default["openstack-image"]["image"]["centos"] = "http://c250663.r63.cf1.rackcdn.com/centos60_x86_64.qcow2"
# logging attribute
default["glance"]["syslog"]["use"] = false
default["glance"]["syslog"]["facility"] = "LOG_LOCAL2"
default["glance"]["syslog"]["config_facility"] = "local2"
default["openstack-image"]["syslog"]["use"] = false
default["openstack-image"]["syslog"]["facility"] = "LOG_LOCAL2"
default["openstack-image"]["syslog"]["config_facility"] = "local2"
# platform-specific settings
case platform
when "fedora", "redhat", "centos" # :pragma-foodcritic: ~FC024 - won't fix this
default["glance"]["user"] = "glance"
default["glance"]["group"] = "glance"
default["glance"]["platform"] = {
default["openstack-image"]["user"] = "glance"
default["openstack-image"]["group"] = "glance"
default["openstack-image"]["platform"] = {
"postgresql_python_packages" => [ "python-psycopg2" ],
"mysql_python_packages" => [ "MySQL-python" ],
"glance_packages" => [ "openstack-glance", "openstack-swift", "cronie" ],
"glance_api_service" => "openstack-glance-api",
"glance_registry_service" => "openstack-glance-registry",
"glance_api_process_name" => "glance-api",
"image_packages" => [ "openstack-glance", "openstack-swift", "cronie" ],
"image_api_service" => "openstack-glance-api",
"image_registry_service" => "openstack-glance-registry",
"image_api_process_name" => "glance-api",
"package_overrides" => ""
}
when "suse"
default["glance"]["user"] = "openstack-glance"
default["glance"]["group"] = "openstack-glance"
default["glance"]["platform"] = {
default["openstack-image"]["user"] = "openstack-glance"
default["openstack-image"]["group"] = "openstack-glance"
default["openstack-image"]["platform"] = {
"postgresql_python_packages" => [ "python-psycopg2" ],
"mysql_python_packages" => [ "python-mysql" ],
"glance_packages" => [ "openstack-glance", "openstack-swift", "python-glanceclient" ],
"glance_api_service" => "openstack-glance-api",
"glance_registry_service" => "openstack-glance-registry",
"glance_api_process_name" => "glance-api",
"image_packages" => [ "openstack-glance", "openstack-swift", "python-glanceclient" ],
"image_api_service" => "openstack-glance-api",
"image_registry_service" => "openstack-glance-registry",
"image_api_process_name" => "glance-api",
"package_overrides" => ""
}
when "ubuntu"
default["glance"]["user"] = "glance"
default["glance"]["group"] = "glance"
default["glance"]["platform"] = {
default["openstack-image"]["user"] = "glance"
default["openstack-image"]["group"] = "glance"
default["openstack-image"]["platform"] = {
"postgresql_python_packages" => [ "python-psycopg2" ],
"mysql_python_packages" => [ "python-mysqldb" ],
"glance_packages" => [ "glance", "python-swift" ],
"glance_api_service" => "glance-api",
"glance_registry_service" => "glance-registry",
"glance_registry_process_name" => "glance-registry",
"image_packages" => [ "glance", "python-swift" ],
"image_api_service" => "glance-api",
"image_registry_service" => "glance-registry",
"image_registry_process_name" => "glance-registry",
"package_overrides" => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
}
end

View File

@ -1,20 +1,20 @@
name "glance"
name "openstack-image"
maintainer "Opscode, Inc."
license "Apache 2.0"
description "Installs and configures the Glance Image Registry and Delivery Service"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2012.2.3"
recipe "glance::api", "Installs packages required for a glance api server"
recipe "glance::registry", "Installs packages required for a glance registry server"
recipe "glance::db", "Creates the Glance registry database"
recipe "glance::keystone_registration", "Registers Glance endpoints and service with Keystone"
recipe "openstack-image::api", "Installs packages required for a glance api server"
recipe "openstack-image::registry", "Installs packages required for a glance registry server"
recipe "openstack-image::db", "Creates the Glance registry database"
recipe "openstack-image::identity_registration", "Registers Glance endpoints and service with Keystone"
%w{ ubuntu fedora redhat centos suse }.each do |os|
supports os
end
depends "database"
depends "keystone", ">= 2012.2.1"
depends "openstack-common", ">= 0.1.7"
depends "openstack-identity", ">= 2012.2.1"
depends "openstack-common", ">= 0.2.0"
suggests "mysql"
suggests "postgresql"
suggests "postgresql"

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Provider:: image
#
# Copyright 2012, Rackspace US, Inc.
@ -18,10 +18,10 @@
#
action :upload do
@user = new_resource.keystone_user
@pass = new_resource.keystone_pass
@tenant = new_resource.keystone_tenant
@ks_uri = new_resource.keystone_uri
@user = new_resource.identity_user
@pass = new_resource.identity_pass
@tenant = new_resource.identity_tenant
@ks_uri = new_resource.identity_uri
name = new_resource.image_name
url = new_resource.image_url

View File

@ -1,10 +1,11 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Recipe:: api
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2012, Opscode, Inc.
# Copyright 2012-2013, AT&T Services, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -25,11 +26,11 @@ class ::Chef::Recipe
include ::Openstack
end
if node["glance"]["syslog"]["use"]
if node["openstack-image"]["syslog"]["use"]
include_recipe "openstack-common::logging"
end
platform_options = node["glance"]["platform"]
platform_options = node["openstack-image"]["platform"]
package "python-keystone" do
action :install
@ -39,59 +40,59 @@ package "curl" do
action :install
end
platform_options["glance_packages"].each do |pkg|
platform_options["image_packages"].each do |pkg|
package pkg do
action :upgrade
end
end
service "glance-api" do
service_name platform_options["glance_api_service"]
service "image-api" do
service_name platform_options["image_api_service"]
supports :status => true, :restart => true
action :enable
end
directory "/etc/glance" do
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00700
end
directory ::File.dirname node["glance"]["api"]["auth"]["cache_dir"] do
owner node["glance"]["user"]
group node["glance"]["group"]
directory ::File.dirname node["openstack-image"]["api"]["auth"]["cache_dir"] do
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00700
end
template "/etc/glance/policy.json" do
source "policy.json.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
notifies :restart, "service[glance-api]", :immediately
notifies :restart, "service[image-api]", :immediately
#TODO(jaypipes): This shouldn't be necessary... not sure why it's here.
not_if { File.exists? "/etc/glance/policy.json" }
end
glance = node["glance"]
glance = node["openstack-image"]
rabbit_server_role = glance["rabbit_server_chef_role"]
rabbit_info = config_by_role rabbit_server_role, "queue"
identity_endpoint = endpoint "identity-admin"
auth_uri = ::URI.decode identity_endpoint.to_s
db_user = node["glance"]["db"]["username"]
db_user = node["openstack-image"]["db"]["username"]
db_pass = db_password "glance"
sql_connection = db_uri("image", db_user, db_pass)
registry_endpoint = endpoint "image-registry"
api_endpoint = endpoint "image-api"
service_pass = service_password "glance"
service_tenant_name = node["glance"]["service_tenant_name"]
service_user = node["glance"]["service_user"]
service_tenant_name = node["openstack-image"]["service_tenant_name"]
service_user = node["openstack-image"]["service_user"]
# Possible combinations of options here
# - default_store=file
@ -125,16 +126,16 @@ else
glance_flavor="keystone+cachemanagement"
end
if node["glance"]["api"]["bind_interface"].nil?
if node["openstack-image"]["api"]["bind_interface"].nil?
bind_address = api_endpoint.host
else
bind_address = node["network"]["ipaddress_#{node["glance"]["api"]["bind_interface"]}"]
bind_address = node["network"]["ipaddress_#{node["openstack-image"]["api"]["bind_interface"]}"]
end
template "/etc/glance/glance-api.conf" do
source "glance-api.conf.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
variables(
:api_bind_address => bind_address,
@ -153,46 +154,46 @@ template "/etc/glance/glance-api.conf" do
:swift_store_auth_version => swift_store_auth_version
)
notifies :restart, "service[glance-api]", :immediately
notifies :restart, "service[image-api]", :immediately
end
template "/etc/glance/glance-api-paste.ini" do
source "glance-api-paste.ini.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
notifies :restart, "service[glance-api]", :immediately
notifies :restart, "service[image-api]", :immediately
end
template "/etc/glance/glance-cache.conf" do
source "glance-cache.conf.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
variables(
:registry_ip_address => registry_endpoint.host,
:registry_port => registry_endpoint.port
)
notifies :restart, "service[glance-api]"
notifies :restart, "service[image-api]"
end
#TODO(jaypipes) I don't think this even exists or at least isn't
# used, since the Glance cache middleware goes in the api-paste.ini...
template "/etc/glance/glance-cache-paste.ini" do
source "glance-cache-paste.ini.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
notifies :restart, "service[glance-api]"
notifies :restart, "service[image-api]"
end
template "/etc/glance/glance-scrubber.conf" do
source "glance-scrubber.conf.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
variables(
:registry_ip_address => registry_endpoint.host,
@ -215,20 +216,20 @@ end
template "/etc/glance/glance-scrubber-paste.ini" do
source "glance-scrubber-paste.ini.erb"
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00644
end
if node["glance"]["image_upload"]
node["glance"]["images"].each do |img|
glance_image "Image setup for #{img.to_s}" do
image_url node["glance"]["image"][img.to_sym]
if node["openstack-image"]["image_upload"]
node["openstack-image"]["images"].each do |img|
openstack_image_image "Image setup for #{img.to_s}" do
image_url node["openstack-image"]["image"][img.to_sym]
image_name img
keystone_user service_user
keystone_pass service_pass
keystone_tenant service_tenant_name
keystone_uri auth_uri
identity_user service_user
identity_pass service_pass
identity_tenant service_tenant_name
identity_uri auth_uri
action :upload
end
end

View File

@ -1,8 +1,9 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Recipe:: db
#
# Copyright 2012-2013, AT&T Services, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -25,6 +26,6 @@ class ::Chef::Recipe
end
db_create_with_user("image",
node["glance"]["db"]["username"],
node["openstack-image"]["db"]["username"],
db_password("glance")
)

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Recipe:: default
#
# Copyright 2012-2013, AT&T Services, Inc.

View File

@ -1,8 +1,9 @@
#
# Cookbook Name:: glance
# Recipe:: keystone_registration
# Cookbook Name:: openstack-image
# Recipe:: identity_registration
#
# Copyright 2013, AT&T Services, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -25,19 +26,19 @@ end
identity_admin_endpoint = endpoint "identity-admin"
bootstrap_token = secret "secrets", "keystone_bootstrap_token"
bootstrap_token = secret "secrets", "openstack_identity_bootstrap_token"
auth_uri = ::URI.decode identity_admin_endpoint.to_s
registry_endpoint = endpoint "image-registry"
api_endpoint = endpoint "image-api"
service_pass = service_password "glance"
service_tenant_name = node["glance"]["service_tenant_name"]
service_user = node["glance"]["service_user"]
service_role = node["glance"]["service_role"]
service_tenant_name = node["openstack-image"]["service_tenant_name"]
service_user = node["openstack-image"]["service_user"]
service_role = node["openstack-image"]["service_role"]
# Register Image Service
keystone_register "Register Image Service" do
openstack_identity_register "Register Image Service" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "glance"
@ -48,11 +49,11 @@ keystone_register "Register Image Service" do
end
# Register Image Endpoint
keystone_register "Register Image Endpoint" do
openstack_identity_register "Register Image Endpoint" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_type "image"
endpoint_region node["glance"]["region"]
endpoint_region node["openstack-image"]["region"]
endpoint_adminurl api_endpoint.to_s
endpoint_internalurl api_endpoint.to_s
endpoint_publicurl api_endpoint.to_s
@ -61,7 +62,7 @@ keystone_register "Register Image Endpoint" do
end
# Register Service Tenant
keystone_register "Register Service Tenant" do
openstack_identity_register "Register Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name service_tenant_name
@ -72,7 +73,7 @@ keystone_register "Register Service Tenant" do
end
# Register Service User
keystone_register "Register #{service_user} User" do
openstack_identity_register "Register #{service_user} User" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name service_tenant_name
@ -84,7 +85,7 @@ keystone_register "Register #{service_user} User" do
end
## Grant Admin role to Service User for Service Tenant ##
keystone_register "Grant '#{service_role}' Role to #{service_user} User for #{service_tenant_name} Tenant" do
openstack_identity_register "Grant '#{service_role}' Role to #{service_user} User for #{service_tenant_name} Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name service_tenant_name

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Recipe:: registry
#
# Copyright 2012, Rackspace US, Inc.
@ -21,17 +21,17 @@ class ::Chef::Recipe
include ::Openstack
end
if node["glance"]["syslog"]["use"]
if node["openstack-image"]["syslog"]["use"]
include_recipe "openstack-common::logging"
end
platform_options = node["glance"]["platform"]
platform_options = node["openstack-image"]["platform"]
package "python-keystone" do
action :install
end
db_user = node["glance"]["db"]["username"]
db_user = node["openstack-image"]["db"]["username"]
db_pass = db_password "glance"
sql_connection = db_uri("image", db_user, db_pass)
@ -50,20 +50,20 @@ platform_options["#{db_type}_python_packages"].each do |pkg|
end
end
platform_options["glance_packages"].each do |pkg|
platform_options["image_packages"].each do |pkg|
package pkg do
action :upgrade
end
end
directory ::File.dirname(node["glance"]["registry"]["auth"]["cache_dir"]) do
owner node["glance"]["user"]
group node["glance"]["group"]
directory ::File.dirname(node["openstack-image"]["registry"]["auth"]["cache_dir"]) do
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00700
end
service "glance-registry" do
service_name platform_options["glance_registry_service"]
service "image-registry" do
service_name platform_options["image_registry_service"]
supports :status => true, :restart => true
action :enable
@ -81,15 +81,15 @@ file "/var/lib/glance/glance.sqlite" do
end
directory "/etc/glance" do
owner node["glance"]["user"]
group node["glance"]["group"]
owner node["openstack-image"]["user"]
group node["openstack-image"]["group"]
mode 00700
end
if node["glance"]["registry"]["bind_interface"].nil?
if node["openstack-image"]["registry"]["bind_interface"].nil?
bind_address = registry_endpoint.host
else
bind_address = node["network"]["ipaddress_#{node["glance"]["registry"]["bind_interface"]}"]
bind_address = node["network"]["ipaddress_#{node["openstack-image"]["registry"]["bind_interface"]}"]
end
template "/etc/glance/glance-registry.conf" do
@ -105,7 +105,7 @@ template "/etc/glance/glance-registry.conf" do
"service_pass" => service_pass
)
notifies :restart, "service[glance-registry]", :immediately
notifies :restart, "service[image-registry]", :immediately
end
#sync db after config file is generated
@ -117,5 +117,5 @@ template "/etc/glance/glance-registry-paste.ini" do
group "root"
mode 00644
notifies :restart, "service[glance-registry]", :immediately
notifies :restart, "service[image-registry]", :immediately
end

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: glance
# Cookbook Name:: openstack-image
# Resource:: image
#
# Copyright 2012, Rackspace US, Inc.
@ -29,7 +29,7 @@ end
attribute :image_url, :kind_of => String
attribute :image_type, :kind_of => String, :default => "unknown", :equal_to => ["unknown", "ami", "qcow"]
attribute :image_name, :kind_of => String, :default => "default"
attribute :keystone_user, :kind_of => String
attribute :keystone_pass, :kind_of => String
attribute :keystone_tenant, :kind_of => String
attribute :keystone_uri, :kind_of => String
attribute :identity_user, :kind_of => String
attribute :identity_pass, :kind_of => String
attribute :identity_tenant, :kind_of => String
attribute :identity_uri, :kind_of => String

View File

@ -1,11 +1,11 @@
require "spec_helper"
describe "glance::api" do
describe "openstack-image::api" do
describe "redhat" do
before do
glance_stubs
image_stubs
@chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS
@chef_run.converge "glance::api"
@chef_run.converge "openstack-image::api"
end
it "starts glance api on boot" do

View File

@ -1,20 +1,20 @@
require "spec_helper"
describe "glance::api" do
describe "openstack-image::api" do
describe "ubuntu" do
before do
glance_stubs
image_stubs
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@node = @chef_run.node
@node.set["glance"]["syslog"]["use"] = true
@chef_run.converge "glance::api"
@node.set["openstack-image"]["syslog"]["use"] = true
@chef_run.converge "openstack-image::api"
end
expect_runs_openstack_common_logging_recipe
it "doesn't run logging recipe" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
chef_run.converge "glance::api"
chef_run.converge "openstack-image::api"
expect(chef_run).not_to include_recipe "openstack-common::logging"
end
@ -51,7 +51,7 @@ describe "glance::api" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-api]", :restart
expect(@file).to notify "service[image-api]", :restart
end
end
@ -73,7 +73,7 @@ describe "glance::api" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-api]", :restart
expect(@file).to notify "service[image-api]", :restart
end
end
@ -95,7 +95,7 @@ describe "glance::api" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-api]", :restart
expect(@file).to notify "service[image-api]", :restart
end
end
@ -117,7 +117,7 @@ describe "glance::api" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-api]", :restart
expect(@file).to notify "service[image-api]", :restart
end
end
@ -139,7 +139,7 @@ describe "glance::api" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-api]", :restart
expect(@file).to notify "service[image-api]", :restart
end
end
@ -193,13 +193,13 @@ describe "glance::api" do
end
it "uploads qcow images" do
glance_stubs
image_stubs
opts = {
:step_into => ["glance_image"]
:step_into => ["openstack-image_image"]
}
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS.merge(opts)
node = chef_run.node
node.set["glance"] = {
node.set["openstack-image"] = {
"image_upload" => true,
"images" => [
"image1"
@ -208,7 +208,7 @@ describe "glance::api" do
"image1" => "http://example.com/image.qcow2"
}
}
chef_run.converge "glance::api"
chef_run.converge "openstack-image::api"
cmd = "glance --insecure " \
"-I glance " \
"-K glance-pass " \

View File

@ -1,6 +1,6 @@
require "spec_helper"
describe "glance::db" do
describe "openstack-image::db" do
it "installs mysql packages" do
@chef_run = converge
@ -19,6 +19,6 @@ describe "glance::db" do
::Chef::Recipe.any_instance.stub(:db_password).with("glance").
and_return "test-pass"
::ChefSpec::ChefRunner.new(::UBUNTU_OPTS).converge "glance::db"
::ChefSpec::ChefRunner.new(::UBUNTU_OPTS).converge "openstack-image::db"
end
end

View File

@ -1,4 +1,4 @@
require "spec_helper"
describe "horizon::default" do
describe "openstack-dashboard::default" do
end

View File

@ -0,0 +1,5 @@
require "spec_helper"
describe "openstack-image::identity_registration" do
#TODO: implement
end

View File

@ -1,5 +0,0 @@
require "spec_helper"
describe "glance::keystone_registration" do
#TODO: implement
end

View File

@ -1,11 +1,11 @@
require "spec_helper"
describe "glance::registry" do
describe "openstack-image::registry" do
describe "redhat" do
before do
glance_stubs
image_stubs
@chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS
@chef_run.converge "glance::registry"
@chef_run.converge "openstack-image::registry"
end
it "installs mysql python packages" do

View File

@ -1,20 +1,20 @@
require "spec_helper"
describe "glance::registry" do
describe "openstack-image::registry" do
describe "ubuntu" do
before do
glance_stubs
image_stubs
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@node = @chef_run.node
@node.set["glance"]["syslog"]["use"] = true
@chef_run.converge "glance::registry"
@node.set["openstack-image"]["syslog"]["use"] = true
@chef_run.converge "openstack-image::registry"
end
expect_runs_openstack_common_logging_recipe
it "doesn't run logging recipe" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
chef_run.converge "glance::registry"
chef_run.converge "openstack-image::registry"
expect(chef_run).not_to include_recipe "openstack-common::logging"
end
@ -64,7 +64,7 @@ describe "glance::registry" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-registry]", :restart
expect(@file).to notify "service[image-registry]", :restart
end
end
@ -91,7 +91,7 @@ describe "glance::registry" do
end
it "notifies nova-api-ec2 restart" do
expect(@file).to notify "service[glance-registry]", :restart
expect(@file).to notify "service[image-registry]", :restart
end
end
end

View File

@ -11,7 +11,7 @@ require "chefspec"
:log_level => ::LOG_LEVEL
}
def glance_stubs
def image_stubs
::Chef::Recipe.any_instance.stub(:config_by_role).
with("rabbitmq-server", "queue").and_return(
{'host' => 'rabbit-host', 'port' => 'rabbit-port'}

View File

@ -1,4 +1,4 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
# Use this pipeline for no auth or image caching - DEFAULT
[pipeline:glance-api]

View File

@ -1,16 +1,16 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = <%= node["glance"]["verbose"] %>
verbose = <%= node["openstack-image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
debug = <%= node["glance"]["debug"] %>
debug = <%= node["openstack-image"]["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 = <%= node["glance"]["api"]["default_store"] %>
default_store = <%= node["openstack-image"]["api"]["default_store"] %>
# Address to bind the API server
bind_host = <%= @api_bind_address %>
@ -38,7 +38,7 @@ sql_connection = <%= @sql_connection %>
# ================= Syslog Options ============================
<% if node["glance"]["syslog"]["use"] %>
<% if node["openstack-image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
# Log to this file. Make sure you do not set the same log
@ -157,7 +157,7 @@ swift_store_key = <%= @swift_store_key %>
# Container within the account that the account should use
# for storing images in Swift
swift_store_container = <%= node["glance"]["api"]["swift"]["container"] %>
swift_store_container = <%= node["openstack-image"]["api"]["swift"]["container"] %>
# Do we create the container if it does not exist?
swift_store_create_container_on_put = True
@ -165,13 +165,13 @@ swift_store_create_container_on_put = True
# 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 = <%= node["glance"]["api"]["swift"]["large_object_size"] %>
swift_store_large_object_size = <%= node["openstack-image"]["api"]["swift"]["large_object_size"] %>
# 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 = <%= node["glance"]["api"]["swift"]["large_object_chunk_size"] %>
swift_store_large_object_chunk_size = <%= node["openstack-image"]["api"]["swift"]["large_object_chunk_size"] %>
# Whether to use ServiceNET to communicate with the Swift storage servers.
# (If you aren't RACKSPACE, leave this False!)
@ -217,17 +217,17 @@ s3_store_create_bucket_on_put = False
# If using cephx authentication, this file should
# include a reference to the right keyring
# in a client.<USER> section
rbd_store_ceph_conf = <%= node["glance"]["api"]["rbd"]["rbd_store_ceph_conf"] %>
rbd_store_ceph_conf = <%= node["openstack-image"]["api"]["rbd"]["rbd_store_ceph_conf"] %>
# RADOS user to authenticate as (only applicable if using cephx)
rbd_store_user = <%= node["glance"]["api"]["rbd"]["rbd_store_user"] %>
rbd_store_user = <%= node["openstack-image"]["api"]["rbd"]["rbd_store_user"] %>
# RADOS pool in which images are stored
rbd_store_pool = <%= node["glance"]["api"]["rbd"]["rbd_store_pool"] %>
rbd_store_pool = <%= node["openstack-image"]["api"]["rbd"]["rbd_store_pool"] %>
# 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 = <%= node["glance"]["api"]["rbd"]["rbd_store_chunk_size"] %>
rbd_store_chunk_size = <%= node["openstack-image"]["api"]["rbd"]["rbd_store_chunk_size"] %>
# ============ Delayed Delete Options =============================
@ -250,10 +250,10 @@ image_cache_dir = /var/lib/glance/image-cache/
auth_host = <%= @identity_endpoint.host %>
auth_port = <%= @identity_endpoint.port %>
auth_protocol = <%= @identity_endpoint.scheme %>
admin_tenant_name = <%= node["glance"]["service_tenant_name"] %>
admin_user = <%= node["glance"]["service_user"] %>
admin_tenant_name = <%= node["openstack-image"]["service_tenant_name"] %>
admin_user = <%= node["openstack-image"]["service_user"] %>
admin_password = <%= @service_pass %>
signing_dir = <%= node["glance"]["api"]["auth"]["cache_dir"] %>
signing_dir = <%= node["openstack-image"]["api"]["auth"]["cache_dir"] %>
[paste_deploy]
flavor = <%= @glance_flavor %>

View File

@ -1,4 +1,4 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
[app:glance-pruner]
paste.app_factory = glance.common.wsgi:app_factory

View File

@ -1,11 +1,11 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = <%= node["glance"]["verbose"] %>
verbose = <%= node["openstack-image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
debug = <%= node["glance"]["debug"] %>
debug = <%= node["openstack-image"]["debug"] %>
# =============== Image Cache Options =============================
@ -27,11 +27,11 @@ image_cache_stall_time = 86400
image_cache_invalid_entry_grace_period = 3600
# Max cache size in bytes
image_cache_max_size = <%= node["glance"]["api"]["cache"]["image_cache_max_size"] %>
image_cache_max_size = <%= node["openstack-image"]["api"]["cache"]["image_cache_max_size"] %>
# ================= Syslog Options ============================
<% if node["glance"]["syslog"]["use"] %>
<% if node["openstack-image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
log_file = /var/log/glance/image-cache.log

View File

@ -1,4 +1,4 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
# Default minimal pipeline
# Use this pipeline for no auth - DEFAULT

View File

@ -1,11 +1,11 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = <%= node["glance"]["verbose"] %>
verbose = <%= node["openstack-image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
debug = <%= node["glance"]["debug"] %>
debug = <%= node["openstack-image"]["debug"] %>
# Address to bind the registry server
bind_host = <%= @registry_bind_address %>
@ -40,7 +40,7 @@ limit_param_default = 25
# ================= Syslog Options ============================
<% if node["glance"]["syslog"]["use"] %>
<% if node["openstack-image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
# Log to this file. Make sure you do not set the same log
@ -61,10 +61,10 @@ log_file = /var/log/glance/registry.log
auth_host = <%= @identity_endpoint.host %>
auth_port = <%= @identity_endpoint.port %>
auth_protocol = <%= @identity_endpoint.scheme %>
admin_tenant_name = <%= node["glance"]["service_tenant_name"] %>
admin_user = <%= node["glance"]["service_user"] %>
admin_tenant_name = <%= node["openstack-image"]["service_tenant_name"] %>
admin_user = <%= node["openstack-image"]["service_user"] %>
admin_password = <%= @service_pass %>
signing_dir = <%= node["glance"]["registry"]["auth"]["cache_dir"] %>
signing_dir = <%= node["openstack-image"]["registry"]["auth"]["cache_dir"] %>
[paste_deploy]
flavor = keystone

View File

@ -1,4 +1,4 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
[app:glance-scrubber]
paste.app_factory = glance.common.wsgi:app_factory

View File

@ -1,13 +1,13 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = <%= node["glance"]["verbose"] %>
verbose = <%= node["openstack-image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
debug = <%= node["glance"]["debug"] %>
debug = <%= node["openstack-image"]["debug"] %>
<% if node["glance"]["syslog"]["use"] %>
<% if node["openstack-image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
# Log to this file. Make sure you do not set the same log

View File

@ -1,4 +1,4 @@
<%= node["glance"]["custom_template_banner"] %>
<%= node["openstack-image"]["custom_template_banner"] %>
{
"default": [],