Align project with default openstack project structure

This commit is contained in:
Igor Malinovskiy 2015-06-03 16:18:32 +03:00
parent e47c9839d8
commit 50336185d9
19 changed files with 375 additions and 78 deletions

35
.gitignore vendored
View File

@ -1,4 +1,33 @@
/*.d
*.qcow2
debug.sh
*.py[co]
*.egg
*.egg-info
dist
build
eggs
parts
var
sdist
develop-eggs
.installed.cfg
pip-log.txt
.coverage
.tox
*.mo
.mr.developer.cfg
.DS_Store
Thumbs.db
.venv
.idea
out
target
*.iml
*.ipr
*.iws
*.db
.coverage
ChangeLog
AUTHORS
*.qcow2
diskimage-create.*
debug.sh
/*.d

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/manila-image-elements.git

11
CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,11 @@
If you would like to contribute to the development of OpenStack, you must follow the steps in this page:
http://docs.openstack.org/infra/manual/developers.html
If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Pull requests submitted through GitHub will be ignored.
Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/manila-image

4
HACKING.rst Normal file
View File

@ -0,0 +1,4 @@
Manila Style Commandments
===============================================
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/

6
MANIFEST.in Normal file
View File

@ -0,0 +1,6 @@
include AUTHORS
include ChangeLog
exclude .gitignore
exclude .gitreview
global-exclude *.pyc

View File

@ -1 +0,0 @@
# manila-service-image

20
README.rst Normal file
View File

@ -0,0 +1,20 @@
Manila image elements project
==============================
This repo is a place for Manila-related for diskimage-builder elements.
* Free software: Apache license
* Source: http://git.openstack.org/cgit/manila-image-elements
* Bugs: http://bugs.launchpad.net/manila-image
Build instructions
------------------
Script for creating Ubuntu based image with our elements and default parameters. You should only need to run this command:
.. sourcecode:: bash
tox -e venv -- manila-image-create
Note: More information about script `diskimage-create <https://github.com/openstack/sahara-image-elements/blob/master/diskimage-create/README.rst>`_

88
bin/manila-image-create Normal file
View File

@ -0,0 +1,88 @@
#!/bin/bash
set -eu
set -o pipefail
SCRIPT_HOME=$(dirname $(readlink -f $0))
if [ -d $SCRIPT_HOME/../share/manila-elements ]; then
_PREFIX=$SCRIPT_HOME/../share/manila-elements
elif [ -d $SCRIPT_HOME/../../../elements ]; then
_PREFIX=$SCRIPT_HOME/../../..
else
_PREFIX=$SCRIPT_HOME/..
fi
export ELEMENTS_PATH=$_PREFIX/elements
# Collect configuration
# --------------------
# Development options:
USE_OFFLINE_MODE=${USE_OFFLINE_MODE:-"yes"}
ENABLE_DEBUG_MODE=${ENABLE_DEBUG_MODE:-"no"}
DISABLE_IMG_COMPRESSION=${DISABLE_IMG_COMPRESSION:-"no"}
# Manila user settings
MANILA_USER=${MANILA_USER:-"manila"}
MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"}
MANILA_USER_AUTHORIZED_KEYS="None"
# Manila image settings
MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-core"}
MANILA_IMG_OS_VER=${MANILA_IMG_OS_VER:-"trusty"}
MANILA_IMG_NAME=${MANILA_IMG_NAME:-"ubuntu-manila-service-image.qcow2"}
# Manila features
MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"}
MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"}
# Verify configuration
# --------------------
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces cleanup-kernel-initrd"
OPTIONAL_ELEMENTS=
OPTIONAL_DIB_ARGS=
if [ "$MANILA_ENABLE_CIFS_SUPPORT" != "yes" && "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
echo "You should enable NFS or CIFS support for manila image."
fi
if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs"
fi
if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-cifs"
fi
if [ "$USE_OFFLINE_MODE" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -offline"
fi
if [ "$ENABLE_DEBUG_MODE" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -x"
MANILA_USER_AUTHORIZED_KEYS=${MANILA_USER_AUTHORIZED_KEYS:-"$HOME/.ssh/id_rsa.pub"}
fi
if [ "$DISABLE_IMG_COMPRESSION" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -u"
fi
if [ "$MANILA_IMG_OS" = "manila-ubuntu-core" && "$MANILA_IMG_OS_VER" != "trusty" ]; then
echo "manila-ubuntu-core doesn't support '$MANILA_IMG_OS_VER' release."
echo "Change MANILA_IMG_OS to 'ubuntu' if you need another release."
fi
# Export diskimage-builder settings
# ---------------------------------
export DIB_DEFAULT_INSTALLTYPE=package
export DIB_RELEASE=$MANILA_IMG_OS_VER
# User settings
export DIB_MANILA_USER_USERNAME=$MANILA_USER
export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD
export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
# Build image
# -----------
disk-image-create -a $MANILA_IMG_ARCH $OPTIONAL_DIB_ARGS -o $MANILA_IMG_NAME\
$OPTIONAL_ELEMENTS $REQUIRED_ELEMENTS

View File

@ -1,74 +0,0 @@
# Defaults:
# Development options:
USE_OFFLINE_MODE=${USE_OFFLINE_MODE:-"yes"}
ENABLE_DEBUG_MODE=${ENABLE_DEBUG_MODE:-"no"}
DISABLE_IMG_COMPRESSION=${DISABLE_IMG_COMPRESSION:-"no"}
# Manila user settings
MANILA_USER=${MANILA_USER:-"manila"}
MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"}
MANILA_USER_AUTHORIZED_KEYS="None"
# Manila image settings
MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-core"}
MANILA_IMG_OS_VER=${MANILA_IMG_OS_VER:-"trusty"}
MANILA_IMG_NAME=${MANILA_IMG_NAME:-"ubuntu-manila-service-image.qcow2"}
# Manila features
MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"}
MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"}
# Verify configuration
# --------------------
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces cleanup-kernel-initrd"
OPTIONAL_ELEMENTS=
OPTIONAL_DIB_ARGS=
if [ "$MANILA_ENABLE_CIFS_SUPPORT" != "yes" && "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
echo "You should enable NFS or CIFS support for manila image."
fi
if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs"
fi
if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-cifs"
fi
if [ "$USE_OFFLINE_MODE" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -offline"
fi
if [ "$ENABLE_DEBUG_MODE" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -x"
MANILA_USER_AUTHORIZED_KEYS=${MANILA_USER_AUTHORIZED_KEYS:-"$HOME/.ssh/id_rsa.pub"}
fi
if [ "$DISABLE_IMG_COMPRESSION" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -u"
fi
if [ "$MANILA_IMG_OS" = "manila-ubuntu-core" && "$MANILA_IMG_OS_VER" != "trusty" ]; then
echo "manila-ubuntu-core doesn't support '$MANILA_IMG_OS_VER' release."
echo "Change MANILA_IMG_OS to 'ubuntu' if you need another release."
fi
# Export diskimage-builder settings
# ---------------------------------
export ELEMENTS_PATH=`pwd`/elements
export DIB_DEFAULT_INSTALLTYPE=package
export DIB_RELEASE=$MANILA_IMG_OS_VER
# User settings
export DIB_MANILA_USER_USERNAME=$MANILA_USER
export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD
export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
# Build image
# -----------
disk-image-create -a $MANILA_IMG_ARCH $OPTIONAL_DIB_ARGS -o $MANILA_IMG_NAME\
$OPTIONAL_ELEMENTS $REQUIRED_ELEMENTS

75
doc/source/conf.py Normal file
View File

@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
# 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.
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
'oslosphinx'
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'manila-image-elements'
copyright = u'2013, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
# html_theme = '_theme'
# html_static_path = ['static']
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}

View File

@ -0,0 +1,4 @@
============
Contributing
============
.. include:: ../../CONTRIBUTING.rst

23
doc/source/index.rst Normal file
View File

@ -0,0 +1,23 @@
.. manila-image-elements documentation master file, created by
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to manila-image-elements documentation!
========================================================
Contents:
.. toctree::
:maxdepth: 2
readme
contributing
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

1
doc/source/readme.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../../README.rst

View File

@ -1 +1,7 @@
diskimage-builder
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=0.11,<2.0
diskimage-builder>=0.1.45

23
setup.cfg Normal file
View File

@ -0,0 +1,23 @@
[metadata]
name = manila-image-elements
summary = Image elements for Manila
description-file = README.rst
license = Apache Software License
classifiers =
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = https://docs.openstack.org/developer/manila
[files]
scripts =
bin/manila-image-create
data_files =
share/manila-elements/elements = elements/*
[wheel]
universal = 1

30
setup.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr'],
pbr=True)

9
test-requirements.txt Normal file
View File

@ -0,0 +1,9 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
bashate>=0.2 # Apache-2.0
hacking>=0.10.0,<0.11
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
oslosphinx>=2.2.0 # Apache-2.0

3
tools/run_bashate.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -xe
find ./ -not -wholename \*.tox/\* -and \( -name \*.sh -or -wholename \*.d/\* -and -not -name \*.md -and -not -name \*.rst -and -not -name \*.py \) -print0 | xargs -0 bashate -v

36
tox.ini Normal file
View File

@ -0,0 +1,36 @@
[tox]
envlist = pep8
minversion = 1.6
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv:bashate]
whitelist_externals = bash
commands = {toxinidir}/tools/run_bashate.sh
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:pep8]
commands =
flake8 {posargs}
{toxinidir}/tools/run_bashate.sh
[testenv:venv]
commands = {posargs}
[flake8]
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools