Update for deploy from source:

Use python venv for install
Clone git repos with depth=1 for speed
This commit is contained in:
James Page 2015-06-10 15:09:04 +01:00
commit a52bc2474e
9 changed files with 150 additions and 58 deletions

View File

@ -53,9 +53,13 @@ from charmhelpers.contrib.network.ip import (
get_ipv6_addr get_ipv6_addr
) )
from charmhelpers.contrib.python.packages import (
pip_create_virtualenv,
pip_install,
)
from charmhelpers.core.host import lsb_release, mounts, umount from charmhelpers.core.host import lsb_release, mounts, umount
from charmhelpers.fetch import apt_install, apt_cache, install_remote from charmhelpers.fetch import apt_install, apt_cache, install_remote
from charmhelpers.contrib.python.packages import pip_install
from charmhelpers.contrib.storage.linux.utils import is_block_device, zap_disk from charmhelpers.contrib.storage.linux.utils import is_block_device, zap_disk
from charmhelpers.contrib.storage.linux.loopback import ensure_loopback_device from charmhelpers.contrib.storage.linux.loopback import ensure_loopback_device
@ -497,7 +501,17 @@ def git_install_requested():
requirements_dir = None requirements_dir = None
def git_clone_and_install(projects_yaml, core_project): def _git_yaml_load(projects_yaml):
"""
Load the specified yaml into a dictionary.
"""
if not projects_yaml:
return None
return yaml.load(projects_yaml)
def git_clone_and_install(projects_yaml, core_project, depth=1):
""" """
Clone/install all specified OpenStack repositories. Clone/install all specified OpenStack repositories.
@ -510,23 +524,22 @@ def git_clone_and_install(projects_yaml, core_project):
repository: 'git://git.openstack.org/openstack/requirements.git', repository: 'git://git.openstack.org/openstack/requirements.git',
branch: 'stable/icehouse'} branch: 'stable/icehouse'}
directory: /mnt/openstack-git directory: /mnt/openstack-git
http_proxy: http://squid.internal:3128 http_proxy: squid-proxy-url
https_proxy: https://squid.internal:3128 https_proxy: squid-proxy-url
The directory, http_proxy, and https_proxy keys are optional. The directory, http_proxy, and https_proxy keys are optional.
""" """
global requirements_dir global requirements_dir
parent_dir = '/mnt/openstack-git' parent_dir = '/mnt/openstack-git'
http_proxy = None
if not projects_yaml: projects = _git_yaml_load(projects_yaml)
return
projects = yaml.load(projects_yaml)
_git_validate_projects_yaml(projects, core_project) _git_validate_projects_yaml(projects, core_project)
old_environ = dict(os.environ) old_environ = dict(os.environ)
if 'http_proxy' in projects.keys(): if 'http_proxy' in projects.keys():
http_proxy = projects['http_proxy']
os.environ['http_proxy'] = projects['http_proxy'] os.environ['http_proxy'] = projects['http_proxy']
if 'https_proxy' in projects.keys(): if 'https_proxy' in projects.keys():
os.environ['https_proxy'] = projects['https_proxy'] os.environ['https_proxy'] = projects['https_proxy']
@ -534,15 +547,19 @@ def git_clone_and_install(projects_yaml, core_project):
if 'directory' in projects.keys(): if 'directory' in projects.keys():
parent_dir = projects['directory'] parent_dir = projects['directory']
pip_create_virtualenv(os.path.join(parent_dir, 'venv'))
for p in projects['repositories']: for p in projects['repositories']:
repo = p['repository'] repo = p['repository']
branch = p['branch'] branch = p['branch']
if p['name'] == 'requirements': if p['name'] == 'requirements':
repo_dir = _git_clone_and_install_single(repo, branch, parent_dir, repo_dir = _git_clone_and_install_single(repo, branch, depth,
parent_dir, http_proxy,
update_requirements=False) update_requirements=False)
requirements_dir = repo_dir requirements_dir = repo_dir
else: else:
repo_dir = _git_clone_and_install_single(repo, branch, parent_dir, repo_dir = _git_clone_and_install_single(repo, branch, depth,
parent_dir, http_proxy,
update_requirements=True) update_requirements=True)
os.environ = old_environ os.environ = old_environ
@ -574,7 +591,8 @@ def _git_ensure_key_exists(key, keys):
error_out('openstack-origin-git key \'{}\' is missing'.format(key)) error_out('openstack-origin-git key \'{}\' is missing'.format(key))
def _git_clone_and_install_single(repo, branch, parent_dir, update_requirements): def _git_clone_and_install_single(repo, branch, depth, parent_dir, http_proxy,
update_requirements):
""" """
Clone and install a single git repository. Clone and install a single git repository.
""" """
@ -587,7 +605,8 @@ def _git_clone_and_install_single(repo, branch, parent_dir, update_requirements)
if not os.path.exists(dest_dir): if not os.path.exists(dest_dir):
juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch)) juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
repo_dir = install_remote(repo, dest=parent_dir, branch=branch) repo_dir = install_remote(repo, dest=parent_dir, branch=branch,
depth=depth)
else: else:
repo_dir = dest_dir repo_dir = dest_dir
@ -598,7 +617,12 @@ def _git_clone_and_install_single(repo, branch, parent_dir, update_requirements)
_git_update_requirements(repo_dir, requirements_dir) _git_update_requirements(repo_dir, requirements_dir)
juju_log('Installing git repo from dir: {}'.format(repo_dir)) juju_log('Installing git repo from dir: {}'.format(repo_dir))
pip_install(repo_dir) if http_proxy:
pip_install(repo_dir, proxy=http_proxy,
venv=os.path.join(parent_dir, 'venv'))
else:
pip_install(repo_dir,
venv=os.path.join(parent_dir, 'venv'))
return repo_dir return repo_dir
@ -621,16 +645,27 @@ def _git_update_requirements(package_dir, reqs_dir):
os.chdir(orig_dir) os.chdir(orig_dir)
def git_pip_venv_dir(projects_yaml):
"""
Return the pip virtualenv path.
"""
parent_dir = '/mnt/openstack-git'
projects = _git_yaml_load(projects_yaml)
if 'directory' in projects.keys():
parent_dir = projects['directory']
return os.path.join(parent_dir, 'venv')
def git_src_dir(projects_yaml, project): def git_src_dir(projects_yaml, project):
""" """
Return the directory where the specified project's source is located. Return the directory where the specified project's source is located.
""" """
parent_dir = '/mnt/openstack-git' parent_dir = '/mnt/openstack-git'
if not projects_yaml: projects = _git_yaml_load(projects_yaml)
return
projects = yaml.load(projects_yaml)
if 'directory' in projects.keys(): if 'directory' in projects.keys():
parent_dir = projects['directory'] parent_dir = projects['directory']
@ -640,3 +675,15 @@ def git_src_dir(projects_yaml, project):
return os.path.join(parent_dir, os.path.basename(p['repository'])) return os.path.join(parent_dir, os.path.basename(p['repository']))
return None return None
def git_yaml_value(projects_yaml, key):
"""
Return the value in projects_yaml for the specified key.
"""
projects = _git_yaml_load(projects_yaml)
if key in projects.keys():
return projects[key]
return None

