Overall refresh to current install from source approach
This commit is contained in:
parent
f0ecd9624c
commit
6a427372de
6
Makefile
6
Makefile
@ -2,7 +2,7 @@
|
|||||||
PYTHON := /usr/bin/env python
|
PYTHON := /usr/bin/env python
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@flake8 --exclude hooks/charmhelpers hooks unit_tests tests
|
@flake8 --exclude hooks/charmhelpers actions hooks unit_tests tests
|
||||||
@charm proof
|
@charm proof
|
||||||
|
|
||||||
unit_test:
|
unit_test:
|
||||||
@ -14,7 +14,9 @@ test:
|
|||||||
#NOTE(beisner): can remove -v after bug 1320357 is fixed
|
#NOTE(beisner): can remove -v after bug 1320357 is fixed
|
||||||
# https://bugs.launchpad.net/amulet/+bug/1320357
|
# https://bugs.launchpad.net/amulet/+bug/1320357
|
||||||
@juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
|
@juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
|
||||||
00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse
|
00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse \
|
||||||
|
16-basic-trusty-icehouse-git 17-basic-trusty-juno \
|
||||||
|
18-basic-trusty-juno-git
|
||||||
|
|
||||||
bin/charm_helpers_sync.py:
|
bin/charm_helpers_sync.py:
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
|
172
README.md
172
README.md
@ -121,98 +121,90 @@ enabled-services: Can be used to separate cinder services between service
|
|||||||
Deploying from source
|
Deploying from source
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
The minimal openstack-origin-git config required to deploy from source is:
|
The minimum openstack-origin-git config required to deploy from source is:
|
||||||
|
|
||||||
openstack-origin-git:
|
openstack-origin-git:
|
||||||
"{'cinder':
|
"repositories:
|
||||||
{'repository': 'git://git.openstack.org/openstack/cinder.git',
|
- {name: requirements,
|
||||||
'branch': 'stable/icehouse'}}"
|
repository: 'git://git.openstack.org/openstack/requirements',
|
||||||
|
branch: stable/juno}
|
||||||
|
- {name: cinder,
|
||||||
|
repository: 'git://git.openstack.org/openstack/cinder',
|
||||||
|
branch: stable/juno}"
|
||||||
|
|
||||||
If you specify a 'requirements' repository, it will be used to update the
|
Note that there are only two 'name' values the charm knows about: 'requirements'
|
||||||
requirements.txt files of all other git repos that it applies to, before
|
and 'cinder'. These repositories must correspond to these 'name' values.
|
||||||
they are installed:
|
Additionally, the requirements repository must be specified first and the
|
||||||
|
cinder repository must be specified last. All other repostories are installed
|
||||||
|
in the order in which they are specified.
|
||||||
|
|
||||||
|
The following is a full list of current tip repos (may not be up-to-date):
|
||||||
|
|
||||||
openstack-origin-git:
|
openstack-origin-git:
|
||||||
"{'requirements':
|
"repositories:
|
||||||
{'repository': 'git://git.openstack.org/openstack/requirements.git',
|
- {name: requirements,
|
||||||
'branch': 'master'},
|
repository: 'git://git.openstack.org/openstack/requirements',
|
||||||
'cinder':
|
branch: master}
|
||||||
{'repository': 'git://git.openstack.org/openstack/cinder.git',
|
- {name: oslo-concurrency,
|
||||||
'branch': 'master'}}"
|
repository: 'git://git.openstack.org/openstack/oslo.concurrency',
|
||||||
|
branch: master}
|
||||||
Note that there are only two key values the charm knows about for the outermost
|
- {name: oslo-config,
|
||||||
dictionary: 'cinder' and 'requirements'. These repositories must correspond to
|
repository: 'git://git.openstack.org/openstack/oslo.config',
|
||||||
these keys. If the requirements repository is specified, it will be installed
|
branch: master}
|
||||||
first. The cinder repository is always installed last. All other repostories
|
- {name: oslo-context,
|
||||||
will be installed in between.
|
repository': 'git://git.openstack.org/openstack/oslo.context.git',
|
||||||
|
branch: master}
|
||||||
NOTE(coreycb): The following is temporary to keep track of the full list of
|
- {name: oslo-db,
|
||||||
current tip repos (may not be up-to-date).
|
repository: 'git://git.openstack.org/openstack/oslo.db',
|
||||||
|
branch: master}
|
||||||
openstack-origin-git:
|
- {name: oslo-i18n,
|
||||||
"{'requirements':
|
repository: 'git://git.openstack.org/openstack/oslo.i18n',
|
||||||
{'repository': 'git://git.openstack.org/openstack/requirements.git',
|
branch: master}
|
||||||
'branch': 'master'},
|
- {name: oslo-messaging,
|
||||||
'keystonemiddleware:
|
repository: 'git://git.openstack.org/openstack/oslo.messaging.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/keystonemiddleware.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: oslo-serialization,
|
||||||
'oslo-concurrency':
|
repository: 'git://git.openstack.org/openstack/oslo.serialization',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.concurrency.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: oslo-utils,
|
||||||
'oslo-config':
|
repository: 'git://git.openstack.org/openstack/oslo.utils',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.config.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: oslo-rootwrap,
|
||||||
'oslo-context':
|
repository: 'git://git.openstack.org/openstack/oslo.rootwrap.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.context.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: oslo-vmware,
|
||||||
'oslo-db':
|
repository: 'git://git.openstack.org/openstack/oslo.vmware.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.db.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: osprofiler,
|
||||||
'oslo-i18n':
|
repository: 'git://git.openstack.org/stackforge/osprofiler.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.i18n.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: pbr,
|
||||||
'oslo-messaging':
|
repository: 'git://git.openstack.org/openstack-dev/pbr',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.messaging.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: python-barbicanclient,
|
||||||
'oslo-rootwrap':
|
repository: 'git://git.openstack.org/openstack/python-barbicanclient.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.rootwrap.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: python-glanceclient,
|
||||||
'oslo-serialization':
|
repository: 'git://git.openstack.org/openstack/python-glanceclient.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.serialization.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: python-novaclient,
|
||||||
'oslo-utils':
|
repository: 'git://git.openstack.org/openstack/python-novaclient.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.utils.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: python-swiftclient:
|
||||||
'oslo-vmware':
|
repository: 'git://git.openstack.org/openstack/python-swiftclient.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/oslo.vmware.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: sqlalchemy-migrate,
|
||||||
'osprofiler':
|
repository: 'git://git.openstack.org/stackforge/sqlalchemy-migrate',
|
||||||
{'repository': 'git://git.openstack.org/stackforge/osprofiler.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: stevedore,
|
||||||
'pbr':
|
repository: 'git://git.openstack.org/openstack/stevedore.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack-dev/pbr.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: taskflow,
|
||||||
'python-barbicanclient':
|
repository: 'git://git.openstack.org/openstack/taskflow.git',
|
||||||
{'repository': 'git://git.openstack.org/openstack/python-barbicanclient.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: keystonemiddleware,
|
||||||
'python-glanceclient':
|
repository: 'git://git.openstack.org/openstack/keystonemiddleware',
|
||||||
{'repository': 'git://git.openstack.org/openstack/python-glanceclient.git',
|
branch: master}
|
||||||
'branch: 'master'},
|
- {name: cinder,
|
||||||
'python-novaclient':
|
repository: 'git://git.openstack.org/openstack/cinder',
|
||||||
{'repository': 'git://git.openstack.org/openstack/python-novaclient.git',
|
branch: master}"
|
||||||
'branch: 'master'},
|
|
||||||
'python-swiftclient':
|
|
||||||
{'repository': 'git://git.openstack.org/openstack/python-swiftclient.git',
|
|
||||||
'branch: 'master'},
|
|
||||||
'stevedore':
|
|
||||||
{'repository': 'git://git.openstack.org/openstack/stevedore.git',
|
|
||||||
'branch: 'master'},
|
|
||||||
'sqlalchemy-migrate':
|
|
||||||
{'repository': 'git://git.openstack.org/stackforge/sqlalchemy-migrate.git',
|
|
||||||
'branch: 'master'},
|
|
||||||
'taskflow':
|
|
||||||
{'repository': 'git://git.openstack.org/openstack/taskflow.git',
|
|
||||||
'branch: 'master'},
|
|
||||||
'cinder':
|
|
||||||
{'repository': 'git://git.openstack.org/openstack/cinder.git',
|
|
||||||
'branch': 'master'}}"
|
|
||||||
|
2
actions.yaml
Normal file
2
actions.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
git-reinstall:
|
||||||
|
description: Reinstall cinder from the openstack-origin-git repositories.
|
1
actions/git-reinstall
Symbolic link
1
actions/git-reinstall
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
git_reinstall.py
|
40
actions/git_reinstall.py
Executable file
40
actions/git_reinstall.py
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
sys.path.append('hooks/')
|
||||||
|
|
||||||
|
from charmhelpers.contrib.openstack.utils import (
|
||||||
|
git_install_requested,
|
||||||
|
)
|
||||||
|
|
||||||
|
from charmhelpers.core.hookenv import (
|
||||||
|
action_set,
|
||||||
|
action_fail,
|
||||||
|
config,
|
||||||
|
)
|
||||||
|
|
||||||
|
from cinder_utils import (
|
||||||
|
git_install,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def git_reinstall():
|
||||||
|
"""Reinstall from source and restart services.
|
||||||
|
|
||||||
|
If the openstack-origin-git config option was used to install openstack
|
||||||
|
from source git repositories, then this action can be used to reinstall
|
||||||
|
from updated git repositories, followed by a restart of services."""
|
||||||
|
if not git_install_requested():
|
||||||
|
action_fail('openstack-origin-git is not configured')
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
git_install(config('openstack-origin-git'))
|
||||||
|
except:
|
||||||
|
action_set({'traceback': traceback.format_exc()})
|
||||||
|
action_fail('git-reinstall resulted in an unexpected error')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
git_reinstall()
|
@ -1,5 +1,4 @@
|
|||||||
#branch: lp:charm-helpers
|
branch: lp:charm-helpers
|
||||||
branch: /home/corey/src/charms/git/charm-helpers
|
|
||||||
destination: tests/charmhelpers
|
destination: tests/charmhelpers
|
||||||
include:
|
include:
|
||||||
- contrib.amulet
|
- contrib.amulet
|
||||||
|
15
config.yaml
15
config.yaml
@ -16,23 +16,20 @@ options:
|
|||||||
was not available in the Ubuntu archive for Precise and is only
|
was not available in the Ubuntu archive for Precise and is only
|
||||||
available via the Ubuntu Cloud Archive.
|
available via the Ubuntu Cloud Archive.
|
||||||
|
|
||||||
Note that when openstack-origin-git is specified, openstack-specific
|
Note that when openstack-origin-git is specified, openstack
|
||||||
packages will be installed from source rather than from the
|
specific packages will be installed from source rather than
|
||||||
openstack-origin repository.
|
from the openstack-origin repository.
|
||||||
openstack-origin-git:
|
openstack-origin-git:
|
||||||
default: None
|
default: None
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
Specifies a YAML-formatted two-dimensional array listing the git
|
Specifies a YAML-formatted dictionary listing the git
|
||||||
repositories and branches from which to install OpenStack and its
|
repositories and branches from which to install OpenStack and
|
||||||
dependencies.
|
its dependencies.
|
||||||
|
|
||||||
Note that the installed config files will be determined based on
|
Note that the installed config files will be determined based on
|
||||||
the OpenStack release of the openstack-origin option.
|
the OpenStack release of the openstack-origin option.
|
||||||
|
|
||||||
Note also that this option is processed for the initial install
|
|
||||||
only. Setting this option after deployment is not supported.
|
|
||||||
|
|
||||||
For more details see README.md.
|
For more details see README.md.
|
||||||
enabled-services:
|
enabled-services:
|
||||||
default: all
|
default: all
|
||||||
|
@ -51,6 +51,7 @@ from charmhelpers.core.host import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.openstack.utils import (
|
from charmhelpers.contrib.openstack.utils import (
|
||||||
|
config_value_changed,
|
||||||
configure_installation_source,
|
configure_installation_source,
|
||||||
git_install_requested,
|
git_install_requested,
|
||||||
openstack_upgrade_available,
|
openstack_upgrade_available,
|
||||||
@ -101,8 +102,7 @@ def install():
|
|||||||
apt_update()
|
apt_update()
|
||||||
apt_install(determine_packages(), fatal=True)
|
apt_install(determine_packages(), fatal=True)
|
||||||
|
|
||||||
# NOTE(coreycb): This is temporary for sstack proxy, unless we decide
|
# NOTE(coreycb): This is temporary until bug #1431286 is fixed.
|
||||||
# we need to code proxy support into the charms.
|
|
||||||
os.environ["http_proxy"] = "http://squid.internal:3128"
|
os.environ["http_proxy"] = "http://squid.internal:3128"
|
||||||
os.environ["https_proxy"] = "https://squid.internal:3128"
|
os.environ["https_proxy"] = "https://squid.internal:3128"
|
||||||
|
|
||||||
@ -127,7 +127,10 @@ def config_changed():
|
|||||||
conf['overwrite'] in ['true', 'True', True],
|
conf['overwrite'] in ['true', 'True', True],
|
||||||
conf['remove-missing'])
|
conf['remove-missing'])
|
||||||
|
|
||||||
if not git_install_requested():
|
if git_install_requested():
|
||||||
|
if config_value_changed('openstack-origin-git'):
|
||||||
|
git_install(config('openstack-origin-git'))
|
||||||
|
else:
|
||||||
if openstack_upgrade_available('cinder-common'):
|
if openstack_upgrade_available('cinder-common'):
|
||||||
do_openstack_upgrade(configs=CONFIGS)
|
do_openstack_upgrade(configs=CONFIGS)
|
||||||
# NOTE(jamespage) tell any storage-backends we just upgraded
|
# NOTE(jamespage) tell any storage-backends we just upgraded
|
||||||
|
@ -70,6 +70,7 @@ from charmhelpers.contrib.openstack.utils import (
|
|||||||
get_os_codename_install_source,
|
get_os_codename_install_source,
|
||||||
git_install_requested,
|
git_install_requested,
|
||||||
git_clone_and_install,
|
git_clone_and_install,
|
||||||
|
git_src_dir,
|
||||||
os_release,
|
os_release,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -507,16 +508,16 @@ def setup_ipv6():
|
|||||||
apt_install('haproxy/trusty-backports', fatal=True)
|
apt_install('haproxy/trusty-backports', fatal=True)
|
||||||
|
|
||||||
|
|
||||||
def git_install(projects):
|
def git_install(projects_yaml):
|
||||||
"""Perform setup, and install git repos specified in yaml parameter."""
|
"""Perform setup, and install git repos specified in yaml parameter."""
|
||||||
if git_install_requested():
|
if git_install_requested():
|
||||||
git_pre_install()
|
git_pre_install()
|
||||||
git_clone_and_install(yaml.load(projects), core_project='cinder')
|
git_clone_and_install(projects_yaml, core_project='cinder')
|
||||||
git_post_install()
|
git_post_install(projects_yaml)
|
||||||
|
|
||||||
|
|
||||||
def git_pre_install():
|
def git_pre_install():
|
||||||
"""Perform pre cinder installation setup."""
|
"""Perform cinder pre-install setup."""
|
||||||
dirs = [
|
dirs = [
|
||||||
'/etc/cinder',
|
'/etc/cinder',
|
||||||
'/etc/cinder/rootwrap.d',
|
'/etc/cinder/rootwrap.d',
|
||||||
@ -547,9 +548,9 @@ def git_pre_install():
|
|||||||
write_file(l, '', owner='cinder', group='cinder', perms=0600)
|
write_file(l, '', owner='cinder', group='cinder', perms=0600)
|
||||||
|
|
||||||
|
|
||||||
def git_post_install():
|
def git_post_install(projects_yaml):
|
||||||
"""Perform post cinder installation setup."""
|
"""Perform cinder post-install setup."""
|
||||||
src_etc = os.path.join(charm_dir(), '/mnt/openstack-git/cinder.git/etc/cinder')
|
src_etc = os.path.join(git_src_dir(projects_yaml, 'cinder'), 'etc')
|
||||||
configs = {
|
configs = {
|
||||||
'policy': {
|
'policy': {
|
||||||
'src': os.path.join(src_etc, 'policy.json'),
|
'src': os.path.join(src_etc, 'policy.json'),
|
||||||
@ -574,32 +575,51 @@ def git_post_install():
|
|||||||
|
|
||||||
cinder_api_context = {
|
cinder_api_context = {
|
||||||
'service_description': 'Cinder API server',
|
'service_description': 'Cinder API server',
|
||||||
|
'service_name': 'Cinder',
|
||||||
|
'user_name': 'cinder',
|
||||||
|
'start_dir': '/var/lib/cinder',
|
||||||
'process_name': 'cinder-api',
|
'process_name': 'cinder-api',
|
||||||
|
'executable_name': '/usr/local/bin/cinder-api',
|
||||||
}
|
}
|
||||||
|
|
||||||
cinder_backup_context = {
|
cinder_backup_context = {
|
||||||
'service_description': 'Cinder backup server',
|
'service_description': 'Cinder backup server',
|
||||||
|
'service_name': 'Cinder',
|
||||||
|
'user_name': 'cinder',
|
||||||
|
'start_dir': '/var/lib/cinder',
|
||||||
'process_name': 'cinder-backup',
|
'process_name': 'cinder-backup',
|
||||||
|
'executable_name': '/usr/local/bin/cinder-backup',
|
||||||
}
|
}
|
||||||
|
|
||||||
cinder_scheduler_context = {
|
cinder_scheduler_context = {
|
||||||
'service_description': 'Cinder scheduler server',
|
'service_description': 'Cinder scheduler server',
|
||||||
|
'service_name': 'Cinder',
|
||||||
|
'user_name': 'cinder',
|
||||||
|
'start_dir': '/var/lib/cinder',
|
||||||
'process_name': 'cinder-scheduler',
|
'process_name': 'cinder-scheduler',
|
||||||
|
'executable_name': '/usr/local/bin/cinder-scheduler',
|
||||||
}
|
}
|
||||||
|
|
||||||
cinder_volume_context = {
|
cinder_volume_context = {
|
||||||
'service_description': 'Cinder volume server',
|
'service_description': 'Cinder volume server',
|
||||||
|
'service_name': 'Cinder',
|
||||||
|
'user_name': 'cinder',
|
||||||
|
'start_dir': '/var/lib/cinder',
|
||||||
'process_name': 'cinder-volume',
|
'process_name': 'cinder-volume',
|
||||||
|
'executable_name': '/usr/local/bin/cinder-volume',
|
||||||
}
|
}
|
||||||
|
|
||||||
render('upstart/cinder.upstart', '/etc/init/cinder-api.conf',
|
# NOTE(coreycb): Needs systemd support
|
||||||
cinder_api_context, perms=0o644)
|
templates_dir = 'hooks/charmhelpers/contrib/openstack/templates'
|
||||||
render('upstart/cinder.upstart', '/etc/init/cinder-backup.conf',
|
templates_dir = os.path.join(charm_dir(), templates_dir)
|
||||||
cinder_backup_context, perms=0o644)
|
render('git.upstart', '/etc/init/cinder-api.conf',
|
||||||
render('upstart/cinder.upstart', '/etc/init/cinder-scheduler.conf',
|
cinder_api_context, perms=0o644, templates_dir=templates_dir)
|
||||||
cinder_scheduler_context, perms=0o644)
|
render('git.upstart', '/etc/init/cinder-backup.conf',
|
||||||
render('upstart/cinder.upstart', '/etc/init/cinder-volume.conf',
|
cinder_backup_context, perms=0o644, templates_dir=templates_dir)
|
||||||
cinder_volume_context, perms=0o644)
|
render('git.upstart', '/etc/init/cinder-scheduler.conf',
|
||||||
|
cinder_scheduler_context, perms=0o644, templates_dir=templates_dir)
|
||||||
|
render('git.upstart', '/etc/init/cinder-volume.conf',
|
||||||
|
cinder_volume_context, perms=0o644, templates_dir=templates_dir)
|
||||||
|
|
||||||
service_restart('tgtd')
|
service_restart('tgtd')
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
description "{{ service_description }}"
|
|
||||||
author "Juju Cinder Charm <juju@localhost>"
|
|
||||||
|
|
||||||
start on runlevel [2345]
|
|
||||||
stop on runlevel [!2345]
|
|
||||||
|
|
||||||
chdir /var/run
|
|
||||||
|
|
||||||
pre-start script
|
|
||||||
mkdir -p /var/run/cinder
|
|
||||||
chown cinder:cinder /var/run/cinder
|
|
||||||
|
|
||||||
mkdir -p /var/lock/cinder
|
|
||||||
chown cinder:root /var/lock/cinder
|
|
||||||
end script
|
|
||||||
|
|
||||||
exec start-stop-daemon --start --chuid cinder \
|
|
||||||
--exec /usr/local/bin/{{ process_name }} -- \
|
|
||||||
--config-file=/etc/cinder/cinder.conf \
|
|
||||||
--log-file=/var/log/cinder/{{ process_name }}.log
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
"""Amulet tests on a basic cinder deployment on precise-folsom."""
|
|
||||||
|
|
||||||
from basic_deployment import CinderBasicDeployment
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
deployment = CinderBasicDeployment(series='precise',
|
|
||||||
openstack='cloud:precise-folsom',
|
|
||||||
source='cloud:precise-updates/folsom')
|
|
||||||
deployment.run_tests()
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
"""Amulet tests on a basic cinder deployment on precise-grizzly."""
|
|
||||||
|
|
||||||
from basic_deployment import CinderBasicDeployment
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
deployment = CinderBasicDeployment(series='precise',
|
|
||||||
openstack='cloud:precise-grizzly',
|
|
||||||
source='cloud:precise-updates/grizzly')
|
|
||||||
deployment.run_tests()
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
"""Amulet tests on a basic cinder deployment on precise-havana."""
|
|
||||||
|
|
||||||
from basic_deployment import CinderBasicDeployment
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
deployment = CinderBasicDeployment(series='precise',
|
|
||||||
openstack='cloud:precise-havana',
|
|
||||||
source='cloud:precise-updates/havana')
|
|
||||||
deployment.run_tests()
|
|
9
tests/16-basic-trusty-icehouse-git
Executable file
9
tests/16-basic-trusty-icehouse-git
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
"""Amulet tests on a basic Cinder git deployment on trusty-icehouse."""
|
||||||
|
|
||||||
|
from basic_deployment import CinderBasicDeployment
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
deployment = CinderBasicDeployment(series='trusty', git=True)
|
||||||
|
deployment.run_tests()
|
11
tests/17-basic-trusty-juno
Executable file
11
tests/17-basic-trusty-juno
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
"""Amulet tests on a basic Cinder deployment on trusty-juno."""
|
||||||
|
|
||||||
|
from basic_deployment import CinderBasicDeployment
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
deployment = CinderBasicDeployment(series='trusty',
|
||||||
|
openstack='cloud:trusty-juno',
|
||||||
|
source='cloud:trusty-updates/juno')
|
||||||
|
deployment.run_tests()
|
12
tests/18-basic-trusty-juno-git
Executable file
12
tests/18-basic-trusty-juno-git
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
"""Amulet tests on a basic Cinder git deployment on trusty-juno."""
|
||||||
|
|
||||||
|
from basic_deployment import CinderBasicDeployment
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
deployment = CinderBasicDeployment(series='trusty',
|
||||||
|
openstack='cloud:trusty-juno',
|
||||||
|
source='cloud:trusty-updates/juno',
|
||||||
|
git=True)
|
||||||
|
deployment.run_tests()
|
@ -28,10 +28,12 @@ class CinderBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
# NOTE(beisner): Features and tests vary across Openstack releases.
|
# NOTE(beisner): Features and tests vary across Openstack releases.
|
||||||
# https://wiki.openstack.org/wiki/CinderSupportMatrix
|
# https://wiki.openstack.org/wiki/CinderSupportMatrix
|
||||||
|
|
||||||
def __init__(self, series=None, openstack=None, source=None, stable=False):
|
def __init__(self, series=None, openstack=None, source=None, git=False,
|
||||||
|
stable=False):
|
||||||
'''Deploy the entire test environment.'''
|
'''Deploy the entire test environment.'''
|
||||||
super(CinderBasicDeployment, self).__init__(series, openstack, source,
|
super(CinderBasicDeployment, self).__init__(series, openstack, source,
|
||||||
stable)
|
stable)
|
||||||
|
self.git = git
|
||||||
self._add_services()
|
self._add_services()
|
||||||
self._add_relations()
|
self._add_relations()
|
||||||
self._configure_services()
|
self._configure_services()
|
||||||
@ -67,17 +69,26 @@ class CinderBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
|
|
||||||
def _configure_services(self):
|
def _configure_services(self):
|
||||||
'''Configure all of the services.'''
|
'''Configure all of the services.'''
|
||||||
keystone_config = {'admin-password': 'openstack',
|
|
||||||
'admin-token': 'ubuntutesting'}
|
|
||||||
cinder_config = {'block-device': 'vdb',
|
cinder_config = {'block-device': 'vdb',
|
||||||
'glance-api-version': '2',
|
'glance-api-version': '2',
|
||||||
'overwrite': 'true',
|
'overwrite': 'true'}
|
||||||
# NOTE(coreycb): Added the following temporarily to test deploy from source
|
if self.git:
|
||||||
'openstack-origin-git':
|
branch = 'stable/' + self._get_openstack_release_string()
|
||||||
"{'cinder':"
|
openstack_origin_git = {
|
||||||
" {'repository': 'git://git.openstack.org/openstack/cinder.git',"
|
'repositories': [
|
||||||
" 'branch': 'stable/icehouse'}}"}
|
{'name': 'requirements',
|
||||||
|
'repository': 'git://git.openstack.org/openstack/requirements',
|
||||||
|
'branch': branch},
|
||||||
|
{'name': 'cinder',
|
||||||
|
'repository': 'git://git.openstack.org/openstack/cinder',
|
||||||
|
'branch': branch},
|
||||||
|
],
|
||||||
|
'directory': '/mnt/openstack-git',
|
||||||
|
}
|
||||||
|
cinder_config['openstack-origin-git'] = yaml.dump(openstack_origin_git)
|
||||||
|
|
||||||
|
keystone_config = {'admin-password': 'openstack',
|
||||||
|
'admin-token': 'ubuntutesting'}
|
||||||
mysql_config = {'dataset-size': '50%'}
|
mysql_config = {'dataset-size': '50%'}
|
||||||
configs = {'cinder': cinder_config,
|
configs = {'cinder': cinder_config,
|
||||||
'keystone': keystone_config,
|
'keystone': keystone_config,
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
sys.path.append('actions')
|
||||||
sys.path.append('hooks')
|
sys.path.append('hooks')
|
||||||
|
85
unit_tests/test_actions_git_reinstall.py
Normal file
85
unit_tests/test_actions_git_reinstall.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
from mock import patch
|
||||||
|
|
||||||
|
with patch('charmhelpers.core.hookenv.config') as config:
|
||||||
|
config.return_value = 'cinder'
|
||||||
|
import cinder_utils as utils # noqa
|
||||||
|
|
||||||
|
import git_reinstall
|
||||||
|
|
||||||
|
from test_utils import (
|
||||||
|
CharmTestCase
|
||||||
|
)
|
||||||
|
|
||||||
|
TO_PATCH = [
|
||||||
|
'config',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
openstack_origin_git = \
|
||||||
|
"""repositories:
|
||||||
|
- {name: requirements,
|
||||||
|
repository: 'git://git.openstack.org/openstack/requirements',
|
||||||
|
branch: stable/juno}
|
||||||
|
- {name: cinder,
|
||||||
|
repository: 'git://git.openstack.org/openstack/cinder',
|
||||||
|
branch: stable/juno}"""
|
||||||
|
|
||||||
|
|
||||||
|
class TestKeystoneActions(CharmTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestKeystoneActions, self).setUp(git_reinstall, TO_PATCH)
|
||||||
|
self.config.side_effect = self.test_config.get
|
||||||
|
|
||||||
|
@patch.object(git_reinstall, 'action_set')
|
||||||
|
@patch.object(git_reinstall, 'action_fail')
|
||||||
|
@patch.object(git_reinstall, 'git_install')
|
||||||
|
def test_git_reinstall(self, git_install, action_fail, action_set):
|
||||||
|
self.test_config.set('openstack-origin-git', openstack_origin_git)
|
||||||
|
|
||||||
|
git_reinstall.git_reinstall()
|
||||||
|
|
||||||
|
git_install.assert_called_with(openstack_origin_git)
|
||||||
|
self.assertTrue(git_install.called)
|
||||||
|
self.assertFalse(action_set.called)
|
||||||
|
self.assertFalse(action_fail.called)
|
||||||
|
|
||||||
|
@patch.object(git_reinstall, 'action_set')
|
||||||
|
@patch.object(git_reinstall, 'action_fail')
|
||||||
|
@patch.object(git_reinstall, 'git_install')
|
||||||
|
@patch('charmhelpers.contrib.openstack.utils.config')
|
||||||
|
def test_git_reinstall_not_configured(self, _config, git_install,
|
||||||
|
action_fail, action_set):
|
||||||
|
_config.return_value = 'none'
|
||||||
|
|
||||||
|
git_reinstall.git_reinstall()
|
||||||
|
|
||||||
|
msg = 'openstack-origin-git is not configured'
|
||||||
|
action_fail.assert_called_with(msg)
|
||||||
|
self.assertFalse(git_install.called)
|
||||||
|
self.assertFalse(action_set.called)
|
||||||
|
|
||||||
|
@patch.object(git_reinstall, 'action_set')
|
||||||
|
@patch.object(git_reinstall, 'action_fail')
|
||||||
|
@patch.object(git_reinstall, 'git_install')
|
||||||
|
@patch('charmhelpers.contrib.openstack.utils.config')
|
||||||
|
def test_git_reinstall_exception(self, _config, git_install,
|
||||||
|
action_fail, action_set):
|
||||||
|
_config.return_value = openstack_origin_git
|
||||||
|
e = OSError('something bad happened')
|
||||||
|
git_install.side_effect = e
|
||||||
|
traceback = (
|
||||||
|
"Traceback (most recent call last):\n"
|
||||||
|
" File \"actions/git_reinstall.py\", line 33, in git_reinstall\n"
|
||||||
|
" git_install(config(\'openstack-origin-git\'))\n"
|
||||||
|
" File \"/usr/lib/python2.7/dist-packages/mock.py\", line 964, in __call__\n" # noqa
|
||||||
|
" return _mock_self._mock_call(*args, **kwargs)\n"
|
||||||
|
" File \"/usr/lib/python2.7/dist-packages/mock.py\", line 1019, in _mock_call\n" # noqa
|
||||||
|
" raise effect\n"
|
||||||
|
"OSError: something bad happened\n")
|
||||||
|
|
||||||
|
git_reinstall.git_reinstall()
|
||||||
|
|
||||||
|
msg = 'git-reinstall resulted in an unexpected error'
|
||||||
|
action_fail.assert_called_with(msg)
|
||||||
|
action_set.assert_called_with({'traceback': traceback})
|
Loading…
Reference in New Issue
Block a user