PRD-13, PRD-199 Simple deployment of openstack-folsom

This commit is contained in:
Dmitry Pyzhov 2012-11-30 19:02:16 +04:00 committed by default
parent 7cad3095fd
commit 2e1bece454
4 changed files with 359 additions and 19 deletions

View File

@ -15,6 +15,7 @@ else
REPO_SUFFIX=mirror
endif
YUM_PLUGIN_PATH:=$(shell readlink -f -m $(CENTOS_REPO_DIR)etc/yum-plugins)
define yum_conf
[main]
cachedir=$(CENTOS_REPO_DIR)cache
@ -24,12 +25,19 @@ logfile=$(CENTOS_REPO_DIR)yum.log
exactarch=1
obsoletes=1
gpgcheck=0
plugins=0
plugins=1
pluginpath=$(YUM_PLUGIN_PATH)
reposdir=$(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).repos.d
endef
$(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf: export contents:=$(yum_conf)
$(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf:
ifeq ($(IGNORE_MIRROR),1)
mkdir -p $(CENTOS_REPO_DIR)etc/yum/pluginconf.d
echo "[main]\nenabled=1" > $(CENTOS_REPO_DIR)etc/yum/pluginconf.d/priorities.conf
mkdir -p $(CENTOS_REPO_DIR)etc/yum-plugins
cp mirror/yum-priorities-plugin.py $(CENTOS_REPO_DIR)etc/yum-plugins/priorities.py
endif
@mkdir -p $(@D)
echo "$${contents}" > $@
@ -48,6 +56,7 @@ name=CentOS-$(CENTOS_RELEASE) - Base
baseurl=$(CENTOSMIRROR)/$(CENTOS_RELEASE)/os/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
priority=10
[updates]
name=CentOS-$(CENTOS_RELEASE) - Updates
@ -55,6 +64,7 @@ name=CentOS-$(CENTOS_RELEASE) - Updates
baseurl=$(CENTOSMIRROR)/$(CENTOS_RELEASE)/updates/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
priority=10
[extras]
name=CentOS-$(CENTOS_RELEASE) - Extras
@ -62,6 +72,7 @@ name=CentOS-$(CENTOS_RELEASE) - Extras
baseurl=$(CENTOSMIRROR)/$(CENTOS_RELEASE)/extras/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
priority=10
[centosplus]
name=CentOS-$(CENTOS_RELEASE) - Plus
@ -69,6 +80,7 @@ name=CentOS-$(CENTOS_RELEASE) - Plus
baseurl=$(CENTOSMIRROR)/$(CENTOS_RELEASE)/centosplus/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
priority=10
[contrib]
name=CentOS-$(CENTOS_RELEASE) - Contrib
@ -76,6 +88,7 @@ name=CentOS-$(CENTOS_RELEASE) - Contrib
baseurl=$(CENTOSMIRROR)/$(CENTOS_RELEASE)/contrib/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
priority=10
[epel]
name=Extra Packages for Enterprise Linux $(CENTOS_MAJOR) - $(CENTOS_ARCH)
@ -83,6 +96,18 @@ name=Extra Packages for Enterprise Linux $(CENTOS_MAJOR) - $(CENTOS_ARCH)
baseurl=$(EPELMIRROR)/$(CENTOS_MAJOR)/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
priority=20
[openstack-epel-fuel]
name=Mirantis OpenStack Custom Packages
mirrorlist=http://download.mirantis.com/epel-fuel-folsom/mirror.external.list
gpgkey=https://fedoraproject.org/static/0608B895.txt
http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
http://download.mirantis.com/epel-fuel-folsom/rabbit.key
http://download.mirantis.com/epel-fuel-folsom/mirantis.key
gpgcheck=0
enabled=1
priority=1
[mirantis]
name=Mirantis Packages for CentOS
@ -102,7 +127,8 @@ name = RHEL $(CENTOS_RELEASE) - RPMforge.net - extras
#mirrorlist = http://apt.sw.be/redhat/el$(CENTOS_MAJOR)/en/mirrors-rpmforge-extras
baseurl = $(RPMFORGEMIRROR)/el$(CENTOS_MAJOR)/en/$(CENTOS_ARCH)/extras
gpgcheck = 0
enabled = 0
enabled = 1
priority=95
[puppetlabs]
name=Puppet Labs Packages
@ -110,6 +136,7 @@ baseurl=http://yum.puppetlabs.com/el/$(CENTOS_MAJOR)/products/$(CENTOS_ARCH)/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
priority=1
endef
$(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).repos.d/base.repo: export contents:=$(yum_$(REPO_SUFFIX)_repo)
@ -141,12 +168,7 @@ $/cache-extra.done: \
requirements-rpm.txt
yum -c $(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf clean all
rm -rf /var/tmp/yum-$$USER-*/
ifeq ($(IGNORE_MIRROR),1)
repotrack -c $(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf -p $(CENTOS_REPO_DIR)Packages -a $(CENTOS_ARCH) $(CENTOSEXTRA_PACKAGES)
repotrack -r base -r updates -r extras -r contrib -r centosplus -r epel -r rpmforge-extras -c $(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf -p $(CENTOS_REPO_DIR)Packages -a $(CENTOS_ARCH) $(CENTOSRPMFORGE_PACKAGES)
else
repotrack -c $(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf -p $(CENTOS_REPO_DIR)Packages -a $(CENTOS_ARCH) $(CENTOSEXTRA_PACKAGES) $(CENTOSRPMFORGE_PACKAGES)
endif
yumdownloader -c $(CENTOS_REPO_DIR)etc/yum-$(REPO_SUFFIX).conf --resolve --destdir=$(CENTOS_REPO_DIR)Packages --archlist=$(CENTOS_ARCH) $(CENTOSEXTRA_PACKAGES) $(CENTOSRPMFORGE_PACKAGES)
$(ACTION.TOUCH)
$/cache.done: $/cache-extra.done $/cache-boot.done

185
mirror/yum-priorities-plugin.py Executable file
View File

@ -0,0 +1,185 @@
#!/usr/bin/python
#
# yum-plugin-priorities 0.0.7
#
# Copyright (c) 2006-2007 Daniel de Kok
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# This plugins is inspired by the protectbase plugin, and enables/disables
# packages based on a repository priority.
#
# You can install this plugin by copying it to /usr/lib/yum-plugins. To
# enable this plugin, make sure that you have 'plugins=1' in /etc/yum.conf,
# and create the file /etc/yum/pluginconf.d/priorities.conf with the
# following content:
#
# [main]
# enabled=1
#
# If you also want the plugin to protect high-priority repositories against
# obsoletes in low-priority repositories, enable the 'check_obsoletes' bool:
#
# check_obsoletes=1
#
# By default, this plugin excludes packages from lower priority repositories
# based on the package name. If you want to exclude packages based ony the
# package name and architecture, enable the 'only_samearch' bool:
#
# only_samearch=N
#
# You can add priorities to repositories, by adding the line:
#
# priority=N
#
# to the repository entry, where N is an integer number. The default
# priority for repositories is 99. The repositories with the lowest
# number have the highest priority.
#
# Please report errors to Daniel de Kok <danieldk@pobox.com>
from yum.constants import *
from yum.plugins import TYPE_CORE
from yum import config
import yum
check_obsoletes = False
only_samearch = False
requires_api_version = '2.1'
plugin_type = (TYPE_CORE,)
def config_hook(conduit):
global check_obsoletes
global only_samearch
# Plugin configuration
check_obsoletes = conduit.confBool('main', 'check_obsoletes', default = False)
only_samearch = conduit.confBool('main', 'only_samearch', default = False)
# Repo priorities
if yum.__version__ >= '2.5.0':
# New style : yum >= 2.5
config.RepoConf.priority = config.IntOption(99)
else:
# Old add extra options style
conduit.registerOpt('priority', PLUG_OPT_INT, PLUG_OPT_WHERE_REPO, 99)
# Command-line options.
parser = conduit.getOptParser()
if parser:
if hasattr(parser, 'plugin_option_group'):
parser = parser.plugin_option_group
parser.add_option('', '--samearch-priorities', dest='samearch',
action='store_true', default = False,
help="Priority-exclude packages based on name + arch")
def _all_repo_priorities_same(allrepos):
""" Are all repos are at the same priority """
first = None
for repo in allrepos:
if first is None:
first = repo.priority
elif first != repo.priority:
return False
return True
def exclude_hook(conduit):
global only_samearch
global check_obsoletes
allrepos = conduit.getRepos().listEnabled()
# If they haven't done anything, don't do any work
if _all_repo_priorities_same(allrepos):
return
# Check whether the user specified the --samearch option.
opts, commands = conduit.getCmdLine()
if opts and opts.samearch:
only_samearch = True
cnt = 0
if check_obsoletes and not conduit._base.conf.obsoletes:
check_obsoletes = False
if check_obsoletes:
obsoletes = conduit._base.up.rawobsoletes
# Build a dictionary with package priorities. Either with arch or
# archless, based on the user's settings.
if only_samearch:
pkg_priorities = dict()
if check_obsoletes or not only_samearch:
pkg_priorities_archless = dict()
for repo in allrepos:
if repo.enabled:
if only_samearch:
repopkgs = _pkglist_to_dict(conduit.getPackages(repo), repo.priority, True)
_mergeprioritydicts(pkg_priorities, repopkgs)
if check_obsoletes or not only_samearch:
repopkgs_archless = _pkglist_to_dict(conduit.getPackages(repo), repo.priority)
_mergeprioritydicts(pkg_priorities_archless, repopkgs_archless)
# Eliminate packages that have a low priority
for repo in allrepos:
if repo.enabled:
for po in conduit.getPackages(repo):
delPackage = False
if only_samearch:
key = "%s.%s" % (po.name,po.arch)
if key in pkg_priorities and pkg_priorities[key] < repo.priority:
delPackage = True
else:
key = "%s" % po.name
if key in pkg_priorities_archless and pkg_priorities_archless[key] < repo.priority:
delPackage = True
if delPackage:
conduit.delPackage(po)
cnt += 1
conduit.info(3," --> %s from %s excluded (priority)" % (po,po.repoid))
# If this packages obsoletes other packages, check whether
# one of the obsoleted packages is not available through
# a repo with a higher priority. If so, remove this package.
if check_obsoletes:
if po.pkgtup in obsoletes:
obsolete_pkgs = obsoletes[po.pkgtup]
for obsolete_pkg in obsolete_pkgs:
pkg_name = obsolete_pkg[0]
if pkg_name in pkg_priorities_archless and pkg_priorities_archless[pkg_name] < repo.priority:
conduit.delPackage(po)
cnt += 1
conduit.info(3," --> %s from %s excluded (priority)" % (po,po.repoid))
break
if cnt:
conduit.info(2, '%d packages excluded due to repository priority protections' % cnt)
if check_obsoletes:
# Atm. the update object doesn't get updated when we manually exclude
# things ... so delete it. This needs to be re-written.
conduit._base.up = None
def _pkglist_to_dict(pl, priority, addArch = False):
out = dict()
for p in pl:
if addArch:
key = "%s.%s" % (p.name,p.arch)
out[key] = priority
else:
out[p.name] = priority
return out
def _mergeprioritydicts(dict1, dict2):
for package in dict2.keys():
if package not in dict1 or dict2[package] < dict1[package]:
dict1[package] = dict2[package]

View File

@ -1,16 +1,141 @@
class nailytest {
case $role {
"controller" : {
include nailytest::test_controller
}
}
case $role {
"compute" : {
include nailytest::test_compute
}
}
# assumes that eth0 is the public interface
$public_interface = 'eth0' ### GET RID OF HARDCODE ###
# assumes that eth1 is the interface that will be used for the vm network
# this configuration assumes this interface is active but does not have an
# ip address allocated to it.
$private_interface = 'eth0.103' ### GET RID OF HARDCODE ###
$internal_interface = 'eth0.102' ### GET RID OF HARDCODE ###
# credentials
$admin_email = 'root@localhost'
$admin_password = 'keystone_admin'
$keystone_db_password = 'keystone_db_pass'
$keystone_admin_token = 'keystone_admin_token'
$nova_db_password = 'nova_pass'
$nova_user_password = 'nova_pass'
$glance_db_password = 'glance_pass'
$glance_user_password = 'glance_pass'
$rabbit_password = 'openstack_rabbit_password'
$rabbit_user = 'openstack_rabbit_user'
$fixed_network_range = '10.0.1.0/24' ### GET RID OF HARDCODE ###
$floating_network_range = '10.0.215.128/28' ### GET RID OF HARDCODE ###
# switch this to true to have all service log at verbose
$verbose = true
# by default it does not enable atomatically adding floating IPs
$auto_assign_floating_ip = false
include nailytest::network_setup
$manage_volumes = false # true
#$nv_physical_volume = ['/dev/sdz', '/dev/sdy', '/dev/sdx']
$cinder = false # true
$quantum = false # true
$quantum_user_password = 'quantum_pass'
$quantum_db_password = 'quantum_pass'
$quantum_db_user = 'quantum'
$quantum_db_dbname = 'quantum'
$openstack_version = {
'keystone' => latest,
'glance' => latest,
'horizon' => latest,
'nova' => latest,
'novncproxy' => latest,
'cinder' => latest,
}
$mirror_type="external"
#stage { 'openstack-custom-repo': before => Stage['main'] }
#class { 'openstack::mirantis_repos': stage => 'openstack-custom-repo', type => $mirror_type }
$controller_node_address = '10.0.0.2' ### GET RID OF HARDCODE ###
$controller_node_public = '10.0.203.72' ### GET RID OF HARDCODE ###
$controller_node_internal = $controller_node_address
$quantum_host = $controller_node_address
$quantum_sql_connection = "mysql://${quantum_db_user}:${quantum_db_password}@${quantum_host}/${quantum_db_dbname}"
$sql_connection = "mysql://nova:${nova_db_password}@${controller_node_internal}/nova"
case $role {
"controller" : {
include nailytest::test_controller
class { 'openstack::controller':
admin_address => $controller_node_internal,
public_address => $controller_node_public,
public_interface => $public_interface,
private_interface => $private_interface,
internal_address => $controller_node_internal,
floating_range => $floating_network_range,
fixed_range => $fixed_network_range,
# by default it does not enable multi-host mode
multi_host => true,
# by default is assumes flat dhcp networking mode
network_manager => 'nova.network.manager.FlatDHCPManager',
verbose => $verbose,
auto_assign_floating_ip => $auto_assign_floating_ip,
mysql_root_password => $mysql_root_password,
admin_email => $admin_email,
admin_password => $admin_password,
keystone_db_password => $keystone_db_password,
keystone_admin_token => $keystone_admin_token,
glance_db_password => $glance_db_password,
glance_user_password => $glance_user_password,
nova_db_password => $nova_db_password,
nova_user_password => $nova_user_password,
rabbit_password => $rabbit_password,
rabbit_user => $rabbit_user,
export_resources => false,
quantum => $quantum,
quantum_user_password => $quantum_user_password,
quantum_db_password => $quantum_db_password,
quantum_db_user => $quantum_db_user,
quantum_db_dbname => $quantum_db_dbname,
cinder => $cinder,
manage_volumes => $manage_volumes,
nv_physical_volume => $nv_physical_volume,
}
class { 'openstack::auth_file':
admin_password => $admin_password,
keystone_admin_token => $keystone_admin_token,
controller_node => $controller_node_internal,
}
Class[nailytest::network_setup] -> Class[openstack::controller]
Class[nailytest::network_setup] -> Class[openstack::auth_file]
}
"compute" : {
include nailytest::test_compute
class { 'openstack::compute':
public_interface => $public_interface,
private_interface => $private_interface,
internal_address => $ipaddress_eth0,
libvirt_type => 'kvm',
fixed_range => $fixed_network_range,
network_manager => 'nova.network.manager.FlatDHCPManager',
multi_host => true,
sql_connection => $sql_connection,
nova_user_password => $nova_user_password,
rabbit_nodes => [$controller_node_internal],
rabbit_password => $rabbit_password,
rabbit_user => $rabbit_user,
glance_api_servers => "${controller_node_internal}:9292",
vncproxy_host => $controller_node_public,
vnc_enabled => true,
#ssh_private_key => 'puppet:///ssh_keys/openstack',
#ssh_public_key => 'puppet:///ssh_keys/openstack.pub',
quantum => $quantum,
quantum_host => $quantum_host,
quantum_sql_connection => $quantum_sql_connection,
quantum_user_password => $quantum_user_password,
service_endpoint => $controller_node_internal,
verbose => $verbose,
}
Class[nailytest::network_setup] -> Class[openstack::compute]
}
}
include nailytest::network_setup
}

View File

@ -1,5 +1,6 @@
autoconf
automake
avahi
bind-utils
byacc
cman
@ -10,6 +11,8 @@ crontabs
curl
dhclient
dmidecode
dnsmasq-utils
euca2ools
fence-agents
flex
gcc
@ -18,6 +21,7 @@ make
man
mcollective
mcollective-client
memcached
mysql
mysql-devel
mysql-server
@ -32,9 +36,11 @@ openstack-glance
openstack-keystone
openstack-nova
openstack-nova-novncproxy
patch
policycoreutils
puppet-2.7.19
puppet-server-2.7.19
python-cinder
python-devel
python-virtualenv
rabbitmq-server
@ -49,10 +55,12 @@ ruby-shadow
rubygem-mongrel
rubygems
scapy
screen
supervisor
syslinux
tcpdump
tftp-server
unzip
vim-enhanced
wget
xinetd