View File

@ -17,8 +17,11 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
import os
import subprocess
from charmhelpers.fetch import apt_install, apt_update from charmhelpers.fetch import apt_install, apt_update
from charmhelpers.core.hookenv import log from charmhelpers.core.hookenv import charm_dir, log
try: try:
from pip import main as pip_execute from pip import main as pip_execute
@ -51,11 +54,15 @@ def pip_install_requirements(requirements, **options):
pip_execute(command) pip_execute(command)
def pip_install(package, fatal=False, upgrade=False, **options): def pip_install(package, fatal=False, upgrade=False, venv=None, **options):
"""Install a python package""" """Install a python package"""
command = ["install"] if venv:
venv_python = os.path.join(venv, 'bin/pip')
command = [venv_python, "install"]
else:
command = ["install"]
available_options = ('proxy', 'src', 'log', "index-url", ) available_options = ('proxy', 'src', 'log', 'index-url', )
for option in parse_options(options, available_options): for option in parse_options(options, available_options):
command.append(option) command.append(option)
@ -69,7 +76,10 @@ def pip_install(package, fatal=False, upgrade=False, **options):
log("Installing {} package with options: {}".format(package, log("Installing {} package with options: {}".format(package,
command)) command))
pip_execute(command) if venv:
subprocess.check_call(command)
else:
pip_execute(command)
def pip_uninstall(package, **options): def pip_uninstall(package, **options):
@ -94,3 +104,16 @@ def pip_list():
"""Returns the list of current python installed packages """Returns the list of current python installed packages
""" """
return pip_execute(["list"]) return pip_execute(["list"])
def pip_create_virtualenv(path=None):
"""Create an isolated Python environment."""
apt_install('python-virtualenv')
if path:
venv_path = path
else:
venv_path = os.path.join(charm_dir(), 'venv')
if not os.path.exists(venv_path):
subprocess.check_call(['virtualenv', venv_path])

