Merge pull request #1 from salt-formulas/known-fixups
eCleanup + extend tests/pillars
diff --git a/.gitignore b/.gitignore
index 1bfce6e..aa8e42a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
+.kitchen
tests/build/
*.swp
*.pyc
-.ropeproject
\ No newline at end of file
+.ropeproject
diff --git a/.gitreview b/.gitreview
deleted file mode 100644
index 373e555..0000000
--- a/.gitreview
+++ /dev/null
@@ -1,4 +0,0 @@
-[gerrit]
-host=review.openstack.org
-port=29418
-project=openstack/salt-formula-glance.git
diff --git a/Makefile b/Makefile
index fc83783..1043fbe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,38 @@
DESTDIR=/
SALTENVDIR=/usr/share/salt-formulas/env
RECLASSDIR=/usr/share/salt-formulas/reclass
-FORMULANAME=$(shell grep name: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\-]*')
+FORMULANAME=$(shell grep name: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\-\_]*')
+VERSION=$(shell grep version: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\.\-\_]*')
+VERSION_MAJOR := $(shell echo $(VERSION)|cut -d . -f 1-2)
+VERSION_MINOR := $(shell echo $(VERSION)|cut -d . -f 3)
+
+NEW_MAJOR_VERSION ?= $(shell date +%Y.%m|sed 's,\.0,\.,g')
+NEW_MINOR_VERSION ?= $(shell /bin/bash -c 'echo $$[ $(VERSION_MINOR) + 1 ]')
+
+MAKE_PID := $(shell echo $$PPID)
+JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$(MAKE)")))
+
+ifneq ($(subst -j,,$(JOB_FLAG)),)
+JOBS := $(subst -j,,$(JOB_FLAG))
+else
+JOBS := 1
+endif
+
+KITCHEN_LOCAL_YAML?=.kitchen.yml
+KITCHEN_OPTS?="--concurrency=$(JOBS)"
+KITCHEN_OPTS_CREATE?=""
+KITCHEN_OPTS_CONVERGE?=""
+KITCHEN_OPTS_VERIFY?=""
+KITCHEN_OPTS_TEST?=""
all:
@echo "make install - Install into DESTDIR"
@echo "make test - Run tests"
+ @echo "make kitchen - Run Kitchen CI tests (create, converge, verify)"
@echo "make clean - Cleanup after tests run"
+ @echo "make release-major - Generate new major release"
+ @echo "make release-minor - Generate new minor release"
+ @echo "make changelog - Show changes since last release"
install:
# Formula
@@ -14,6 +40,7 @@
cp -a $(FORMULANAME) $(DESTDIR)/$(SALTENVDIR)/
[ ! -d _modules ] || cp -a _modules $(DESTDIR)/$(SALTENVDIR)/
[ ! -d _states ] || cp -a _states $(DESTDIR)/$(SALTENVDIR)/ || true
+ [ ! -d _grains ] || cp -a _grains $(DESTDIR)/$(SALTENVDIR)/ || true
# Metadata
[ -d $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) ] || mkdir -p $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
cp -a metadata/service/* $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
@@ -21,6 +48,71 @@
test:
[ ! -d tests ] || (cd tests; ./run_tests.sh)
+release-major: check-changes
+ @echo "Current version is $(VERSION), new version is $(NEW_MAJOR_VERSION)"
+ @[ $(VERSION_MAJOR) != $(NEW_MAJOR_VERSION) ] || (echo "Major version $(NEW_MAJOR_VERSION) already released, nothing to do. Do you want release-minor?" && exit 1)
+ echo "$(NEW_MAJOR_VERSION)" > VERSION
+ sed -i 's,version: .*,version: "$(NEW_MAJOR_VERSION)",g' metadata.yml
+ [ ! -f debian/changelog ] || dch -v $(NEW_MAJOR_VERSION) -m --force-distribution -D `dpkg-parsechangelog -S Distribution` "New version"
+ make genchangelog-$(NEW_MAJOR_VERSION)
+ (git add -u; git commit -m "Version $(NEW_MAJOR_VERSION)")
+ git tag -s -m $(NEW_MAJOR_VERSION) $(NEW_MAJOR_VERSION)
+
+release-minor: check-changes
+ @echo "Current version is $(VERSION), new version is $(VERSION_MAJOR).$(NEW_MINOR_VERSION)"
+ echo "$(VERSION_MAJOR).$(NEW_MINOR_VERSION)" > VERSION
+ sed -i 's,version: .*,version: "$(VERSION_MAJOR).$(NEW_MINOR_VERSION)",g' metadata.yml
+ [ ! -f debian/changelog ] || dch -v $(VERSION_MAJOR).$(NEW_MINOR_VERSION) -m --force-distribution -D `dpkg-parsechangelog -S Distribution` "New version"
+ make genchangelog-$(VERSION_MAJOR).$(NEW_MINOR_VERSION)
+ (git add -u; git commit -m "Version $(VERSION_MAJOR).$(NEW_MINOR_VERSION)")
+ git tag -s -m $(NEW_MAJOR_VERSION) $(VERSION_MAJOR).$(NEW_MINOR_VERSION)
+
+check-changes:
+ @git log --pretty=oneline --decorate $(VERSION)..HEAD | grep -Eqc '.*' || (echo "No new changes since version $(VERSION)"; exit 1)
+
+changelog:
+ git log --pretty=short --invert-grep --grep="Merge pull request" --decorate $(VERSION)..HEAD
+
+genchangelog: genchangelog-$(VERSION_MAJOR).$(NEW_MINOR_VERSION)
+
+genchangelog-%:
+ $(eval NEW_VERSION := $(patsubst genchangelog-%,%,$@))
+ (echo "=========\nChangelog\n=========\n"; \
+ (echo $(NEW_VERSION);git tag) | sort -r | grep -E '^[0-9\.]+' | while read i; do \
+ cur=$$i; \
+ test $$i = $(NEW_VERSION) && i=HEAD; \
+ prev=`(echo $(NEW_VERSION);git tag)|sort|grep -E '^[0-9\.]+'|grep -B1 "$$cur\$$"|head -1`; \
+ echo "Version $$cur\n=============================\n"; \
+ git log --pretty=short --invert-grep --grep="Merge pull request" --decorate $$prev..$$i; \
+ echo; \
+ done) > CHANGELOG.rst
+
+kitchen-check:
+ @[ -e $(KITCHEN_LOCAL_YAML) ] || (echo "Kitchen tests not available, there's no $(KITCHEN_LOCAL_YAML)." && exit 1)
+
+kitchen: kitchen-check kitchen-create kitchen-converge kitchen-verify kitchen-list
+
+kitchen-create: kitchen-check
+ kitchen create ${KITCHEN_OPTS} ${KITCHEN_OPTS_CREATE}
+ [ "$(shell echo $(KITCHEN_LOCAL_YAML)|grep -Eo docker)" = "docker" ] || sleep 120
+
+kitchen-converge: kitchen-check
+ kitchen converge ${KITCHEN_OPTS} ${KITCHEN_OPTS_CONVERGE} &&\
+ kitchen converge ${KITCHEN_OPTS} ${KITCHEN_OPTS_CONVERGE}
+
+kitchen-verify: kitchen-check
+ [ ! -d tests/integration ] || kitchen verify -t tests/integration ${KITCHEN_OPTS} ${KITCHEN_OPTS_VERIFY}
+ [ -d tests/integration ] || kitchen verify ${KITCHEN_OPTS} ${KITCHEN_OPTS_VERIFY}
+
+kitchen-test: kitchen-check
+ [ ! -d tests/integration ] || kitchen test -t tests/integration ${KITCHEN_OPTS} ${KITCHEN_OPTS_TEST}
+ [ -d tests/integration ] || kitchen test ${KITCHEN_OPTS} ${KITCHEN_OPTS_TEST}
+
+kitchen-list: kitchen-check
+ kitchen list
+
clean:
+ [ ! -x "$(shell which kitchen)" ] || kitchen destroy
+ [ ! -d .kitchen ] || rm -rf .kitchen
[ ! -d tests/build ] || rm -rf tests/build
[ ! -d build ] || rm -rf build
diff --git a/README.rst b/README.rst
index 50af4ff..d372d2b 100644
--- a/README.rst
+++ b/README.rst
@@ -1,34 +1,14 @@
-==================
-Glance Image Store
-==================
+==============
+Glance formula
+==============
The Glance project provides services for discovering, registering, and
retrieving virtual machine images. Glance has a RESTful API that allows
querying of VM image metadata as well as retrieval of the actual image.
-Usage
-=====
-Import new public image
-
-.. code-block:: yaml
-
- glance image-create --name 'Windows 7 x86_64' --is-public true --container-format bare --disk-format qcow2 < ./win7.qcow2
-
-Change new image's disk properties
-
-.. code-block:: yaml
-
- glance image-update "Windows 7 x86_64" --property hw_disk_bus=ide
-
-Change new image's NIC properties
-
-.. code-block:: yaml
-
- glance image-update "Windows 7 x86_64" --property hw_vif_model=rtl8139
-
-Sample pillar
-=============
+Sample pillars
+==============
.. code-block:: yaml
@@ -72,9 +52,49 @@
public: true
audit:
enabled: false
+ api_limit_max: 100
+ limit_param_default: 50
+The pagination is controlled by the *api_limit_max* and *limit_param_default*
+parameters as shown above:
-Client-side RabbitMQ HA setup
+* *api_limit_max* defines the maximum number of records that the server will
+ return.
+
+* *limit_param_default* is the default *limit* parameter that
+ applies if the request didn't defined it explicitly.
+
+Keystone and cinder region
+
+.. code-block:: yaml
+
+ glance:
+ server:
+ enabled: true
+ version: kilo
+ ...
+ identity:
+ engine: keystone
+ host: 127.0.0.1
+ region: RegionTwo
+ ...
+
+Ceph integration glance
+
+.. code-block:: yaml
+
+ glance:
+ server:
+ enabled: true
+ version: juno
+ storage:
+ engine: rbd,http
+ user: glance
+ pool: images
+ chunk_size: 8
+ client_glance_key: AQDOavlU6BsSJhAAnpFR906mvdgdfRqLHwu0Uw==
+
+RabbitMQ HA setup
.. code-block:: yaml
@@ -92,8 +112,7 @@
virtual_host: '/openstack'
....
-
-Enable auditing filter, ie: CADF
+Enable auditing filter (CADF):
.. code-block:: yaml
@@ -107,43 +126,55 @@
....
-Keystone and cinder region
-============================
+Client role
+-----------
+
+Glance images
.. code-block:: yaml
- glance:
+ glance:
+ client:
+ enabled: true
server:
- enabled: true
- version: kilo
- ...
- identity:
- engine: keystone
- host: 127.0.0.1
- region: RegionTwo
- ...
+ profile_admin:
+ image:
+ cirros-test:
+ visibility: public
+ protected: false
+ location: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img
-Ceph integration glance
-=======================
+Usage
+=====
+
+Import new public image
.. code-block:: yaml
- glance:
- server:
- enabled: true
- version: juno
- storage:
- engine: rbd,http
- user: glance
- pool: images
- chunk_size: 8
- client_glance_key: AQDOavlU6BsSJhAAnpFR906mvdgdfRqLHwu0Uw==
+ glance image-create --name 'Windows 7 x86_64' --is-public true --container-format bare --disk-format qcow2 < ./win7.qcow2
+
+Change new image's disk properties
+
+.. code-block:: yaml
+
+ glance image-update "Windows 7 x86_64" --property hw_disk_bus=ide
+
+Change new image's NIC properties
+
+.. code-block:: yaml
+
+ glance image-update "Windows 7 x86_64" --property hw_vif_model=rtl8139
+
+
+External links
+==============
* http://ceph.com/docs/master/rbd/rbd-openstack/
+
Documentation and Bugs
-============================
+======================
To learn how to deploy OpenStack Salt, consult the documentation available
online at:
@@ -167,3 +198,36 @@
Developers should also join the discussion on the IRC list, at:
https://wiki.openstack.org/wiki/Meetings/openstack-salt
+
+Documentation and Bugs
+======================
+
+To learn how to install and update salt-formulas, consult the documentation
+available online at:
+
+ http://salt-formulas.readthedocs.io/
+
+In the unfortunate event that bugs are discovered, they should be reported to
+the appropriate issue tracker. Use Github issue tracker for specific salt
+formula:
+
+ https://github.com/salt-formulas/salt-formula-glance/issues
+
+For feature requests, bug reports or blueprints affecting entire ecosystem,
+use Launchpad salt-formulas project:
+
+ https://launchpad.net/salt-formulas
+
+You can also join salt-formulas-users team and subscribe to mailing list:
+
+ https://launchpad.net/~salt-formulas-users
+
+Developers wishing to work on the salt-formulas projects should always base
+their work on master branch and submit pull request against specific formula.
+
+ https://github.com/salt-formulas/salt-formula-glance
+
+Any questions or feedback is always welcome so feel free to join our IRC
+channel:
+
+ #salt-formulas @ irc.freenode.net
diff --git a/glance/_states/glanceng.py b/glance/_states/glanceng.py
new file mode 100644
index 0000000..fb41fb1
--- /dev/null
+++ b/glance/_states/glanceng.py
@@ -0,0 +1,249 @@
+# -*- coding: utf-8 -*-
+'''
+Managing Images in OpenStack Glance
+===================================
+'''
+# Import python libs
+from __future__ import absolute_import
+import logging
+import time
+
+# Import salt libs
+
+# Import OpenStack libs
+try:
+ from keystoneclient.exceptions import \
+ Unauthorized as kstone_Unauthorized
+ HAS_KEYSTONE = True
+except ImportError:
+ try:
+ from keystoneclient.apiclient.exceptions import \
+ Unauthorized as kstone_Unauthorized
+ HAS_KEYSTONE = True
+ except ImportError:
+ HAS_KEYSTONE = False
+
+try:
+ from glanceclient.exc import \
+ HTTPUnauthorized as glance_Unauthorized
+ HAS_GLANCE = True
+except ImportError:
+ HAS_GLANCE = False
+
+log = logging.getLogger(__name__)
+
+
+def __virtual__():
+ '''
+ Only load if dependencies are loaded
+ '''
+ return HAS_KEYSTONE and HAS_GLANCE
+
+
+def _find_image(name, profile=None):
+ '''
+ Tries to find image with given name, returns
+ - image, 'Found image <name>'
+ - None, 'No such image found'
+ - False, 'Found more than one image with given name'
+ '''
+ try:
+ images = __salt__['glance.image_list'](name=name, profile=profile)
+ except kstone_Unauthorized:
+ return False, 'keystoneclient: Unauthorized'
+ except glance_Unauthorized:
+ return False, 'glanceclient: Unauthorized'
+ log.debug('Got images: {0}'.format(images))
+
+ if type(images) is dict and len(images) == 1 and 'images' in images:
+ images = images['images']
+
+ images_list = images.values() if type(images) is dict else images
+
+ if len(images_list) == 0:
+ return None, 'No image with name "{0}"'.format(name)
+ elif len(images_list) == 1:
+ return images_list[0], 'Found image {0}'.format(name)
+ elif len(images_list) > 1:
+ return False, 'Found more than one image with given name'
+ else:
+ raise NotImplementedError
+
+
+def image_present(name, profile=None, visibility='public', protected=None,
+ checksum=None, location=None, disk_format='raw', wait_for=None,
+ timeout=30):
+ '''
+ Checks if given image is present with properties
+ set as specified.
+ An image should got through the stages 'queued', 'saving'
+ before becoming 'active'. The attribute 'checksum' can
+ only be checked once the image is active.
+ If you don't specify 'wait_for' but 'checksum' the function
+ will wait for the image to become active before comparing
+ checksums. If you don't specify checksum either the function
+ will return when the image reached 'saving'.
+ The default timeout for both is 30 seconds.
+ Supported properties:
+ - profile (string)
+ - visibility ('public' or 'private')
+ - protected (bool)
+ - checksum (string, md5sum)
+ - location (URL, to copy from)
+ - disk_format ('raw' (default), 'vhd', 'vhdx', 'vmdk', 'vdi', 'iso',
+ 'qcow2', 'aki', 'ari' or 'ami')
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': '',
+ }
+ acceptable = ['queued', 'saving', 'active']
+ if wait_for is None and checksum is None:
+ wait_for = 'saving'
+ elif wait_for is None and checksum is not None:
+ wait_for = 'active'
+
+ # Just pop states until we reach the
+ # first acceptable one:
+ while len(acceptable) > 1:
+ if acceptable[0] == wait_for:
+ break
+ else:
+ acceptable.pop(0)
+
+ image, msg = _find_image(name, profile)
+ if image is False:
+ if __opts__['test']:
+ ret['result'] = None
+ else:
+ ret['result'] = False
+ ret['comment'] = msg
+ return ret
+ log.debug(msg)
+ # No image yet and we know where to get one
+ if image is None and location is not None:
+ if __opts__['test']:
+ ret['result'] = None
+ ret['comment'] = 'glance.image_present would ' \
+ 'create an image from {0}'.format(location)
+ return ret
+ image = __salt__['glance.image_create'](name=name, profile=profile,
+ protected=protected, visibility=visibility,
+ location=location, disk_format=disk_format)
+ log.debug('Created new image:\n{0}'.format(image))
+ ret['changes'] = {
+ name:
+ {
+ 'new':
+ {
+ 'id': image['id']
+ },
+ 'old': None
+ }
+ }
+ timer = timeout
+ # Kinda busy-loopy but I don't think the Glance
+ # API has events we can listen for
+ while timer > 0:
+ if 'status' in image and \
+ image['status'] in acceptable:
+ log.debug('Image {0} has reached status {1}'.format(
+ image['name'], image['status']))
+ break
+ else:
+ timer -= 5
+ time.sleep(5)
+ image, msg = _find_image(name, profile)
+ if not image:
+ ret['result'] = False
+ ret['comment'] += 'Created image {0} '.format(
+ name) + ' vanished:\n' + msg
+ return ret
+ if timer <= 0 and image['status'] not in acceptable:
+ ret['result'] = False
+ ret['comment'] += 'Image didn\'t reach an acceptable '+\
+ 'state ({0}) before timeout:\n'.format(acceptable)+\
+ '\tLast status was "{0}".\n'.format(image['status'])
+
+ # There's no image but where would I get one??
+ elif location is None:
+ if __opts__['test']:
+ ret['result'] = None
+ ret['comment'] = 'No location to copy image from specified,\n' +\
+ 'glance.image_present would not create one'
+ else:
+ ret['result'] = False
+ ret['comment'] = 'No location to copy image from specified,\n' +\
+ 'not creating a new image.'
+ return ret
+
+ # If we've created a new image also return its last status:
+ if name in ret['changes']:
+ ret['changes'][name]['new']['status'] = image['status']
+
+ if visibility:
+ if image['visibility'] != visibility:
+ old_value = image['visibility']
+ if not __opts__['test']:
+ image = __salt__['glance.image_update'](
+ id=image['id'], visibility=visibility)
+ # Check if image_update() worked:
+ if image['visibility'] != visibility:
+ if not __opts__['test']:
+ ret['result'] = False
+ elif __opts__['test']:
+ ret['result'] = None
+ ret['comment'] += '"visibility" is {0}, '\
+ 'should be {1}.\n'.format(image['visibility'],
+ visibility)
+ else:
+ if 'new' in ret['changes']:
+ ret['changes']['new']['visibility'] = visibility
+ else:
+ ret['changes']['new'] = {'visibility': visibility}
+ if 'old' in ret['changes']:
+ ret['changes']['old']['visibility'] = old_value
+ else:
+ ret['changes']['old'] = {'visibility': old_value}
+ else:
+ ret['comment'] += '"visibility" is correct ({0}).\n'.format(
+ visibility)
+ if protected is not None:
+ if not isinstance(protected, bool) or image['protected'] ^ protected:
+ if not __opts__['test']:
+ ret['result'] = False
+ else:
+ ret['result'] = None
+ ret['comment'] += '"protected" is {0}, should be {1}.\n'.format(
+ image['protected'], protected)
+ else:
+ ret['comment'] += '"protected" is correct ({0}).\n'.format(
+ protected)
+ if 'status' in image and checksum:
+ if image['status'] == 'active':
+ if 'checksum' not in image:
+ # Refresh our info about the image
+ image = __salt__['glance.image_show'](image['id'])
+ if 'checksum' not in image:
+ if not __opts__['test']:
+ ret['result'] = False
+ else:
+ ret['result'] = None
+ ret['comment'] += 'No checksum available for this image:\n' +\
+ '\tImage has status "{0}".'.format(image['status'])
+ elif image['checksum'] != checksum:
+ if not __opts__['test']:
+ ret['result'] = False
+ else:
+ ret['result'] = None
+ ret['comment'] += '"checksum" is {0}, should be {1}.\n'.format(
+ image['checksum'], checksum)
+ else:
+ ret['comment'] += '"checksum" is correct ({0}).\n'.format(
+ checksum)
+ elif image['status'] in ['saving', 'queued']:
+ ret['comment'] += 'Checksum won\'t be verified as image ' +\
+ 'hasn\'t reached\n\t "status=active" yet.\n'
+ log.debug('glance.image_present will return: {0}'.format(ret))
+ return ret
\ No newline at end of file
diff --git a/glance/client.sls b/glance/client.sls
new file mode 100644
index 0000000..c3f9213
--- /dev/null
+++ b/glance/client.sls
@@ -0,0 +1,29 @@
+{%- from "glance/map.jinja" import client with context %}
+{%- if client.enabled %}
+
+glance_client_packages:
+ pkg.installed:
+ - names: {{ client.pkgs }}
+
+{%- for identity_name, identity in client.identity.iteritems() %}
+
+{%- for image_name, image in identity.image.iteritems() %}
+
+glance_openstack_image_{{ image_name }}:
+ glanceng.image_present:
+ - name: {{ image_name }}
+ - profile: {{ identity_name }}
+ {%- if image.visibility is defined %}
+ - visibility: {{ image.visibility }}
+ {%- endif %}
+ {%- if image.protected is defined %}
+ - protected: {{ image.protected }}
+ {%- endif %}
+ {%- if image.location is defined %}
+ - location: {{ image.location }}
+ {%- endif %}
+
+{%- endfor %}
+{%- endfor %}
+
+{%- endif %}
\ No newline at end of file
diff --git a/glance/files/collectd_openstack_glance.conf b/glance/files/collectd_openstack_glance.conf
index ad5179f..3fb160e 100644
--- a/glance/files/collectd_openstack_glance.conf
+++ b/glance/files/collectd_openstack_glance.conf
@@ -5,6 +5,8 @@
Username "{{ plugin.username }}"
Password "{{ plugin.password }}"
Tenant "{{ plugin.tenant }}"
- MaxRetries "2"
- Timeout "20"
+ MaxRetries "{{ plugin.max_retries|default(2) }}"
+ Timeout "{{ plugin.timeout|default(20) }}"
+ PaginationLimit "{{ plugin.pagination_limit|default(25) }}"
+ PollingInterval "{{ plugin.polling_interval|default(60) }}"
</Module>
diff --git a/glance/files/juno/glance-api.conf.Debian b/glance/files/juno/glance-api.conf.Debian
index 13defbd..7f8b7f7 100644
--- a/glance/files/juno/glance-api.conf.Debian
+++ b/glance/files/juno/glance-api.conf.Debian
@@ -268,41 +268,41 @@
# Version of the authentication service to use
# Valid versions are '2' for keystone and '1' for swauth and rackspace
-swift_store_auth_version = 2
+#swift_store_auth_version = 2
# Address where the Swift authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'https://'
# For swauth, use something like '127.0.0.1:8080/v1.0/'
-swift_store_auth_address = 127.0.0.1:5000/v2.0/
+#swift_store_auth_address = 127.0.0.1:5000/v2.0/
# User to authenticate against the Swift authentication service
# If you use Swift authentication service, set it to 'account':'user'
# where 'account' is a Swift storage account and 'user'
# is a user in that account
-swift_store_user = jdoe:jdoe
+#swift_store_user = jdoe:jdoe
# Auth key for the user authenticating against the
# Swift authentication service
-swift_store_key = a86850deb2742ec3cb41518e26aa2d89
+#swift_store_key = a86850deb2742ec3cb41518e26aa2d89
# Container within the account that the account should use
# for storing images in Swift
-swift_store_container = glance
+#swift_store_container = glance
# Do we create the container if it does not exist?
-swift_store_create_container_on_put = False
+#swift_store_create_container_on_put = False
# What size, in MB, should Glance start chunking image files
# and do a large object manifest in Swift? By default, this is
# the maximum object size in Swift, which is 5GB
-swift_store_large_object_size = 5120
+#swift_store_large_object_size = 5120
# When doing a large object manifest, what size, in MB, should
# Glance write chunks to Swift? This amount of data is written
# to a temporary disk buffer during the process of chunking
# the image file, and the default is 200MB
-swift_store_large_object_chunk_size = 200
+#swift_store_large_object_chunk_size = 200
# Whether to use ServiceNET to communicate with the Swift storage servers.
# (If you aren't RACKSPACE, leave this False!)
@@ -310,7 +310,7 @@
# To use ServiceNET for authentication, prefix hostname of
# `swift_store_auth_address` with 'snet-'.
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
-swift_enable_snet = False
+#swift_enable_snet = False
# If set to True enables multi-tenant storage mode which causes Glance images
# to be stored in tenant specific Swift accounts.
diff --git a/glance/files/kilo/glance-api.conf.Debian b/glance/files/kilo/glance-api.conf.Debian
index 54a91b0..74cdb60 100644
--- a/glance/files/kilo/glance-api.conf.Debian
+++ b/glance/files/kilo/glance-api.conf.Debian
@@ -616,35 +616,35 @@
# Version of the authentication service to use
# Valid versions are '2' for keystone and '1' for swauth and rackspace
-swift_store_auth_version = 2
+# swift_store_auth_version = 2
# Address where the Swift authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'https://'
# For swauth, use something like '127.0.0.1:8080/v1.0/'
-swift_store_auth_address = 127.0.0.1:5000/v2.0/
+# swift_store_auth_address = 127.0.0.1:5000/v2.0/
# User to authenticate against the Swift authentication service
# If you use Swift authentication service, set it to 'account':'user'
# where 'account' is a Swift storage account and 'user'
# is a user in that account
-swift_store_user = jdoe:jdoe
+# swift_store_user = jdoe:jdoe
# Auth key for the user authenticating against the
# Swift authentication service
-swift_store_key = a86850deb2742ec3cb41518e26aa2d89
+# swift_store_key = a86850deb2742ec3cb41518e26aa2d89
# Container within the account that the account should use
# for storing images in Swift
-swift_store_container = glance
+# swift_store_container = glance
# Do we create the container if it does not exist?
-swift_store_create_container_on_put = False
+# swift_store_create_container_on_put = False
# What size, in MB, should Glance start chunking image files
# and do a large object manifest in Swift? By default, this is
# the maximum object size in Swift, which is 5GB
-swift_store_large_object_size = 5120
+# swift_store_large_object_size = 5120
# swift_store_config_file = glance-swift.conf
# This file contains references for each of the configured
@@ -659,7 +659,7 @@
# Glance write chunks to Swift? This amount of data is written
# to a temporary disk buffer during the process of chunking
# the image file, and the default is 200MB
-swift_store_large_object_chunk_size = 200
+# swift_store_large_object_chunk_size = 200
# If set, the configured endpoint will be used. If None, the storage URL
# from the auth response will be used. The location of an object is
@@ -720,14 +720,14 @@
# Address where the S3 authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'http://'
-s3_store_host = s3.amazonaws.com
+#s3_store_host = s3.amazonaws.com
# User to authenticate against the S3 authentication service
-s3_store_access_key = <20-char AWS access key>
+#s3_store_access_key = <20-char AWS access key>
# Auth key for the user authenticating against the
# S3 authentication service
-s3_store_secret_key = <40-char AWS secret key>
+#s3_store_secret_key = <40-char AWS secret key>
# Container within the account that the account should use
# for storing images in S3. Note that S3 has a flat namespace,
@@ -735,10 +735,10 @@
# easy way to do this is append your AWS access key to "glance".
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
# your AWS access key if you use it in your bucket name below!
-s3_store_bucket = <lowercased 20-char aws access key>glance
+#s3_store_bucket = <lowercased 20-char aws access key>glance
# Do we create the bucket if it does not exist?
-s3_store_create_bucket_on_put = False
+#s3_store_create_bucket_on_put = False
# When sending images to S3, the data will first be written to a
# temporary buffer on disk. By default the platform's temporary directory
diff --git a/glance/files/liberty/glance-api.conf.Debian b/glance/files/liberty/glance-api.conf.Debian
index 98c2841..82d5470 100644
--- a/glance/files/liberty/glance-api.conf.Debian
+++ b/glance/files/liberty/glance-api.conf.Debian
@@ -39,6 +39,9 @@
# package, it is also possible to use: glance.db.registry.api
# data_api = glance.db.sqlalchemy.api
+limit_param_default = {{ server.limit_default|default('25') }}
+api_limit_max = {{ server.api_limit_max|default('1000') }}
+
# The number of child process workers that will be
# created to service API requests. The default will be
# equal to the number of CPUs available. (integer value)
@@ -622,30 +625,30 @@
# Version of the authentication service to use
# Valid versions are '2' for keystone and '1' for swauth and rackspace
-swift_store_auth_version = 2
+#swift_store_auth_version = 2
# Address where the Swift authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'https://'
# For swauth, use something like '127.0.0.1:8080/v1.0/'
-swift_store_auth_address = 127.0.0.1:5000/v2.0/
+#swift_store_auth_address = 127.0.0.1:5000/v2.0/
# User to authenticate against the Swift authentication service
# If you use Swift authentication service, set it to 'account':'user'
# where 'account' is a Swift storage account and 'user'
# is a user in that account
-swift_store_user = jdoe:jdoe
+#swift_store_user = jdoe:jdoe
# Auth key for the user authenticating against the
# Swift authentication service
-swift_store_key = a86850deb2742ec3cb41518e26aa2d89
+#swift_store_key = a86850deb2742ec3cb41518e26aa2d89
# Container within the account that the account should use
# for storing images in Swift
-swift_store_container = glance
+#swift_store_container = glance
# Do we create the container if it does not exist?
-swift_store_create_container_on_put = False
+#swift_store_create_container_on_put = False
# What size, in MB, should Glance start chunking image files
# and do a large object manifest in Swift? By default, this is
@@ -726,14 +729,14 @@
# Address where the S3 authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'http://'
-s3_store_host = s3.amazonaws.com
+#s3_store_host = s3.amazonaws.com
# User to authenticate against the S3 authentication service
-s3_store_access_key = <20-char AWS access key>
+#s3_store_access_key = <20-char AWS access key>
# Auth key for the user authenticating against the
# S3 authentication service
-s3_store_secret_key = <40-char AWS secret key>
+#s3_store_secret_key = <40-char AWS secret key>
# Container within the account that the account should use
# for storing images in S3. Note that S3 has a flat namespace,
@@ -741,7 +744,7 @@
# easy way to do this is append your AWS access key to "glance".
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
# your AWS access key if you use it in your bucket name below!
-s3_store_bucket = <lowercased 20-char aws access key>glance
+#s3_store_bucket = <lowercased 20-char aws access key>glance
# Do we create the bucket if it does not exist?
s3_store_create_bucket_on_put = False
@@ -800,9 +803,9 @@
# ============ Sheepdog Store Options =============================
-sheepdog_store_address = localhost
+#sheepdog_store_address = localhost
-sheepdog_store_port = 7000
+#sheepdog_store_port = 7000
# Images will be chunked into objects of this size (in megabytes).
# For best performance, this should be a power of two
diff --git a/glance/files/mitaka/glance-api.conf.Debian b/glance/files/mitaka/glance-api.conf.Debian
index ed410f8..7eaaea2 100644
--- a/glance/files/mitaka/glance-api.conf.Debian
+++ b/glance/files/mitaka/glance-api.conf.Debian
@@ -54,11 +54,11 @@
# Default value for the number of items returned by a request if not
# specified explicitly in the request (integer value)
-#limit_param_default = 25
+limit_param_default = {{ server.limit_default|default('25') }}
# Maximum permissible number of items that could be returned by a
# request (integer value)
-#api_limit_max = 1000
+api_limit_max = {{ server.api_limit_max|default('1000') }}
# Whether to include the backend image storage location in image
# properties. Revealing storage location can be a security risk, so
diff --git a/glance/init.sls b/glance/init.sls
index e260848..b325e06 100644
--- a/glance/init.sls
+++ b/glance/init.sls
@@ -3,3 +3,6 @@
{%- if pillar.glance.server.enabled %}
- glance.server
{%- endif %}
+{% if pillar.glance.client is defined %}
+- glance.client
+{% endif %}
\ No newline at end of file
diff --git a/glance/map.jinja b/glance/map.jinja
index a79bade..6e7133c 100644
--- a/glance/map.jinja
+++ b/glance/map.jinja
@@ -17,3 +17,12 @@
}
},
}, merge=pillar.glance.get('server', {})) %}
+
+{% set client = salt['grains.filter_by']({
+ 'Debian': {
+ 'pkgs': ['python-glanceclient']
+ },
+ 'RedHat': {
+ 'pkgs': ['python-glanceclient']
+ },
+}, merge=pillar.glance.get('client', {})) %}
\ No newline at end of file
diff --git a/glance/meta/grafana.yml b/glance/meta/grafana.yml
index a4aea19..79a0e93 100644
--- a/glance/meta/grafana.yml
+++ b/glance/meta/grafana.yml
@@ -2,3 +2,18 @@
glance:
format: json
template: glance/files/grafana_dashboards/glance_influxdb.json
+ main:
+ row:
+ ost-control-plane:
+ title: OpenStack Control Plane
+ panel:
+ glance:
+ title: Glance
+ links:
+ - dashboard: Glance
+ title: Glance
+ type: dashboard
+ target:
+ cluster_status:
+ rawQuery: true
+ query: SELECT last(value) FROM cluster_status WHERE cluster_name = 'glance' AND environment_label = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)