Switch to classic confinement

Classic confinement allows the snap to behave like a traditionally
packaged application with full access to the system, and enables the
use of traditional directories such as /etc and /var/log.

We will continue to store all of the snap's files in $SNAP* directories.
This enables the snap to cleanup after itself if it is removed. However,
traditional directory locations are symlinked to their corresponding
$SNAP* directories.

For example, nova configs are installed in $SNAP_COMMON/etc/nova
which has a symlink at /etc/nova.

The nova apps then use the traditional directories when running
commands and services.

Change-Id: Ie21c66007a37b90ac3bca042505bad332fa76543
This commit is contained in:
Corey Bryant 2017-03-20 19:13:51 +00:00
parent 0ff5b25d59
commit 1388b583b5
5 changed files with 42 additions and 51 deletions

View File

@ -1 +1,2 @@
snapcraft [platform:dpkg]
snapd [platform:dpkg]

View File

@ -1,49 +1,51 @@
setup:
dirs:
- "{snap_common}/etc/nova.conf.d"
- "{snap_common}/etc/nova"
- "{snap_common}/log"
- "{snap_common}/lock"
- "{snap_common}/run"
- "{snap_common}/etc/nova/conf.d"
- "{snap_common}/lib/nova"
- "{snap_common}/log/nova"
- "{snap_common}/lock/nova"
- "{snap_common}/run/nova"
symlinks:
"{snap_common}/etc/nova": /etc/nova
"{snap_common}/lib/nova": /var/lib/nova
"{snap_common}/log/nova": /var/log/nova
"{snap_common}/lock/nova": /var/lock/nova
templates:
"nova-snap.conf.j2": "{snap_common}/etc/nova.conf.d/nova-snap.conf"
nova-snap.conf.j2: "{snap_common}/etc/nova/conf.d/nova-snap.conf"
copyfiles:
"{snap}/etc/nova": "{snap_common}/etc/nova"
entry_points:
nova-api-os-compute:
binary: nova-api-os-compute
config-files:
- "{snap}/etc/nova/nova.conf"
- "{snap_common}/etc/nova/nova.conf"
- "/etc/nova/nova.conf"
config-dirs:
- "{snap_common}/etc/nova.conf.d"
log-file: "{snap_common}/log/nova-api-os-compute.log"
- "/etc/nova/conf.d"
log-file: "/var/log/nova/nova-api-os-compute.log"
nova-conductor:
binary: nova-conductor
config-files:
- "{snap}/etc/nova/nova.conf"
- "{snap_common}/etc/nova/nova.conf"
- "/etc/nova/nova.conf"
config-dirs:
- "{snap_common}/etc/nova.conf.d"
log-file: "{snap_common}/log/nova-conductor.log"
- "/etc/nova/conf.d"
log-file: "/var/log/nova/nova-conductor.log"
nova-scheduler:
binary: nova-scheduler
config-files:
- "{snap}/etc/nova/nova.conf"
- "{snap_common}/etc/nova/nova.conf"
- "/etc/nova/nova.conf"
config-dirs:
- "{snap_common}/etc/nova.conf.d"
log-file: "{snap_common}/log/nova-scheduler.log"
- "/etc/nova/conf.d"
log-file: "/var/log/nova/nova-scheduler.log"
nova-consoleauth:
binary: nova-consoleauth
config-files:
- "{snap}/etc/nova/nova.conf"
- "{snap_common}/etc/nova/nova.conf"
- "/etc/nova/nova.conf"
config-dirs:
- "{snap_common}/etc/nova.conf.d"
log-file: "{snap_common}/log/nova-consoleauth.log"
- "/etc/nova/conf.d"
log-file: "/var/log/nova/nova-consoleauth.log"
nova-manage:
binary: nova-manage
config-files:
- "{snap}/etc/nova/nova.conf"
- "{snap_common}/etc/nova/nova.conf"
- "/etc/nova/nova.conf"
config-dirs:
- "{snap_common}/etc/nova.conf.d"
- "/etc/nova/conf.d"

View File

@ -1,7 +1,7 @@
[DEFAULT]
# Set state path to writable directory
state_path = {{ snap_common }}
state_path = /var/lib/nova
[oslo_concurrency]
# Oslo Concurrency lock path
lock_path = {{ snap_common }}/lock
lock_path = /var/lock/nova

View File

@ -14,38 +14,27 @@ description: |
.
This snap provides the Nova controller component of an OpenStack
deployment.
confinement: strict
confinement: classic
grade: devel
environment:
PATH: $PATH:$SNAP/bin/
apps:
api:
command: snap-openstack nova-api-os-compute
daemon: simple
plugs:
- network
- network-bind
conductor:
command: snap-openstack nova-conductor
daemon: simple
plugs:
- network
- network-bind
scheduler:
command: snap-openstack nova-scheduler
daemon: simple
plugs:
- network
- network-bind
consoleauth:
command: snap-openstack nova-consoleauth
daemon: simple
plugs:
- network
- network-bind
manage:
command: snap-openstack nova-manage
plugs:
- network
aliases:
- nova-manage
parts:
@ -56,23 +45,18 @@ parts:
python-packages:
- pymysql
- python-memcached
- git+https://github.com/openstack-snaps/snap.openstack#egg=snap.openstack
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/master/upper-constraints.txt
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
- pkg-config
- gcc
templates:
after:
- nova
after: [nova]
plugin: dump
source: snap
config:
after:
- nova
after: [nova]
plugin: dump
source: http://tarballs.openstack.org/nova/nova-master.tar.gz
filesets:

View File

@ -6,9 +6,13 @@ skipsdist = True
basepython = python3.5
install_command = pip install {opts} {packages}
passenv = HOME TERM
whitelist_externals =
sudo
snapcraft
[testenv:snap]
deps = -r{toxinidir}/requirements.txt
commands =
sudo snap install core
snapcraft clean
snapcraft snap