View File

@ -45,14 +45,16 @@ class GitUrlFetchHandler(BaseFetchHandler):
else: else:
return True return True
def clone(self, source, dest, branch): def clone(self, source, dest, branch, depth=None):
if not self.can_handle(source): if not self.can_handle(source):
raise UnhandledSource("Cannot handle {}".format(source)) raise UnhandledSource("Cannot handle {}".format(source))
repo = Repo.clone_from(source, dest) if depth:
repo.git.checkout(branch) Repo.clone_from(source, dest, branch=branch, depth=depth)
else:
Repo.clone_from(source, dest, branch=branch)
def install(self, source, branch="master", dest=None): def install(self, source, branch="master", dest=None, depth=None):
url_parts = self.parse_url(source) url_parts = self.parse_url(source)
branch_name = url_parts.path.strip("/").split("/")[-1] branch_name = url_parts.path.strip("/").split("/")[-1]
if dest: if dest:
@ -63,7 +65,7 @@ class GitUrlFetchHandler(BaseFetchHandler):
if not os.path.exists(dest_dir): if not os.path.exists(dest_dir):
mkdir(dest_dir, perms=0o755) mkdir(dest_dir, perms=0o755)
try: try:
self.clone(source, dest_dir, branch) self.clone(source, dest_dir, branch, depth)
except GitCommandError as e: except GitCommandError as e:
raise UnhandledSource(e.message) raise UnhandledSource(e.message)
except OSError as e: except OSError as e:

View File

