Add configuration option to support testing on cloud-instances.

This commit is contained in:
James Page 2015-08-03 22:18:39 +02:00
parent 2fd7594aa1
commit d29c0e8ea8
4 changed files with 22 additions and 1 deletions

View File

@ -108,6 +108,16 @@ options:
If True, charm will attempt to remove missing physical volumes from
volume group, even when logical volumes are allocated on them. This
option overrides 'remove-missing' when set.
ephemeral-unmount:
type: string
default:
description: |
Cloud instances provide ephermeral storage which is normally mounted
on /mnt.
.
Providing this option will force an unmount of the ephemeral device
so that it can be used as a Cinder storage device. This is useful for
testing purposes (cloud deployment is not a typical use case).
database-user:
default: cinder
type: string

View File

@ -26,6 +26,7 @@ from cinder_utils import (
ceph_config_file,
setup_ipv6,
check_db_initialised,
filesystem_mounted,
)
from charmhelpers.core.hookenv import (
@ -53,6 +54,7 @@ from charmhelpers.core.host import (
lsb_release,
restart_on_change,
service_reload,
umount,
)
from charmhelpers.contrib.openstack.utils import (
@ -123,6 +125,10 @@ def config_changed():
sync_db_with_multi_ipv6_addresses(config('database'),
config('database-user'))
e_mountpoint = conf['ephemeral-unmount']
if e_mountpoint and filesystem_mounted(e_mountpoint):
umount(e_mountpoint)
if (service_enabled('volume') and
conf['block-device'] not in [None, 'None', 'none']):
block_devices = conf['block-device'].split()

View File

@ -796,3 +796,7 @@ def git_post_install(projects_yaml):
service_restart('tgtd')
[service_restart(s) for s in services()]
def filesystem_mounted(fs):
return subprocess.call(['grep', '-wqs', fs, '/proc/mounts']) == 0

View File

@ -68,7 +68,8 @@ class CinderBasicDeployment(OpenStackAmuletDeployment):
"""Configure all of the services."""
cinder_config = {'block-device': 'vdb',
'glance-api-version': '2',
'overwrite': 'true'}
'overwrite': 'true',
'ephemeral-unmount': '/mnt'}
if self.git:
amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')