Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 15 commits
  • 17 files changed
  • 0 commit comments
  • 3 contributors
Commits on Mar 23, 2012
@dhellmann dhellmann Move the keep_old flag out of the packager and let the component chec…
…k it.
0ae7ff4
@dhellmann dhellmann pep8 changes eb68327
@dhellmann dhellmann Make all of the packager method signatures consistent by moving the l…
…oops for pre_install and post_install into the component method where the packager is invoked.

Have the component get a packager for each package and use that, falling back to a default provided by the distro. This will allow us to override the packaging rules for specific packages by providing a class reference in the distro file.
679f33b
@dhellmann dhellmann Move package-specific logic into custom package manager classes
and allow the distro file to specify when to use them. There
are two examples, one for Rabbit on Oneiric and another more general
for managing symlinks needed after installing a package with
Yum.
2340c1c
@harlowja harlowja Merge pull request #136 from dreamhost/packager-classes-956398
Create per-package installation classes
013e3cd
@harlowja harlowja Updating with outputting the rc file and warning about it already exi…
…sting
73e924f
@harlowja harlowja Fixed space dea7e55
@harlowja harlowja Merge remote-tracking branch 'yahoo/master' 40486e2
@harlowja harlowja Updating messaging about overwritting e59799c
@harlowja harlowja Merge pull request #138 from harlowja/master
Fixup euca.sh
ad4e9e7
@harlowja harlowja Add persona which should turn on quantum f164cfb
@harlowja harlowja Merge pull request #139 from harlowja/master
Add in devstack persona + quantum.
1b223ba
Commits on Mar 24, 2012
@lhrc-mikeyp lhrc-mikeyp Fix # 956269 - Fedora 16 support
Implement Fedora 16 support - updated distro yaml. added
distro specific module.
600a0c5
@harlowja harlowja Merge pull request #140 from lhrc-mikeyp/bug/956269
Fix # 956269 - Fedora 16 support
d6ee19c
@harlowja harlowja Fixed logger name after file name change. c6fe8d4
View
308 conf/distros/fedora-16.yaml
@@ -1,5 +1,5 @@
-# Fedora 16
---
+# Fedora 16 configuration for DevstackPy
name: fedora-16
distro_pattern: fedora-16
commands:
@@ -17,6 +17,8 @@ commands:
libvirt:
restart: service libvirtd restart
status: service libvirtd status
+ # This is just used to check that libvirt will work with a given protocol
+ verify: virsh -c %VIRT_PROTOCOL% uri
mysql:
create_db: mysql --user=%USER% --password=%PASSWORD% -e "CREATE DATABASE %DB%;"
drop_db: mysql --user=%USER% --password=%PASSWORD% -e "DROP DATABASE IF EXISTS
@@ -30,7 +32,7 @@ commands:
start: service mysqld start
status: service mysqld status
stop: service mysqld stop
- pip: python-pip
+ pip: pip-python
rabbit-mq:
change_password: rabbitmqctl change_password guest
restart: service rabbitmq-server restart
@@ -39,7 +41,11 @@ commands:
stop: service rabbitmq-server stop
components:
db:
- action_classes: {}
+ action_classes:
+ install: devstack.distros.fedora16:DBInstaller
+ start: devstack.components.db:DBRuntime
+ stop: devstack.components.db:DBRuntime
+ uninstall: devstack.components.db:DBUninstaller
packages:
- name: mysql
removable: true
@@ -48,7 +54,11 @@ components:
removable: true
version: 5.5*
general:
- action_classes: {}
+ action_classes:
+ install: devstack.components.pkglist:Installer
+ start: devstack.component:EmptyRuntime
+ stop: devstack.component:EmptyRuntime
+ uninstall: devstack.components.pkglist:Uninstaller
packages:
- name: curl
removable: false
@@ -135,14 +145,15 @@ components:
removable: false
version: 1.12*
glance:
- action_classes: {}
+ action_classes:
+ install: devstack.components.glance:GlanceInstaller
+ start: devstack.components.glance:GlanceRuntime
+ stop: devstack.components.glance:GlanceRuntime
+ uninstall: devstack.components.glance:GlanceUninstaller
packages:
- name: MySQL-python
removable: true
version: 1.2*
- - name: python-argparse
- removable: true
- version: 1.1*
- name: python-dateutil
removable: true
version: 1.5*
@@ -155,17 +166,30 @@ components:
- name: python-httplib2
removable: true
version: 0.6*
+ - name: python-paste-deploy
+ removable: true
+ version: 1.5.0*
- name: python-prettytable
removable: true
version: 0.5*
- name: python-routes
removable: true
version: 1.12*
+ - name: python-sqlalchemy
+ removable: true
+ version: 0.7.5*
+ - name: python-wsgiref
+ removable: true
+ version: 0.1.2*
- name: pyxattr
removable: true
version: 0.5*
horizon:
- action_classes: {}
+ action_classes:
+ install: devstack.distros.fedora16:HorizonInstaller
+ start: devstack.components.horizon:HorizonRuntime
+ stop: devstack.components.horizon:HorizonRuntime
+ uninstall: devstack.components.horizon:HorizonUninstaller
packages:
- name: Django
removable: true
@@ -179,6 +203,12 @@ components:
- name: mod_wsgi
removable: true
version: 3.3*
+ - name: python-anyjson
+ removable: true
+ version: 0.3.*
+ - name: python-boto
+ removable: true
+ version: 2.0*
- name: python-cherrypy
removable: true
version: 3.2*
@@ -191,6 +221,12 @@ components:
- name: python-eventlet
removable: true
version: 0.9*
+ - name: python-greenlet
+ removable: true
+ version: 0.3*
+ - name: python-httplib2
+ removable: true
+ version: 0.6*
- name: python-kombu
removable: true
version: 1.1*
@@ -219,7 +255,11 @@ components:
removable: true
version: 0.5*
keystone:
- action_classes: {}
+ action_classes:
+ install: devstack.components.keystone:KeystoneInstaller
+ start: devstack.components.keystone:KeystoneRuntime
+ stop: devstack.components.keystone:KeystoneRuntime
+ uninstall: devstack.components.keystone:KeystoneUninstaller
packages:
- name: MySQL-python
removable: true
@@ -227,12 +267,15 @@ components:
- name: cyrus-sasl-lib
removable: false
version: 2.1*
+ - name: cyrus-sasl-devel
+ removable: false
+ version: 2.1*
- name: openldap
removable: false
version: 2.4*
- - name: python-argparse
- removable: true
- version: 1.1*
+ - name: openldap-devel
+ removable: false
+ version: 2.4*
- name: python-eventlet
removable: true
version: 0.9*
@@ -276,81 +319,56 @@ components:
removable: false
version: 3.7*
keystone-client:
- action_classes: {}
+ action_classes:
+ install: devstack.components.keystone_client:KeyStoneClientInstaller
+ start: devstack.components.keystone_client:KeyStoneClientRuntime
+ stop: devstack.components.keystone_client:KeyStoneClientRuntime
+ uninstall: devstack.components.keystone_client:KeyStoneClientUninstaller
packages:
- - name: python-argparse
- removable: true
- version: 1.1*
- name: python-prettytable
removable: true
version: 0.5*
melange:
- action_classes: {}
+ action_classes:
+ install: devstack.components.melange:MelangeInstaller
+ start: devstack.components.melange:MelangeRuntime
+ stop: devstack.components.melange:MelangeRuntime
+ uninstall: devstack.components.melange:MelangeUninstaller
packages: null
- n-api:
- action_classes: {}
- packages:
- - name: python-dateutil
- removable: false
- version: 1.5*
- n-cpu:
- action_classes: {}
- packages:
- - name: iscsi-initiator-utils
- removable: true
- version: 6.2*
- - name: libvirt
- removable: true
- version: 0.9.6*
- - name: libvirt-client
- removable: true
- version: 0.9.6*
- - name: libvirt-python
- removable: true
- version: 0.9.6*
- - name: lvm2
- removable: true
- version: 2.02*
- - name: qemu-img
- removable: true
- version: 0.15*
- - name: qemu-system-x86
- removable: true
- version: 0.15*
- n-vnc:
- action_classes: {}
+ no-vnc:
+ action_classes:
+ install: devstack.components.novnc:NoVNCInstaller
+ start: devstack.components.novnc:NoVNCRuntime
+ stop: devstack.components.novnc:NoVNCRuntime
+ uninstall: devstack.components.novnc:NoVNCUninstaller
packages:
- name: numpy
- removable: true
+ removable: false
version: 1.6*
- n-vol:
- action_classes: {}
- packages:
- - name: iscsi-initiator-utils
- removable: true
- version: 6.2*
- - name: lvm2
- removable: true
- version: 2.02*
- - name: scsi-target-utils
- removable: true
- version: 1.0*
nova:
- action_classes: {}
+ action_classes:
+ install: devstack.distros.fedora16:NovaInstaller
+ start: devstack.components.nova:NovaRuntime
+ stop: devstack.components.nova:NovaRuntime
+ uninstall: devstack.components.nova:NovaUninstaller
packages:
- name: MySQL-python
removable: true
version: 1.2*
- name: dnsmasq
removable: false
- version: 2.58*
+ version: 2.5*
+ - name: dnsmasq-utils
+ removable: false
+ version: 2.5*
- name: ebtables
removable: false
version: 2.0*
- name: iptables
removable: false
version: 1.4*
- - name: iputils
+ # iputils includes arping for Fedora
+ - name: iputils
removable: false
version: 20101006*
- name: kpartx
@@ -398,9 +416,15 @@ components:
- name: python-netaddr
removable: true
version: 0.7*
+ - name: python-paramiko
+ removable: true
+ version: 1.7.7*
- name: python-paste
removable: true
version: 1.7.5*
+ - name: python-paste-deploy
+ removable: true
+ version: 1.5*
- name: python-routes
removable: true
version: 1.12*
@@ -416,18 +440,109 @@ components:
- name: sqlite
removable: false
version: 3.7*
+ - name: vconfig
+ removable: false
+ version: 1.9*
+ pips:
+ - name: Paste
+ version: 1.7.5.1
+ - name: PasteDeploy
+ version: '1.5'
+ - name: PasteScript
+ version: 1.7.5
+ - name: Routes
+ version: 1.12.3
+ - name: SQLAlchemy
+ version: 0.7.5
+ - name: Tempita
+ options: --upgrade
+ version: 0.5dev
+ - name: iso8601
+ version: 0.1.4
+ - name: pycrypto
+ options: --upgrade
+ version: '2.5'
+ - name: sqlalchemy-migrate
+ version: 0.7.2
+ subsystems:
+ api:
+ packages:
+ - name: python-dateutil
+ removable: false
+ version: 1.5*
+ cpu:
+ packages:
+ - name: iscsi-initiator-utils
+ removable: true
+ version: 6.2*
+ - name: libguestfs
+ removable: true
+ version: 1.16*
+ #TODO(mikeyp) libguestfs-mount 1.12 is what fedora
+ # provides - seems old compared to libguestfs v 1.16
+ - name: libguestfs-mount
+ removable: true
+ version: 1.12*
+ - name: libguestfs-tools
+ removable: true
+ version: 1.16*
+ - name: libvirt
+ removable: true
+ version: 0.9.6*
+ - name: libvirt-client
+ removable: true
+ version: 0.9.6*
+ - name: libvirt-python
+ removable: true
+ version: 0.9.6*
+ - name: lvm2
+ removable: true
+ version: 2.02*
+ - name: qemu-img
+ removable: true
+ version: 0.15*
+ - name: qemu-kvm
+ removable: true
+ version: 0.15*
+ - name: qemu-system-x86
+ removable: true
+ version: 0.15*
+ vol:
+ packages:
+ - name: iscsi-initiator-utils
+ removable: true
+ version: 6.2*
+ - name: lvm2
+ removable: true
+ version: 2.02*
+ - name: scsi-target-utils
+ removable: true
+ version: 1.0*
nova-client:
- action_classes: {}
+ action_classes:
+ install: devstack.components.nova_client:NovaClientInstaller
+ start: devstack.components.nova_client:NovaClientRuntime
+ stop: devstack.components.nova_client:NovaClientRuntime
+ uninstall: devstack.components.nova_client:NovaClientUninstaller
packages:
- - name: python-argparse
- removable: true
- version: 1.1*
- name: python-prettytable
removable: true
version: 0.5*
quantum:
- action_classes: {}
+ action_classes:
+ install: devstack.components.quantum:QuantumInstaller
+ start: devstack.components.quantum:QuantumRuntime
+ stop: devstack.components.quantum:QuantumRuntime
+ uninstall: devstack.components.quantum:QuantumUninstaller
packages:
+ - name: libxml2-python
+ removable: false
+ version: 2.7*
+ # TODO(mikeyp) verify libxml2-python is really needed in addition
+ # to libxml2-python.
+ - name: python-lxml
+ removable: true
+ version: 2.3*
- name: python-eventlet
removable: true
version: 0.9*
@@ -437,9 +552,6 @@ components:
- name: python-greenlet
removable: true
version: 0.3*
- - name: python-lxml
- removable: true
- version: 2.3*
- name: python-paste
removable: true
version: 1.7*
@@ -449,23 +561,35 @@ components:
- name: python-routes
removable: true
version: 1.12*
+ pips:
+ - name: Paste
+ version: 1.7.5.1
+ - name: PasteDeploy
+ version: '1.5'
+ - name: PasteScript
+ version: 1.7.5
+ - name: Routes
+ version: 1.12.3
+ - name: SQLAlchemy
+ version: 0.7.5
+ - name: sqlalchemy-migrate
+ version: 0.7.2
quantum-client:
- action_classes: {}
+ action_classes:
+ install: devstack.components.quantum_client:QuantumClientInstaller
+ start: devstack.components.quantum_client:QuantumClientRuntime
+ stop: devstack.components.quantum_client:QuantumClientRuntime
+ uninstall: devstack.components.quantum_client:QuantumClientUninstaller
packages:
- name: python-gflags
removable: true
version: 1.5*
- quantum-openvswitch:
- action_classes: {}
- packages:
- - name: MySQL-python
- removable: true
- version: 1.2*
- - name: python-sqlalchemy
- removable: true
- version: 0.7*
rabbit-mq:
- action_classes: {}
+ action_classes:
+ install: devstack.components.rabbit:RabbitInstaller
+ start: devstack.components.rabbit:RabbitRuntime
+ stop: devstack.components.rabbit:RabbitRuntime
+ uninstall: devstack.components.rabbit:RabbitUninstaller
packages:
- name: rabbitmq-server
pre-install:
@@ -483,7 +607,11 @@ components:
removable: true
version: 2.6*
swift:
- action_classes: {}
+ action_classes:
+ install: devstack.components.swift:SwiftInstaller
+ start: devstack.components.swift:SwiftRuntime
+ stop: devstack.components.swift:SwiftRuntime
+ uninstall: devstack.components.swift:SwiftUninstaller
packages:
- name: memcached
removable: true
@@ -503,6 +631,11 @@ components:
- name: python-paste-deploy
removable: true
version: 1.5*
+ # TODO(mikeyp) resolve python-simplejson, listed in devstack
+ # is it really needed ?
+ - name : python-simplejson
+ version: 2.1.6*
+ removable: true
- name: python-webob
removable: true
version: 1.0*
@@ -512,6 +645,9 @@ components:
- name: sqlite
removable: true
version: 3.7*
+ - name: xfsprogs
+ removable: true
+ version: 3.1*
packager_name: devstack.packaging.yum:YumPackager
...
View
8 conf/distros/rhel-6.yaml
@@ -2,6 +2,7 @@
# RedHat Enterprise Linux 6
name: rhel-6
distro_pattern: redhat-6(.*)
+packager_name: devstack.packaging.yum:YumPackager
commands:
apache:
restart: service httpd restart
@@ -250,6 +251,12 @@ components:
name: python-webob1.0
removable: true
version: 1.0*
+ packager_name: devstack.distros.rhel6:YumPackagerWithRelinks
+ packager_options:
+ links:
+ - source: /usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/
+ target: /usr/lib/python2.6/site-packages/webob
+
pips:
- name: CherryPy
version: 3.2.2
@@ -659,6 +666,5 @@ components:
start: devstack.components.swift:SwiftRuntime
stop: devstack.components.swift:SwiftRuntime
uninstall: devstack.components.swift:SwiftUninstaller
-packager_name: devstack.distros.rhel6:YumPackager
...
View
3  conf/distros/ubuntu-oneiric.yaml
@@ -2,7 +2,7 @@
# Ubuntu 11 (Oneiric)
distro_pattern: Ubuntu(.*)oneiric
name: ubuntu-oneiric
-packager_name: devstack.distros.oneiric:AptPackager
+packager_name: devstack.packaging.apt:AptPackager
commands:
apache:
restart: service apache2 restart
@@ -617,6 +617,7 @@ components:
- name: rabbitmq-server
removable: true
version: 2.5*
+ packager_name: devstack.distros.oneiric:RabbitPackager
swift:
action_classes:
install: devstack.components.swift:SwiftInstaller
View
46 conf/personas/devstack-quantum.sh.yaml
@@ -0,0 +1,46 @@
+---
+components:
+# Order matters here!
+- general
+- db
+- rabbit-mq
+- keystone-client
+- keystone
+- glance
+- quantum
+- quantum-client
+- nova-client
+- nova
+- no-vnc
+- horizon
+description: Devstack.sh matching component installation + quantum!
+options:
+ no-vnc:
+ # This is the nova component name (we need this to hook into the nova conf...)
+ nova: nova
+ nova:
+ - no-vnc
+ # Signal nova we are using quantum
+ - quantum
+ keystone:
+ # Signal keystone we are using quantum
+ - quantum
+subsystems:
+ glance:
+ - api
+ - reg
+ nova:
+ - api
+ - cauth
+ - cert
+ - cpu
+ - net
+ - sched
+ - vol
+ - xvnc
+supports:
+- rhel-6
+- ubuntu-oneiric
+- fedora-16
+...
+
View
54 devstack/component.py
@@ -19,6 +19,7 @@
from devstack import cfg_helpers
from devstack import downloader as down
from devstack import exceptions as excp
+from devstack import importer
from devstack import log as logging
from devstack import pip
from devstack import settings
@@ -82,7 +83,6 @@ def __init__(self,
# Parts of the global runner context that we use
self.cfg = runner.cfg
self.pw_gen = runner.pw_gen
- self.packager = runner.pkg_manager
self.distro = runner.distro
# Required component directories
@@ -127,9 +127,30 @@ def is_installed(self):
return tr.TraceReader(tr.trace_fn(self.trace_dir, tr.IN_TRACE)).exists()
-class PkgInstallComponent(ComponentBase):
+class PackageBasedComponentMixin(object):
+ """Mix this into classes that need to manipulate
+ OS-level packages.
+ """
+ PACKAGER_KEY_NAME = 'packager_name'
+
+ def __init__(self):
+ self.default_packager = self.distro.get_default_package_manager()
+
+ def get_packager(self, pkg_info):
+ if self.PACKAGER_KEY_NAME in pkg_info:
+ packager_name = pkg_info[self.PACKAGER_KEY_NAME]
+ LOG.debug('Loading custom package manager %s', packager_name)
+ packager = importer.import_entry_point(packager_name)(self.distro)
+ else:
+ LOG.debug('Using default package manager')
+ packager = self.default_packager
+ return packager
+
+
+class PkgInstallComponent(ComponentBase, PackageBasedComponentMixin):
def __init__(self, *args, **kargs):
ComponentBase.__init__(self, *args, **kargs)
+ PackageBasedComponentMixin.__init__(self)
self.tracewriter = tr.TraceWriter(tr.trace_fn(self.trace_dir,
tr.IN_TRACE))
self.packages = kargs.get('packages', list())
@@ -185,8 +206,10 @@ def _get_packages(self):
for name in self.desired_subsystems:
if name in self.subsystem_info:
# Todo handle duplicates/version differences?
- LOG.debug("Extending package list with packages for subsystem %s" % (name))
- subsystem_pkgs = self.subsystem_info[name].get('packages', list())
+ LOG.debug(
+ "Extending package list with packages for subsystem %s",
+ name)
+ subsystem_pkgs = self.subsystem_info[name].get('packages', [])
pkg_list.extend(subsystem_pkgs)
return pkg_list
@@ -196,11 +219,13 @@ def install(self):
pkgs = self._get_packages()
if pkgs:
pkg_names = set([p['name'] for p in pkgs])
- LOG.info("Setting up %s packages (%s)" % (len(pkg_names), ", ".join(pkg_names)))
+ LOG.info("Setting up %s packages (%s)",
+ len(pkg_names), ", ".join(pkg_names))
with utils.progress_bar(INSTALL_TITLE, len(pkgs)) as p_bar:
for (i, p) in enumerate(pkgs):
self.tracewriter.package_installed(p)
- self.packager.install(p)
+ packager = self.get_packager(p)
+ packager.install(p)
p_bar.update(i + 1)
else:
LOG.info('No packages to install for %s',
@@ -211,13 +236,17 @@ def pre_install(self):
pkgs = self._get_packages()
if pkgs:
mp = self._get_param_map(None)
- self.packager.pre_install(pkgs, mp)
+ for p in pkgs:
+ packager = self.get_packager(p)
+ packager.pre_install(p, mp)
def post_install(self):
pkgs = self._get_packages()
if pkgs:
mp = self._get_param_map(None)
- self.packager.post_install(pkgs, mp)
+ for p in pkgs:
+ packager = self.get_packager(p)
+ packager.post_install(p, mp)
def _get_config_files(self):
return list()
@@ -347,9 +376,10 @@ def install(self):
return trace_dir
-class PkgUninstallComponent(ComponentBase):
+class PkgUninstallComponent(ComponentBase, PackageBasedComponentMixin):
def __init__(self, *args, **kargs):
ComponentBase.__init__(self, *args, **kargs)
+ PackageBasedComponentMixin.__init__(self)
self.tracereader = tr.TraceReader(tr.trace_fn(self.trace_dir,
tr.IN_TRACE))
self.keep_old = kargs.get('keep_old')
@@ -398,6 +428,9 @@ def pre_uninstall(self):
pass
def _uninstall_pkgs(self):
+ if self.keep_old:
+ LOG.info('Keep-old flag set, not removing packages')
+ return
pkgs = self.tracereader.packages_installed()
if pkgs:
pkg_names = set([p['name'] for p in pkgs])
@@ -406,7 +439,8 @@ def _uninstall_pkgs(self):
which_removed = set()
with utils.progress_bar(UNINSTALL_TITLE, len(pkgs), reverse=True) as p_bar:
for (i, p) in enumerate(pkgs):
- if self.packager.remove(p):
+ packager = self.get_packager(p)
+ if packager.remove(p):
which_removed.add(p['name'])
p_bar.update(i + 1)
LOG.info("Actually removed %s packages (%s)",
View
1  devstack/components/quantum.py
@@ -73,6 +73,7 @@ def __init__(self, *args, **kargs):
self.q_vswitch_service = False
plugin = self.cfg.getdefaulted("quantum", "q_plugin", VSWITCH_PLUGIN)
if plugin == VSWITCH_PLUGIN:
+ # FIXME: Make these subsystems
self.q_vswitch_agent = True
self.q_vswitch_service = True
View
6 devstack/distro.py
@@ -128,9 +128,9 @@ def supports_distro(self, distro_name):
"""
return bool(self._distro_pattern.search(distro_name))
- def get_packager_factory(self):
- """Return a factory for a package manager."""
- return importer.import_entry_point(self._packager_name)
+ def get_default_package_manager(self):
+ """Return a package manager that will work for this distro."""
+ return importer.import_entry_point(self._packager_name)(self)
def extract_component(self, name, action):
"""Return the class + component info to use for doing the action w/the component."""
View
105 devstack/distros/fedora16.py
@@ -0,0 +1,105 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
+# Copyright (C) 2012 New Dream Network, LLC (DreamHost) All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+"""Platform-specific logic for RedHat Fedora 16 components.
+"""
+
+from devstack import log as logging
+from devstack import shell as sh
+from devstack import utils
+
+from devstack.components import db
+from devstack.components import horizon
+from devstack.components import nova
+
+from devstack.packaging import yum
+
+LOG = logging.getLogger(__name__)
+
+SOCKET_CONF = "/etc/httpd/conf.d/wsgi-socket-prefix.conf"
+HTTPD_CONF = '/etc/httpd/conf/httpd.conf'
+
+# See: http://wiki.libvirt.org/page/SSHPolicyKitSetup
+# FIXME: take from distro config??
+# TODO(mikeyp) check correct path for fedora
+LIBVIRT_POLICY_FN = "/etc/polkit-1/localauthority/50-local.d/50-libvirt-access.pkla"
+LIBVIRT_POLICY_CONTENTS = """
+[libvirt Management Access]
+Identity={idents}
+Action=org.libvirt.unix.manage
+ResultAny=yes
+ResultInactive=yes
+ResultActive=yes
+"""
+DEF_IDENT = 'unix-group:libvirtd'
+
+
+class DBInstaller(db.DBInstaller):
+
+ def _configure_db_confs(self):
+ LOG.info("Fixing up %s mysql configs.", self.distro.name)
+ fc = sh.load_file('/etc/my.cnf')
+ lines = fc.splitlines()
+ new_lines = list()
+ for line in lines:
+ if line.startswith('skip-grant-tables'):
+ line = '#' + line
+ new_lines.append(line)
+ fc = utils.joinlinesep(*new_lines)
+ with sh.Rooted(True):
+ sh.write_file('/etc/my.cnf', fc)
+
+
+class HorizonInstaller(horizon.HorizonInstaller):
+
+ def _config_fixups(self):
+ (user, group) = self._get_apache_user_group()
+ # This is recorded so it gets cleaned up during uninstall
+ self.tracewriter.file_touched(SOCKET_CONF)
+ LOG.info("Fixing up %s and %s files" % (SOCKET_CONF, HTTPD_CONF))
+ with sh.Rooted(True):
+ # Fix the socket prefix to someplace we can use
+ fc = "WSGISocketPrefix %s" % (sh.joinpths(self.log_dir, "wsgi-socket"))
+ sh.write_file(SOCKET_CONF, fc)
+ # Now adjust the run user and group (of httpd.conf)
+ new_lines = list()
+ for line in sh.load_file(HTTPD_CONF).splitlines():
+ if line.startswith("User "):
+ line = "User %s" % (user)
+ if line.startswith("Group "):
+ line = "Group %s" % (group)
+ new_lines.append(line)
+ sh.write_file(HTTPD_CONF, utils.joinlinesep(*new_lines))
+
+
+class NovaInstaller(nova.NovaInstaller):
+
+ def configure(self):
+ configs_made = nova.NovaInstaller.configure(self)
+ driver_canon = nova.canon_virt_driver(self.cfg.get('nova', 'virt_driver'))
+ if driver_canon == 'libvirt':
+ ident_users = set()
+ ident_users.add(DEF_IDENT)
+ ident_users.add('unix-user:%s' % (sh.getuser()))
+ fc_contents = LIBVIRT_POLICY_CONTENTS.format(idents=(";".join(ident_users)))
+ with sh.Rooted(True):
+ dirs_made = sh.mkdirslist(sh.dirname(LIBVIRT_POLICY_FN))
+ sh.write_file(LIBVIRT_POLICY_FN, fc_contents)
+ self.tracewriter.cfg_file_written(LIBVIRT_POLICY_FN)
+ self.tracewriter.dirs_made(*dirs_made)
+ configs_made += 1
+ return configs_made
View
53 devstack/distros/oneiric.py
@@ -46,33 +46,30 @@ def _configure_db_confs(self):
sh.write_file('/etc/mysql/my.cnf', fc)
-class AptPackager(apt.AptPackager):
+class RabbitPackager(apt.AptPackager):
- def _remove_special(self, name, info):
- if name == 'rabbitmq-server':
- #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878597
- #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878600
- LOG.debug("Handling special remove of %s." % (name))
- pkg_full = self._format_pkg_name(name, info.get("version"))
- cmd = apt.APT_REMOVE + [pkg_full]
- self._execute_apt(cmd)
- #probably useful to do this
- time.sleep(1)
- #purge
- cmd = apt.APT_PURGE + [pkg_full]
- self._execute_apt(cmd)
- return True
- return False
+ def _remove(self, pkg):
+ #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878597
+ #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878600
+ name = pkg['name']
+ LOG.debug("Handling special remove of %s." % (name))
+ pkg_full = self._format_pkg_name(name, pkg.get("version"))
+ cmd = apt.APT_REMOVE + [pkg_full]
+ self._execute_apt(cmd)
+ #probably useful to do this
+ time.sleep(1)
+ #purge
+ cmd = apt.APT_PURGE + [pkg_full]
+ self._execute_apt(cmd)
+ return True
- def _install_special(self, name, info):
- if name == 'rabbitmq-server':
- #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878597
- #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878600
- LOG.debug("Handling special install of %s." % (name))
- #this seems to be a temporary fix for that bug
- with tempfile.TemporaryFile() as f:
- pkg_full = self._format_pkg_name(name, info.get("version"))
- cmd = apt.APT_INSTALL + [pkg_full]
- self._execute_apt(cmd, stdout_fh=f, stderr_fh=f)
- return True
- return False
+ def install(self, pkg):
+ #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878597
+ #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878600
+ name = pkg['name']
+ LOG.debug("Handling special install of %s." % (name))
+ #this seems to be a temporary fix for that bug
+ with tempfile.TemporaryFile() as f:
+ pkg_full = self._format_pkg_name(name, pkg.get("version"))
+ cmd = apt.APT_INSTALL + [pkg_full]
+ self._execute_apt(cmd, stdout_fh=f, stderr_fh=f)
View
53 devstack/distros/rhel6.py
@@ -33,18 +33,6 @@
SOCKET_CONF = "/etc/httpd/conf.d/wsgi-socket-prefix.conf"
HTTPD_CONF = '/etc/httpd/conf/httpd.conf'
-# Need to relink for rhel (not a bug!)
-RHEL_RELINKS = {
- 'python-webob1.0': (
- '/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/',
- '/usr/lib/python2.6/site-packages/webob'
- ),
- 'python-nose1.1': (
- '/usr/lib/python2.6/site-packages/nose-1.1.2-py2.6.egg/nose/',
- '/usr/lib/python2.6/site-packages/nose',
- )
-}
-
# See: http://wiki.libvirt.org/page/SSHPolicyKitSetup
# FIXME: take from distro config??
LIBVIRT_POLICY_FN = "/etc/polkit-1/localauthority/50-local.d/50-libvirt-access.pkla"
@@ -116,28 +104,29 @@ def configure(self):
return configs_made
-class YumPackager(yum.YumPackager):
+class YumPackagerWithRelinks(yum.YumPackager):
- def _remove_special(self, name, info):
- if name in RHEL_RELINKS:
- # Note: we don't return true here so that
- # the normal package cleanup happens...
- (_, tgt) = RHEL_RELINKS.get(name)
- if sh.islink(tgt):
- sh.unlink(tgt)
- return False
+ def _remove(self, pkg):
+ response = yum.YumPackager._remove(self, pkg)
+ if response:
+ options = pkg.get('packager_options', {})
+ links = options.get('links', [])
+ for src, tgt in links:
+ if sh.islink(tgt):
+ sh.unlink(tgt)
+ return response
- def _install_special(self, name, info):
- if name in RHEL_RELINKS:
- full_pkg_name = self._format_pkg_name(name, info.get("version"))
- install_cmd = yum.YUM_INSTALL + [full_pkg_name]
- self._execute_yum(install_cmd)
- (src, tgt) = RHEL_RELINKS.get(name)
+ def install(self, pkg):
+ yum.YumPackager.install(self, pkg)
+ options = pkg.get('packager_options', {})
+ links = options.get('links', [])
+ for src, tgt in links:
if not sh.islink(tgt):
- # This is actually a feature, EPEL must not conflict with RHEL, so X pkg installs newer version in parallel.
+ # This is actually a feature, EPEL must not conflict
+ # with RHEL, so X pkg installs newer version in
+ # parallel.
#
- # This of course doesn't work when running from git like devstack does....
+ # This of course doesn't work when running from git
+ # like devstack does....
sh.symlink(src, tgt)
- return True
- else:
- return False
+ return True
View
2  devstack/image/uploader.py
@@ -29,7 +29,7 @@
from devstack.components import keystone
-LOG = log.getLogger("devstack.image.creator")
+LOG = log.getLogger("devstack.image.uploader")
# These are used when looking inside archives
KERNEL_FN_MATCH = re.compile(r"(.*)vmlinuz$", re.I)
View
52 devstack/packager.py
@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import abc
+
from devstack import decorators
from devstack import log as logging
from devstack import utils
@@ -22,36 +24,36 @@
class Packager(object):
+ __meta__ = abc.ABCMeta
@decorators.log_debug
- def __init__(self, distro, keep_packages):
+ def __init__(self, distro):
self.distro = distro
- self.keep_packages = keep_packages
+ @abc.abstractmethod
def install(self, pkg):
- raise NotImplementedError()
+ pass
+
+ @abc.abstractmethod
+ def _remove(self, pkg):
+ pass
def remove(self, pkg):
- if self.keep_packages:
+ removable = pkg.get('removable', True)
+ if not removable:
return False
- else:
- return self._remove(pkg)
-
- def pre_install(self, pkgs, params=None):
- for info in pkgs:
- cmds = info.get('pre-install')
- if cmds:
- LOG.info("Running pre-install commands for package %s.",
- info['name'])
- utils.execute_template(*cmds, params=params)
-
- def post_install(self, pkgs, params=None):
- for info in pkgs:
- cmds = info.get('post-install')
- if cmds:
- LOG.info("Running post-install commands for package %s.",
- info['name'])
- utils.execute_template(*cmds, params=params)
-
- def _remove(self, pkg):
- raise NotImplementedError()
+ return self._remove(pkg)
+
+ def pre_install(self, pkg, params=None):
+ cmds = pkg.get('pre-install')
+ if cmds:
+ LOG.info("Running pre-install commands for package %s.",
+ pkg['name'])
+ utils.execute_template(*cmds, params=params)
+
+ def post_install(self, pkg, params=None):
+ cmds = pkg.get('post-install')
+ if cmds:
+ LOG.info("Running post-install commands for package %s.",
+ pkg['name'])
+ utils.execute_template(*cmds, params=params)
View
25 devstack/packaging/apt.py
@@ -40,8 +40,9 @@
class AptPackager(pack.Packager):
- def __init__(self, distro, keep_packages):
- pack.Packager.__init__(self, distro, keep_packages)
+ def __init__(self, distro):
+ pack.Packager.__init__(self, distro)
+ # FIXME: Should this be coming from a setting somewhere?
self.auto_remove = True
def _format_pkg_name(self, name, version):
@@ -58,12 +59,7 @@ def _execute_apt(self, cmd, **kargs):
**kargs)
def _remove(self, pkg):
- removable = pkg.get('removable', True)
- if not removable:
- return False
name = pkg['name']
- if self._remove_special(name, pkg):
- return True
pkg_full = self._format_pkg_name(name, pkg.get("version"))
cmd = APT_DO_REMOVE + [pkg_full]
self._execute_apt(cmd)
@@ -73,15 +69,6 @@ def _remove(self, pkg):
def install(self, pkg):
name = pkg['name']
- if self._install_special(name, pkg):
- return
- else:
- pkg_full = self._format_pkg_name(name, pkg.get("version"))
- cmd = APT_INSTALL + [pkg_full]
- self._execute_apt(cmd)
-
- def _remove_special(self, name, info):
- return False
-
- def _install_special(self, name, info):
- return False
+ pkg_full = self._format_pkg_name(name, pkg.get("version"))
+ cmd = APT_INSTALL + [pkg_full]
+ self._execute_apt(cmd)
View
16 devstack/packaging/yum.py
@@ -32,8 +32,8 @@
class YumPackager(pack.Packager):
- def __init__(self, distro, keep_packages):
- pack.Packager.__init__(self, distro, keep_packages)
+ def __init__(self, distro):
+ pack.Packager.__init__(self, distro)
def _format_pkg_name(self, name, version):
if version:
@@ -63,14 +63,10 @@ def install(self, pkg):
self._execute_yum(cmd)
def _remove(self, pkg):
- removable = pkg.get('removable', True)
- if not removable:
- return False
name = pkg['name']
if self._remove_special(name, pkg):
return True
- else:
- pkg_full = self._format_pkg_name(name, pkg.get("version"))
- cmd = YUM_REMOVE + [pkg_full]
- self._execute_yum(cmd)
- return True
+ pkg_full = self._format_pkg_name(name, pkg.get("version"))
+ cmd = YUM_REMOVE + [pkg_full]
+ self._execute_yum(cmd)
+ return True
View
3  devstack/progs/actions.py
@@ -35,12 +35,10 @@ def __init__(self,
distro,
cfg,
pw_gen,
- pkg_manager,
**kargs):
self.distro = distro
self.cfg = cfg
self.pw_gen = pw_gen
- self.pkg_manager = pkg_manager
self.keep_old = kargs.get('keep_old', False)
self.force = kargs.get('force', False)
@@ -135,7 +133,6 @@ def _handle_prereq(self, persona, instances, root_dir):
prereq = self.PREREQ(self.distro,
self.cfg,
self.pw_gen,
- self.pkg_manager,
keep_old=self.keep_old,
force=self.force,
)
View
70 euca.sh
@@ -15,18 +15,34 @@ if [[ -n "$2" ]]; then
fi
# Find the other rc files
+RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
CORE_RC="os-core.rc"
-GEN_CMD="stack -a install"
+EC2_RC="os-ec2.rc"
-if [ ! -f $CORE_RC ];
+if [ ! -f $RC_DIR/$CORE_RC ];
then
- echo "File '$CORE_RC' needed before running '$ME'"
+ GEN_CMD="stack -a install"
+ echo "File '$RC_DIR/$CORE_RC' needed before running '$ME'"
echo "Please run './$GEN_CMD' to get this file."
exit 1
fi
# Get user configuration
-source $CORE_RC
+source $RC_DIR/$CORE_RC
+
+# Woah!
+if [ -f $RC_DIR/$EC2_RC ];
+then
+ echo "Woah cowboy you seem to already have '$RC_DIR/$EC2_RC'!"
+ while true; do
+ read -p "Overwrite it and continue? " yn
+ case $yn in
+ [Yy]* ) break;;
+ [Nn]* ) exit 1;;
+ * ) echo "Please answer y or n.";;
+ esac
+ done
+fi
# Bug https://bugs.launchpad.net/keystone/+bug/962600
unset SERVICE_TOKEN
@@ -36,21 +52,45 @@ unset SERVICE_ENDPOINT
set -x
# Set the ec2 url so euca2ools works
-export EC2_URL=$(keystone catalog --service ec2 | awk '/ publicURL / { print $4 }')
+EC2_URL=$(keystone catalog --service ec2 | awk '/ publicURL / { print $4 }')
# Create EC2 credentials for the current user
CREDS=$(keystone ec2-credentials-create)
-export EC2_ACCESS_KEY=$(echo "$CREDS" | awk '/ access / { print $4 }')
-export EC2_SECRET_KEY=$(echo "$CREDS" | awk '/ secret / { print $4 }')
+EC2_ACCESS_KEY=$(echo "$CREDS" | awk '/ access / { print $4 }')
+EC2_SECRET_KEY=$(echo "$CREDS" | awk '/ secret / { print $4 }')
# Euca2ools Certificate stuff for uploading bundles
NOVA_KEY_DIR=${NOVA_KEY_DIR:-$RC_DIR}
-export S3_URL=$(keystone catalog --service s3 | awk '/ publicURL / { print $4 }')
-export EC2_USER_ID=42 # nova does not use user id, but bundling requires it
-export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
-export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
-export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem
-export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set
-alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user ${EC2_USER_ID} --ec2cert ${NOVA_CERT}"
-alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
+S3_URL=$(keystone catalog --service s3 | awk '/ publicURL / { print $4 }')
+
+# ??
+EC2_USER_ID=42
+
+# For a comment
+NOW=`date`
+
+# Make a nice file for u
+ENV_FN=$RC_DIR/$EC2_RC
+echo "Making $ENV_FN"
+
+cat > $ENV_FN <<EOF
+# Created on $NOW
+
+# General goodies
+export EC2_ACCESS_KEY=$EC2_ACCESS_KEY
+export EC2_SECRET_KEY=$EC2_SECRET_KEY
+export NOVA_KEY_DIR=$NOVA_KEY_DIR
+export EC2_URL=$EC2_URL
+export S3_URL=$S3_URL
+export EC2_USER_ID=$EC2_USER_ID
+
+export NOVA_CERT=\${NOVA_KEY_DIR}/cacert.pem
+export EC2_CERT=\${NOVA_KEY_DIR}/cert.pem
+export EC2_PRIVATE_KEY=\${NOVA_KEY_DIR}/pk.pem
+export EUCALYPTUS_CERT=\${NOVA_CERT} # euca-bundle-image seems to require this set
+
+# Aliases
+alias ec2-bundle-image="ec2-bundle-image --cert \${EC2_CERT} --privatekey \${EC2_PRIVATE_KEY} --user \${EC2_USER_ID} --ec2cert \${NOVA_CERT}"
+alias ec2-upload-bundle="ec2-upload-bundle -a \${EC2_ACCESS_KEY} -s \${EC2_SECRET_KEY} --url \${S3_URL} --ec2cert \${NOVA_CERT}"
+EOF
View
3  stack
@@ -150,14 +150,11 @@ def run(args):
persona_inst = load_verify_persona(persona_fn, dist)
config = cfg.get_config()
pw_gen = passwords.PasswordGenerator(config, args.get('prompt_for_passwords', True))
- pkg_cls = dist.get_packager_factory()
- pkg_manager = pkg_cls(dist, args.get('keep_old', False))
runner_factory = actions.get_runner_factory(action)
runner = runner_factory(dist,
config,
pw_gen,
- pkg_manager,
**args)
LOG.info("Starting action %r on %s for distro: %r" % (action, date.rcf8222date(), dist.name))

No commit comments for this range

Something went wrong with that request. Please try again.