@ -42,6 +42,7 @@ from charmhelpers.contrib.openstack.utils import (
git_install_requested, git_install_requested,
git_clone_and_install, git_clone_and_install,
git_src_dir, git_src_dir,
git_pip_venv_dir,
get_hostname get_hostname
) )
@ -186,8 +187,11 @@ L3HA_PACKAGES = ['keepalived']
BASE_GIT_PACKAGES = [ BASE_GIT_PACKAGES = [
'dnsmasq', 'dnsmasq',
'libffi-dev',
'libssl-dev',
'libxml2-dev', 'libxml2-dev',
'libxslt1-dev', 'libxslt1-dev',
'libyaml-dev',
'python-dev', 'python-dev',
'python-pip', 'python-pip',
'python-setuptools', 'python-setuptools',
@ -877,7 +881,11 @@ def git_post_install(projects_yaml):
shutil.rmtree(c['dest']) shutil.rmtree(c['dest'])
shutil.copytree(c['src'], c['dest']) shutil.copytree(c['src'], c['dest'])
# NOTE(coreycb): Need to find better solution than bin symlinks.
symlinks = [ symlinks = [
{'src': os.path.join(git_pip_venv_dir(projects_yaml),
'bin/neutron-rootwrap'),
'link': '/usr/local/bin/neutron-rootwrap'},
{'src': '/usr/local/bin/neutron-rootwrap', {'src': '/usr/local/bin/neutron-rootwrap',
'link': '/usr/bin/neutron-rootwrap'}, 'link': '/usr/bin/neutron-rootwrap'},
] ]
@ -898,15 +906,18 @@ def git_post_install(projects_yaml):
service_name = 'quantum-gateway' service_name = 'quantum-gateway'
user_name = 'neutron' user_name = 'neutron'
bin_dir = os.path.join(git_pip_venv_dir(projects_yaml), 'bin')
neutron_api_context = { neutron_api_context = {
'service_description': 'Neutron API server', 'service_description': 'Neutron API server',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-server', 'process_name': 'neutron-server',
'executable_name': os.path.join(bin_dir, 'neutron-server'),
} }
neutron_dhcp_agent_context = { neutron_dhcp_agent_context = {
'service_description': 'Neutron DHCP Agent', 'service_description': 'Neutron DHCP Agent',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-dhcp-agent', 'process_name': 'neutron-dhcp-agent',
'executable_name': os.path.join(bin_dir, 'neutron-dhcp-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/dhcp_agent.ini'], '/etc/neutron/dhcp_agent.ini'],
'log_file': '/var/log/neutron/dhcp-agent.log', 'log_file': '/var/log/neutron/dhcp-agent.log',
@ -915,6 +926,7 @@ def git_post_install(projects_yaml):
'service_description': 'Neutron L3 Agent', 'service_description': 'Neutron L3 Agent',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-l3-agent', 'process_name': 'neutron-l3-agent',
'executable_name': os.path.join(bin_dir, 'neutron-l3-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/l3_agent.ini', '/etc/neutron/l3_agent.ini',
'/etc/neutron/fwaas_driver.ini'], '/etc/neutron/fwaas_driver.ini'],
@ -926,7 +938,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-lbaas-agent', 'process_name': 'neutron-lbaas-agent',
'executable_name': '/usr/local/bin/neutron-lbaas-agent', 'executable_name': os.path.join(bin_dir, 'neutron-lbaas-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/lbaas_agent.ini'], '/etc/neutron/lbaas_agent.ini'],
'log_file': '/var/log/neutron/lbaas-agent.log', 'log_file': '/var/log/neutron/lbaas-agent.log',
@ -937,7 +949,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metadata-agent', 'process_name': 'neutron-metadata-agent',
'executable_name': '/usr/local/bin/neutron-metadata-agent', 'executable_name': os.path.join(bin_dir, 'neutron-metadata-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metadata_agent.ini'], '/etc/neutron/metadata_agent.ini'],
'log_file': '/var/log/neutron/metadata-agent.log', 'log_file': '/var/log/neutron/metadata-agent.log',
@ -948,7 +960,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metering-agent', 'process_name': 'neutron-metering-agent',
'executable_name': '/usr/local/bin/neutron-metering-agent', 'executable_name': os.path.join(bin_dir, 'neutron-metering-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metering_agent.ini'], '/etc/neutron/metering_agent.ini'],
'log_file': '/var/log/neutron/metering-agent.log', 'log_file': '/var/log/neutron/metering-agent.log',
@ -957,6 +969,7 @@ def git_post_install(projects_yaml):
'service_description': 'Neutron OVS cleanup', 'service_description': 'Neutron OVS cleanup',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-ovs-cleanup', 'process_name': 'neutron-ovs-cleanup',
'executable_name': os.path.join(bin_dir, 'neutron-ovs-cleanup'),
'config_file': '/etc/neutron/neutron.conf', 'config_file': '/etc/neutron/neutron.conf',
'log_file': '/var/log/neutron/ovs-cleanup.log', 'log_file': '/var/log/neutron/ovs-cleanup.log',
} }
@ -966,7 +979,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-restproxy-agent', 'process_name': 'neutron-restproxy-agent',
'executable_name': '/usr/local/bin/neutron-restproxy-agent', 'executable_name': os.path.join(bin_dir, 'neutron-restproxy-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/bigswitch/restproxy.ini'], '/etc/neutron/plugins/bigswitch/restproxy.ini'],
'log_file': '/var/log/neutron/bigswitch-agent.log', 'log_file': '/var/log/neutron/bigswitch-agent.log',
@ -977,7 +990,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ibm-agent', 'process_name': 'neutron-ibm-agent',
'executable_name': '/usr/local/bin/neutron-ibm-agent', 'executable_name': os.path.join(bin_dir, 'neutron-ibm-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'], '/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'],
'log_file': '/var/log/neutron/ibm-agent.log', 'log_file': '/var/log/neutron/ibm-agent.log',
@ -988,7 +1001,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-linuxbridge-agent', 'process_name': 'neutron-linuxbridge-agent',
'executable_name': '/usr/local/bin/neutron-linuxbridge-agent', 'executable_name': os.path.join(bin_dir, 'neutron-linuxbridge-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'], '/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/linuxbridge-agent.log', 'log_file': '/var/log/neutron/linuxbridge-agent.log',
@ -999,7 +1012,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-mlnx-agent', 'process_name': 'neutron-mlnx-agent',
'executable_name': '/usr/local/bin/neutron-mlnx-agent', 'executable_name': os.path.join(bin_dir, 'neutron-mlnx-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/mlnx/mlnx_conf.ini'], '/etc/neutron/plugins/mlnx/mlnx_conf.ini'],
'log_file': '/var/log/neutron/mlnx-agent.log', 'log_file': '/var/log/neutron/mlnx-agent.log',
@ -1009,7 +1022,7 @@ def git_post_install(projects_yaml):
'service_name': service_name, 'service_name': service_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nec-agent', 'process_name': 'neutron-nec-agent',
'executable_name': '/usr/local/bin/neutron-nec-agent', 'executable_name': os.path.join(bin_dir, 'neutron-nec-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/nec/nec.ini'], '/etc/neutron/plugins/nec/nec.ini'],
'log_file': '/var/log/neutron/nec-agent.log', 'log_file': '/var/log/neutron/nec-agent.log',
@ -1020,7 +1033,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nvsd-agent', 'process_name': 'neutron-nvsd-agent',
'executable_name': '/usr/local/bin/neutron-nvsd-agent', 'executable_name': os.path.join(bin_dir, 'neutron-nvsd-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'], '/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'],
'log_file': '/var/log/neutron/nvsd-agent.log', 'log_file': '/var/log/neutron/nvsd-agent.log',
@ -1031,7 +1044,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ofagent-agent', 'process_name': 'neutron-ofagent-agent',
'executable_name': '/usr/local/bin/neutron-ofagent-agent', 'executable_name': os.path.join(bin_dir, 'neutron-ofagent-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'], '/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'],
'log_file': '/var/log/neutron/openflow-agent.log', 'log_file': '/var/log/neutron/openflow-agent.log',
@ -1042,7 +1055,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-openvswitch-agent', 'process_name': 'neutron-openvswitch-agent',
'executable_name': '/usr/local/bin/neutron-openvswitch-agent', 'executable_name': os.path.join(bin_dir, 'neutron-openvswitch-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'], '/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/openvswitch-agent.log', 'log_file': '/var/log/neutron/openvswitch-agent.log',
@ -1053,7 +1066,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ryu-agent', 'process_name': 'neutron-ryu-agent',
'executable_name': '/usr/local/bin/neutron-ryu-agent', 'executable_name': os.path.join(bin_dir, 'neutron-ryu-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ryu/ryu.ini'], '/etc/neutron/plugins/ryu/ryu.ini'],
'log_file': '/var/log/neutron/ryu-agent.log', 'log_file': '/var/log/neutron/ryu-agent.log',
@ -1064,7 +1077,7 @@ def git_post_install(projects_yaml):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-sriov-nic-agent', 'process_name': 'neutron-sriov-nic-agent',
'executable_name': '/usr/local/bin/neutron-sriov-nic-agent', 'executable_name': os.path.join(bin_dir, 'neutron-sriov-nic-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_sriov'], '/etc/neutron/plugins/ml2/ml2_conf_sriov'],
'log_file': '/var/log/neutron/sriov-agent.log', 'log_file': '/var/log/neutron/sriov-agent.log',
@ -1073,6 +1086,7 @@ def git_post_install(projects_yaml):
'service_description': 'Neutron VPN Agent', 'service_description': 'Neutron VPN Agent',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-vpn-agent', 'process_name': 'neutron-vpn-agent',
'executable_name': os.path.join(bin_dir, 'neutron-vpn-agent'),
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/vpn_agent.ini', '/etc/neutron/vpn_agent.ini',
'/etc/neutron/l3_agent.ini', '/etc/neutron/l3_agent.ini',

