Merge "add PostgreSQL support"

This commit is contained in:
Jenkins 2013-07-20 17:17:18 +00:00 committed by Gerrit Code Review
commit 8034ca4b94
11 changed files with 114 additions and 6 deletions

View File

@ -110,10 +110,12 @@ License and Author
| **Author** | John Dewey (<jdewey@att.com>) |
| **Author** | Abel Lopez (<al592b@att.com>) |
| **Author** | Sean Gallagher (<sean.gallagher@att.com>) |
| **Author** | Ionut Artarisi (<iartarisi@suse.cz>) |
| | |
| **Copyright** | Copyright (c) 2012, Rackspace US, Inc. |
| **Copyright** | Copyright (c) 2012-2013, AT&T Services, Inc. |
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
| **Copyright** | Copyright (c) 2013, SUSE Linux GmbH |
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -130,11 +130,13 @@ default["openstack"]["block-storage"]["policy"]["admin_api"] = '["is_admin:True"
case platform
when "fedora", "redhat", "centos" # :pragma-foodcritic: ~FC024 - won't fix this
default["openstack"]["block-storage"]["platform"] = {
"cinder_api_packages" => ["openstack-cinder", "python-cinderclient", "MySQL-python"],
"mysql_python_packages" => ["MySQL-python"],
"postgresql_python_packages" => ["python-psycopg2"],
"cinder_api_packages" => ["openstack-cinder", "python-cinderclient"],
"cinder_api_service" => "openstack-cinder-api",
"cinder_volume_packages" => ["openstack-cinder", "MySQL-python"],
"cinder_volume_packages" => ["openstack-cinder"],
"cinder_volume_service" => "openstack-cinder-volume",
"cinder_scheduler_packages" => ["openstack-cinder", "MySQL-python"],
"cinder_scheduler_packages" => ["openstack-cinder"],
"cinder_scheduler_service" => "openstack-cinder-scheduler",
"cinder_iscsitarget_packages" => ["scsi-target-utils"],
"cinder_iscsitarget_service" => "tgtd",
@ -143,11 +145,13 @@ when "fedora", "redhat", "centos" # :pragma-foodcritic: ~FC024 - won't fix this
}
when "ubuntu"
default["openstack"]["block-storage"]["platform"] = {
"cinder_api_packages" => ["cinder-common", "cinder-api", "python-cinderclient", "python-mysqldb"],
"mysql_python_packages" => ["python-mysqldb"],
"postgresql_python_packages" => ["python-psycopg2"],
"cinder_api_packages" => ["cinder-common", "cinder-api", "python-cinderclient"],
"cinder_api_service" => "cinder-api",
"cinder_volume_packages" => ["cinder-volume", "python-mysqldb"],
"cinder_volume_packages" => ["cinder-volume"],
"cinder_volume_service" => "cinder-volume",
"cinder_scheduler_packages" => ["cinder-scheduler", "python-mysqldb"],
"cinder_scheduler_packages" => ["cinder-scheduler"],
"cinder_scheduler_service" => "cinder-scheduler",
"cinder_iscsitarget_packages" => ["tgt"],
"cinder_iscsitarget_service" => "tgt",

View File

@ -5,6 +5,7 @@
# Copyright 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc.
# Copyright 2013, SUSE Linux Gmbh.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -35,6 +36,13 @@ platform_options["cinder_api_packages"].each do |pkg|
end
end
db_type = node['openstack']['db']['volume']['db_type']
platform_options["#{db_type}_python_packages"].each do |pkg|
package pkg do
action :upgrade
end
end
directory ::File.dirname(node["openstack"]["block-storage"]["api"]["auth"]["cache_dir"]) do
owner node["openstack"]["block-storage"]["user"]
group node["openstack"]["block-storage"]["group"]

View File

@ -5,6 +5,7 @@
# Copyright 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc.
# Copyright 2013, SUSE Linux Gmbh.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -31,6 +32,13 @@ platform_options["cinder_scheduler_packages"].each do |pkg|
end
end
db_type = node['openstack']['db']['volume']['db_type']
platform_options["#{db_type}_python_packages"].each do |pkg|
package pkg do
action :upgrade
end
end
service "cinder-scheduler" do
service_name platform_options["cinder_scheduler_service"]
supports :status => true, :restart => true

View File

@ -5,6 +5,7 @@
# Copyright 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc.
# Copyright 2013, SUSE Linux Gmbh.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -35,6 +36,13 @@ platform_options["cinder_volume_packages"].each do |pkg|
end
end
db_type = node['openstack']['db']['volume']['db_type']
platform_options["#{db_type}_python_packages"].each do |pkg|
package pkg do
action :upgrade
end
end
platform_options["cinder_iscsitarget_packages"].each do |pkg|
package pkg do
options platform_options["package_overrides"]

View File

@ -11,9 +11,22 @@ describe "openstack-block-storage::api" do
it "installs cinder api packages" do
expect(@chef_run).to upgrade_package "openstack-cinder"
expect(@chef_run).to upgrade_package "python-cinderclient"
end
it "installs mysql python packages by default" do
expect(@chef_run).to upgrade_package "MySQL-python"
end
it "installs postgresql python packages if explicitly told" do
chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS
node = chef_run.node
node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
chef_run.converge "openstack-block-storage::api"
expect(chef_run).to upgrade_package "python-psycopg2"
expect(chef_run).not_to upgrade_package "MySQL-python"
end
it "starts cinder api on boot" do
expect(@chef_run).to set_service_to_start_on_boot "openstack-cinder-api"
end

View File

@ -23,9 +23,22 @@ describe "openstack-block-storage::api" do
expect(@chef_run).to upgrade_package "cinder-common"
expect(@chef_run).to upgrade_package "cinder-api"
expect(@chef_run).to upgrade_package "python-cinderclient"
end
it "installs mysql python packages by default" do
expect(@chef_run).to upgrade_package "python-mysqldb"
end
it "installs postgresql python packages if explicitly told" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
chef_run.converge "openstack-block-storage::api"
expect(chef_run).to upgrade_package "python-psycopg2"
expect(chef_run).not_to upgrade_package "python-mysqldb"
end
describe "/var/cache/cinder" do
before do
@dir = @chef_run.directory "/var/cache/cinder"

View File

@ -10,9 +10,22 @@ describe "openstack-block-storage::scheduler" do
it "installs cinder api packages" do
expect(@chef_run).to upgrade_package "openstack-cinder"
end
it "installs mysql python packages by default" do
expect(@chef_run).to upgrade_package "MySQL-python"
end
it "installs postgresql python packages if explicitly told" do
chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS
node = chef_run.node
node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
chef_run.converge "openstack-block-storage::scheduler"
expect(chef_run).to upgrade_package "python-psycopg2"
expect(chef_run).not_to upgrade_package "MySQL-python"
end
it "starts cinder scheduler" do
expect(@chef_run).to start_service "openstack-cinder-scheduler"
end

View File

@ -21,9 +21,22 @@ describe "openstack-block-storage::scheduler" do
it "installs cinder api packages" do
expect(@chef_run).to upgrade_package "cinder-scheduler"
end
it "installs mysql python packages by default" do
expect(@chef_run).to upgrade_package "python-mysqldb"
end
it "installs postgresql python packages if explicitly told" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
chef_run.converge "openstack-block-storage::scheduler"
expect(chef_run).to upgrade_package "python-psycopg2"
expect(chef_run).not_to upgrade_package "python-mysqldb"
end
it "starts cinder scheduler" do
expect(@chef_run).to start_service "cinder-scheduler"
end

View File

@ -10,9 +10,22 @@ describe "openstack-block-storage::volume" do
it "installs cinder volume packages" do
expect(@chef_run).to upgrade_package "openstack-cinder"
end
it "installs mysql python packages by default" do
expect(@chef_run).to upgrade_package "MySQL-python"
end
it "installs postgresql python packages if explicitly told" do
chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS
node = chef_run.node
node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
chef_run.converge "openstack-block-storage::volume"
expect(chef_run).to upgrade_package "python-psycopg2"
expect(chef_run).not_to upgrade_package "MySQL-python"
end
it "installs cinder iscsi packages" do
expect(@chef_run).to upgrade_package "scsi-target-utils"
end

View File

@ -21,9 +21,22 @@ describe "openstack-block-storage::volume" do
it "installs cinder volume packages" do
expect(@chef_run).to upgrade_package "cinder-volume"
end
it "installs mysql python packages by default" do
expect(@chef_run).to upgrade_package "python-mysqldb"
end
it "installs postgresql python packages if explicitly told" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
chef_run.converge "openstack-block-storage::volume"
expect(chef_run).to upgrade_package "python-psycopg2"
expect(chef_run).not_to upgrade_package "python-mysqldb"
end
it "installs cinder iscsi packages" do
expect(@chef_run).to upgrade_package "tgt"
end