From: John Griffith Date: Mon, 26 Aug 2013 18:23:49 +0000 (-0600) Subject: Add automated check of conf sample X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=eafb7c4a2c8b030fb621d54ae34b8a32e93c05bf;p=openstack-build%2Fcinder-build.git Add automated check of conf sample This adds check_uptodate to run_tests and tox.ini checks. This also requires that we add novaclient to the test-requires, since we try and poke at cinder/compute/nova. There is another implementation in use to do this that pulls in openstack.common.config.generator, (see ceilometer project for a pretty slick impl), however adding that also pulls in a rather large list of updates and dependencies that quite frankly Cinder doesn't need and the ones that we do use break a number of things in Cinder. There's also a number of additional options added to generate_sample that I don't think we need right now. In the future we'll probably want to go this route but for now I'd just like to get automated checking in place. Change-Id: I91aa4d98f472ad5a3ece7773c75ee76d66adafc0 --- diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 9232b03f3..2214d0104 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -207,6 +207,21 @@ #backup_compression_algorithm=zlib +# +# Options defined in cinder.backup.drivers.tsm +# + +# Volume prefix for the backup id when backing up to TSM +# (string value) +#backup_tsm_volume_prefix=backup + +# TSM password for the running username (string value) +#backup_tsm_password=password + +# Enable or Disable compression for backups (boolean value) +#backup_tsm_compression=true + + # # Options defined in cinder.backup.manager # @@ -451,21 +466,6 @@ #nova_api_insecure=false - -# -# Options defined in cinder.backup.services.tsm -# - -# Volume prefix for the backup id when backing up to TSM -#backup_tsm_volume_prefix=backup - -# TSM password for the running username -#backup_tsm_password=password - -# Enable or Disable compression for backups -#backup_tsm_compression=True - - # # Options defined in cinder.db.api # @@ -534,7 +534,7 @@ # The SQLAlchemy connection string used to connect to the # database (string value) -#connection=sqlite:////Users/erikzaadi/Storage/Code/Opensource/other/Openstack/cinder/cinder/openstack/common/db/$sqlite_db +#connection=sqlite:////cinder/openstack/common/db/$sqlite_db # timeout before idle sql connections are reaped (integer # value) @@ -1115,6 +1115,10 @@ # volume creation takes a lot of time. (boolean value) #glusterfs_sparsed_volumes=true +# Create volumes as QCOW2 files rather than raw files. +# (boolean value) +#glusterfs_qcow2_volumes=false + # # Options defined in cinder.volume.drivers.gpfs @@ -1466,15 +1470,19 @@ # Enable Easy Tier for volumes (boolean value) #storwize_svc_vol_easytier=true +# The I/O group in which to allocate volumes (integer value) +#storwize_svc_vol_iogrp=0 + # Maximum number of seconds to wait for FlashCopy to be -# prepared. Maximum value is 600 seconds (10 minutes). -# (integer value) +# prepared. Maximum value is 600 seconds (10 minutes) (integer +# value) #storwize_svc_flashcopy_timeout=120 # Connection protocol (iSCSI/FC) (string value) #storwize_svc_connection_protocol=iSCSI -# Connect with multipath (currently FC-only) (boolean value) +# Connect with multipath (FC only; iSCSI multipath is +# controlled by Nova) (boolean value) #storwize_svc_multipath_enabled=false # Allows vdisk to multi host mapping (boolean value) @@ -1592,4 +1600,4 @@ #volume_dd_blocksize=1M -# Total option count: 337 +# Total option count: 342 diff --git a/run_tests.sh b/run_tests.sh index 80365d4fa..6e9e17d85 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -227,6 +227,7 @@ fi if [ $just_pep8 -eq 1 ]; then run_pep8 + bash ./tools/conf/check_uptodate.sh exit fi @@ -244,5 +245,6 @@ run_tests if [ -z "$testrargs" ]; then if [ $no_pep8 -eq 0 ]; then run_pep8 + bash ./tools/conf/check_uptodate.sh fi fi diff --git a/test-requirements.txt b/test-requirements.txt index 98a6a6757..6ebe350b2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -16,3 +16,4 @@ python-subunit testtools>=0.9.32 testrepository>=0.0.15 oslo.sphinx +python-novaclient>=2.12.0 diff --git a/tools/conf/check_uptodate.sh b/tools/conf/check_uptodate.sh new file mode 100755 index 000000000..df9bc74c5 --- /dev/null +++ b/tools/conf/check_uptodate.sh @@ -0,0 +1,11 @@ +#!/bin/sh +TEMPDIR=`mktemp -d` +CFGFILE=cinder.conf.sample +tools/conf/generate_sample.sh -o $TEMPDIR +if ! diff $TEMPDIR/$CFGFILE etc/cinder/$CFGFILE +then + echo "E: cinder.conf.sample is not up to date, please run tools/conf/generate_sample.sh" + rm -rf $TEMPDIR + exit 42 +fi +rm -rf $TEMPDIR diff --git a/tools/conf/generate_sample.sh b/tools/conf/generate_sample.sh index cdb86d256..0cbd777a7 100755 --- a/tools/conf/generate_sample.sh +++ b/tools/conf/generate_sample.sh @@ -1,24 +1,51 @@ #!/usr/bin/env bash -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 SINA Corporation -# All Rights Reserved. -# Author: Zhongyue Luo -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. + +print_hint() { + echo "Try \`${0##*/} --help' for more information." >&2 +} + +PARSED_OPTIONS=$(getopt -n "${0##*/}" -o ho: \ + --long help,output-dir: -- "$@") + +if [ $? != 0 ] ; then print_hint ; exit 1 ; fi + +eval set -- "$PARSED_OPTIONS" + +while true; do + case "$1" in + -h|--help) + echo "${0##*/} [options]" + echo "" + echo "options:" + echo "-h, --help show brief help" + echo "-o, --output-dir=DIR File output directory" + exit 0 + ;; + -o|--output-dir) + shift + OUTPUTDIR=`echo $1 | sed -e 's/\/*$//g'` + shift + ;; + --) + break + ;; + esac +done + +OUTPUTDIR=${OUTPUTDIR:-etc/cinder} +if ! [ -d $OUTPUTDIR ] +then + echo "${0##*/}: cannot access \`$OUTPUTDIR': No such file or directory" >&2 + exit 1 +fi + +OUTPUTFILE=$OUTPUTDIR/cinder.conf.sample FILES=$(find cinder -type f -name "*.py" ! -path "cinder/tests/*" -exec \ grep -l "Opt(" {} \; | sort -u) PYTHONPATH=./:${PYTHONPATH} \ python $(dirname "$0")/extract_opts.py ${FILES} > \ - etc/cinder/cinder.conf.sample + $OUTPUTFILE + +# When we use openstack.common.config.generate we won't need this any more +sed -i 's/^#connection=sqlite.*/#connection=sqlite:\/\/\/\/cinder\/openstack\/common\/db\/$sqlite_db/' $OUTPUTFILE diff --git a/tox.ini b/tox.ini index d2b6ef2ff..29cbcc513 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ deps = -r{toxinidir}/requirements.txt commands = python tools/patch_tox_venv.py python setup.py testr --slowest --testr-args='--concurrency 1 {posargs}' + {toxinidir}/tools/conf/check_uptodate.sh [tox:jenkins] sitepackages = True