View File

@ -18,7 +18,7 @@ pre-start script
fi fi
end script end script
exec start-stop-daemon --start --chuid neutron --exec /usr/local/bin/{{ process_name }} -- \ exec start-stop-daemon --start --chuid neutron --exec {{ executable_name }} -- \
{% for config_file in config_files -%} {% for config_file in config_files -%}
--config-file={{ config_file }} \ --config-file={{ config_file }} \
{% endfor -%} {% endfor -%}

View File

@ -7,7 +7,7 @@ stop on runlevel [!2345]
pre-start script pre-start script
[ ! -x /usr/local/bin/{{ process_name }} ] && exit 0 [ ! -x /usr/local/bin/{{ process_name }} ] && exit 0
start-stop-daemon --start --chuid neutron \ start-stop-daemon --start --chuid neutron \
--exec /usr/local/bin/{{ process_name }} -- \ --exec {{ executable_name }} -- \
--log-file {{ log_file }} \ --log-file {{ log_file }} \
--config-file {{ config_file }} --verbose --config-file {{ config_file }} --verbose
end script end script

View File

@ -16,7 +16,7 @@ end script
script script
[ -r /etc/default/{{ process_name }} ] && . /etc/default/{{ process_name }} [ -r /etc/default/{{ process_name }} ] && . /etc/default/{{ process_name }}
[ -r "$NEUTRON_PLUGIN_CONFIG" ] && CONF_ARG="--config-file $NEUTRON_PLUGIN_CONFIG" [ -r "$NEUTRON_PLUGIN_CONFIG" ] && CONF_ARG="--config-file $NEUTRON_PLUGIN_CONFIG"
exec start-stop-daemon --start --chuid neutron --exec /usr/local/bin/neutron-server -- \ exec start-stop-daemon --start --chuid neutron --exec {{ executable_name }} -- \
--config-file /etc/neutron/neutron.conf \ --config-file /etc/neutron/neutron.conf \
--log-file /var/log/neutron/server.log $CONF_ARG --log-file /var/log/neutron/server.log $CONF_ARG
end script end script

