diff options
| author | Mark Asselstine <mark.asselstine@windriver.com> | 2017-12-01 15:19:42 -0500 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-12-01 21:46:36 -0500 |
| commit | 38973e8bc393a4ca36090c58c8b6eb6d093ea69a (patch) | |
| tree | 3e9559be43f0e19f9067ae1524838ea78614e9ea /meta-openstack/recipes-devtools/python/python-glance | |
| parent | 2cf8169090392f6a7a4f8f119776f499f181fdf2 (diff) | |
| download | meta-cloud-services-38973e8bc393a4ca36090c58c8b6eb6d093ea69a.tar.gz | |
python-glance: uprev to latest stable/pike
Complete the uprev and the transition to systemd. The configuration is
cleaned up to match the setup documentation found in the openstack
installation guide. Once a build is completed with these changes the
controller image is able to have images added via:
%> . /etc/keystone/admin-openrc
%> openstack image create "cirros" \
--file cirros-0.3.5-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
Images can be listed with 'openstack image list' or
'glance image-list' or via the horizon web interface.
Requires introduction of python-glance-store...
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-glance')
4 files changed, 94 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance-api.service b/meta-openstack/recipes-devtools/python/python-glance/glance-api.service new file mode 100644 index 0000000..6777496 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance/glance-api.service | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=OpenStack Image Service API | ||
| 3 | After=postgresql.service keystone.service ntp.service rabbitmq-server.service | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | User=%USER% | ||
| 7 | Group=%GROUP% | ||
| 8 | Type=simple | ||
| 9 | WorkingDirectory=%LOCALSTATEDIR%/lib/glance | ||
| 10 | PermissionsStartOnly=true | ||
| 11 | ExecStartPre=/bin/mkdir -p %LOCALSTATEDIR%/lock/glance %LOCALSTATEDIR%/log/glance %LOCALSTATEDIR%/lib/glance | ||
| 12 | ExecStartPre=/bin/chown %USER%:%GROUP% %LOCALSTATEDIR%/lock/glance %LOCALSTATEDIR%/lib/glance | ||
| 13 | ExecStartPre=/bin/chown %USER%:adm %LOCALSTATEDIR%/log/glance | ||
| 14 | ExecStart=/usr/bin/glance-api --config-file=%SYSCONFDIR%/glance/glance-api.conf --log-file=%LOCALSTATEDIR%/log/glance/glance-api.log | ||
| 15 | Restart=on-failure | ||
| 16 | LimitNOFILE=65535 | ||
| 17 | TimeoutStopSec=15 | ||
| 18 | |||
| 19 | [Install] | ||
| 20 | WantedBy=multi-user.target | ||
diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance-init b/meta-openstack/recipes-devtools/python/python-glance/glance-init new file mode 100644 index 0000000..8551399 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance/glance-init | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Basic glance setup based on: | ||
| 4 | # https://docs.openstack.org/glance/pike/install/install-debian.html | ||
| 5 | # | ||
| 6 | # Prerequisites: keystone must be available and bootstrapped | ||
| 7 | # | ||
| 8 | |||
| 9 | # Substitutions setup at do_intall() | ||
| 10 | DB_USER=%DB_USER% | ||
| 11 | GLANCE_USER=%GLANCE_USER% | ||
| 12 | GLANCE_GROUP=%GLANCE_GROUP% | ||
| 13 | CONTROLLER_IP=%CONTROLLER_IP% | ||
| 14 | ADMIN_USER=%ADMIN_USER% | ||
| 15 | ADMIN_PASSWORD=%ADMIN_PASSWORD% | ||
| 16 | ADMIN_ROLE=%ADMIN_ROLE% | ||
| 17 | SYSCONFDIR=%SYSCONFDIR% | ||
| 18 | |||
| 19 | # Create the glance DB and grant the necessary permissions | ||
| 20 | sudo -u postgres psql -c "CREATE DATABASE glance" 2> /dev/null | ||
| 21 | sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE glance TO ${DB_USER}" 2> /dev/null | ||
| 22 | |||
| 23 | source ${SYSCONFDIR}/keystone/admin-openrc | ||
| 24 | |||
| 25 | openstack user create --domain default --password ${ADMIN_PASSWORD} ${GLANCE_USER} | ||
| 26 | |||
| 27 | # Ensure the 'service' project exists | ||
| 28 | openstack project show service > /dev/null 2>&1 | ||
| 29 | if [ $? -ne 0 ]; then | ||
| 30 | openstack project create service --domain default | ||
| 31 | fi | ||
| 32 | openstack role add --project service --user ${GLANCE_USER} ${ADMIN_ROLE} | ||
| 33 | |||
| 34 | openstack service create --name glance --description "OpenStack Image" image | ||
| 35 | openstack endpoint create --region RegionOne image public http://${CONTROLLER_IP}:9292 | ||
| 36 | openstack endpoint create --region RegionOne image internal http://${CONTROLLER_IP}:9292 | ||
| 37 | openstack endpoint create --region RegionOne image admin http://${CONTROLLER_IP}:9292 | ||
| 38 | |||
| 39 | sudo -u ${GLANCE_USER} glance-manage db_sync | ||
| 40 | |||
| 41 | systemctl restart glance-registry | ||
| 42 | systemctl restart glance-api | ||
diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance-init.service b/meta-openstack/recipes-devtools/python/python-glance/glance-init.service new file mode 100644 index 0000000..34941b9 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance/glance-init.service | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Barebones OpenStack glance initialization | ||
| 3 | After=postgresql-init.service keystone-init.service | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | Type=oneshot | ||
| 7 | ExecStart=%SYSCONFDIR%/glance/glance-init | ||
| 8 | ExecStartPost=/bin/systemctl --no-reload disable glance-init.service | ||
| 9 | RemainAfterExit=No | ||
| 10 | |||
| 11 | [Install] | ||
| 12 | WantedBy=multi-user.target | ||
diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance-registry.service b/meta-openstack/recipes-devtools/python/python-glance/glance-registry.service new file mode 100644 index 0000000..a72e6ea --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance/glance-registry.service | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=OpenStack Image Service Registry | ||
| 3 | After=postgresql.service keystone.service ntp.service rabbitmq-server.service | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | User=%USER% | ||
| 7 | Group=%GROUP% | ||
| 8 | Type=simple | ||
| 9 | WorkingDirectory=%LOCALSTATEDIR%/lib/glance | ||
| 10 | PermissionsStartOnly=true | ||
| 11 | ExecStartPre=/bin/mkdir -p %LOCALSTATEDIR%/lock/glance %LOCALSTATEDIR%/log/glance %LOCALSTATEDIR%/lib/glance | ||
| 12 | ExecStartPre=/bin/chown %USER%:%GROUP% %LOCALSTATEDIR%/lock/glance %LOCALSTATEDIR%/lib/glance | ||
| 13 | ExecStartPre=/bin/chown %USER%:adm %LOCALSTATEDIR%/log/glance | ||
| 14 | ExecStart=/usr/bin/glance-registry --config-file=%SYSCONFDIR%/glance/glance-registry.conf --log-file=%LOCALSTATEDIR%/log/glance/glance-registry.log | ||
| 15 | Restart=on-failure | ||
| 16 | LimitNOFILE=65535 | ||
| 17 | TimeoutStopSec=15 | ||
| 18 | |||
| 19 | [Install] | ||
| 20 | WantedBy=multi-user.target | ||