View File

@ -75,10 +75,10 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
openstack_origin_git = { openstack_origin_git = {
'repositories': [ 'repositories': [
{'name': 'requirements', {'name': 'requirements',
'repository': 'git://git.openstack.org/openstack/requirements', 'repository': 'git://github.com/openstack/requirements',
'branch': branch}, 'branch': branch},
{'name': 'neutron', {'name': 'neutron',
'repository': 'git://git.openstack.org/openstack/neutron', 'repository': 'git://github.com/openstack/neutron',
'branch': branch}, 'branch': branch},
], ],
'directory': '/mnt/openstack-git', 'directory': '/mnt/openstack-git',

View File

@ -809,11 +809,13 @@ class TestQuantumAgentReallocation(CharmTestCase):
'service_description': 'Neutron API server', 'service_description': 'Neutron API server',
'charm_name': 'neutron-api', 'charm_name': 'neutron-api',
'process_name': 'neutron-server', 'process_name': 'neutron-server',
'executable_name': 'joined-string',
} }
neutron_dhcp_agent_context = { neutron_dhcp_agent_context = {
'service_description': 'Neutron DHCP Agent', 'service_description': 'Neutron DHCP Agent',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-dhcp-agent', 'process_name': 'neutron-dhcp-agent',
'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/dhcp_agent.ini'], '/etc/neutron/dhcp_agent.ini'],
'log_file': '/var/log/neutron/dhcp-agent.log', 'log_file': '/var/log/neutron/dhcp-agent.log',
@ -822,6 +824,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'service_description': 'Neutron L3 Agent', 'service_description': 'Neutron L3 Agent',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-l3-agent', 'process_name': 'neutron-l3-agent',
'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/l3_agent.ini', '/etc/neutron/l3_agent.ini',
'/etc/neutron/fwaas_driver.ini'], '/etc/neutron/fwaas_driver.ini'],
@ -833,7 +836,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-lbaas-agent', 'process_name': 'neutron-lbaas-agent',
'executable_name': '/usr/local/bin/neutron-lbaas-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/lbaas_agent.ini'], '/etc/neutron/lbaas_agent.ini'],
'log_file': '/var/log/neutron/lbaas-agent.log', 'log_file': '/var/log/neutron/lbaas-agent.log',
@ -844,7 +847,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metadata-agent', 'process_name': 'neutron-metadata-agent',
'executable_name': '/usr/local/bin/neutron-metadata-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metadata_agent.ini'], '/etc/neutron/metadata_agent.ini'],
'log_file': '/var/log/neutron/metadata-agent.log', 'log_file': '/var/log/neutron/metadata-agent.log',
@ -855,7 +858,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metering-agent', 'process_name': 'neutron-metering-agent',
'executable_name': '/usr/local/bin/neutron-metering-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metering_agent.ini'], '/etc/neutron/metering_agent.ini'],
'log_file': '/var/log/neutron/metering-agent.log', 'log_file': '/var/log/neutron/metering-agent.log',
@ -864,6 +867,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'service_description': 'Neutron OVS cleanup', 'service_description': 'Neutron OVS cleanup',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-ovs-cleanup', 'process_name': 'neutron-ovs-cleanup',
'executable_name': 'joined-string',
'config_file': '/etc/neutron/neutron.conf', 'config_file': '/etc/neutron/neutron.conf',
'log_file': '/var/log/neutron/ovs-cleanup.log', 'log_file': '/var/log/neutron/ovs-cleanup.log',
} }
@ -873,7 +877,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-restproxy-agent', 'process_name': 'neutron-restproxy-agent',
'executable_name': '/usr/local/bin/neutron-restproxy-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/bigswitch/restproxy.ini'], '/etc/neutron/plugins/bigswitch/restproxy.ini'],
'log_file': '/var/log/neutron/bigswitch-agent.log', 'log_file': '/var/log/neutron/bigswitch-agent.log',
@ -884,7 +888,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ibm-agent', 'process_name': 'neutron-ibm-agent',
'executable_name': '/usr/local/bin/neutron-ibm-agent', 'executable_name': 'joined-string',
'config_files': 'config_files':
['/etc/neutron/neutron.conf', ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'], '/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'],
@ -896,7 +900,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-linuxbridge-agent', 'process_name': 'neutron-linuxbridge-agent',
'executable_name': '/usr/local/bin/neutron-linuxbridge-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'], '/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/linuxbridge-agent.log', 'log_file': '/var/log/neutron/linuxbridge-agent.log',
@ -907,7 +911,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-mlnx-agent', 'process_name': 'neutron-mlnx-agent',
'executable_name': '/usr/local/bin/neutron-mlnx-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/mlnx/mlnx_conf.ini'], '/etc/neutron/plugins/mlnx/mlnx_conf.ini'],
'log_file': '/var/log/neutron/mlnx-agent.log', 'log_file': '/var/log/neutron/mlnx-agent.log',
@ -917,7 +921,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'service_name': service_name, 'service_name': service_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nec-agent', 'process_name': 'neutron-nec-agent',
'executable_name': '/usr/local/bin/neutron-nec-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/nec/nec.ini'], '/etc/neutron/plugins/nec/nec.ini'],
'log_file': '/var/log/neutron/nec-agent.log', 'log_file': '/var/log/neutron/nec-agent.log',
@ -928,7 +932,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nvsd-agent', 'process_name': 'neutron-nvsd-agent',
'executable_name': '/usr/local/bin/neutron-nvsd-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/oneconvergence/' '/etc/neutron/plugins/oneconvergence/'
'nvsdplugin.ini'], 'nvsdplugin.ini'],
@ -940,7 +944,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ofagent-agent', 'process_name': 'neutron-ofagent-agent',
'executable_name': '/usr/local/bin/neutron-ofagent-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'], '/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'],
'log_file': '/var/log/neutron/openflow-agent.log', 'log_file': '/var/log/neutron/openflow-agent.log',
@ -951,7 +955,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-openvswitch-agent', 'process_name': 'neutron-openvswitch-agent',
'executable_name': '/usr/local/bin/neutron-openvswitch-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'], '/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/openvswitch-agent.log', 'log_file': '/var/log/neutron/openvswitch-agent.log',
@ -962,7 +966,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ryu-agent', 'process_name': 'neutron-ryu-agent',
'executable_name': '/usr/local/bin/neutron-ryu-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ryu/ryu.ini'], '/etc/neutron/plugins/ryu/ryu.ini'],
'log_file': '/var/log/neutron/ryu-agent.log', 'log_file': '/var/log/neutron/ryu-agent.log',
@ -973,7 +977,7 @@ class TestQuantumAgentReallocation(CharmTestCase):
'user_name': user_name, 'user_name': user_name,
'start_dir': '/var/lib/neutron', 'start_dir': '/var/lib/neutron',
'process_name': 'neutron-sriov-nic-agent', 'process_name': 'neutron-sriov-nic-agent',
'executable_name': '/usr/local/bin/neutron-sriov-nic-agent', 'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_sriov'], '/etc/neutron/plugins/ml2/ml2_conf_sriov'],
'log_file': '/var/log/neutron/sriov-agent.log', 'log_file': '/var/log/neutron/sriov-agent.log',
@ -982,11 +986,13 @@ class TestQuantumAgentReallocation(CharmTestCase):
'service_description': 'Neutron API server', 'service_description': 'Neutron API server',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-server', 'process_name': 'neutron-server',
'executable_name': 'joined-string',
} }
neutron_vpn_agent_context = { neutron_vpn_agent_context = {
'service_description': 'Neutron VPN Agent', 'service_description': 'Neutron VPN Agent',
'service_name': service_name, 'service_name': service_name,
'process_name': 'neutron-vpn-agent', 'process_name': 'neutron-vpn-agent',
'executable_name': 'joined-string',
'config_files': ['/etc/neutron/neutron.conf', 'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/vpn_agent.ini', '/etc/neutron/vpn_agent.ini',
'/etc/neutron/l3_agent.ini', '/etc/neutron/l3_agent.ini',