Fixes Nova compute driver import

A recent change in nova made it so only drivers from the
nova.virt namespace are imported.

Removes tools/tox_install.sh, it was only needed to
install nova, which was needed for unit tests.

Also, the nova.netconf options are not imported explicitly
anymore as those have been moved to nova.conf.

Change-Id: Idaae1a0a06aa0385b11176ea129a54c294f25fab
This commit is contained in:
Claudiu Belu 2016-04-28 22:41:54 +03:00 committed by Lucian Petrut
parent 62944096f5
commit 11a6ff0c56
12 changed files with 94 additions and 45 deletions

View File

@ -0,0 +1,15 @@
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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__('pkg_resources').declare_namespace(__name__)

View File

@ -50,7 +50,6 @@ hyper_host_opts = [
CONF = cfg.CONF
CONF.register_opts(hyper_host_opts, 'hyperv')
CONF.import_opt('my_ip', 'nova.netconf')
CONF.import_opt('enable_remotefx', 'hyperv.nova.vmops', 'hyperv')
LOG = logging.getLogger(__name__)

View File

@ -60,8 +60,6 @@ hyper_volumeops_opts = [
CONF = nova.conf.CONF
CONF.register_opts(hyper_volumeops_opts, 'hyperv')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('my_ip', 'nova.netconf')
class VolumeOps(object):

15
nova/__init__.py Normal file
View File

@ -0,0 +1,15 @@
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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__('pkg_resources').declare_namespace(__name__)

15
nova/virt/__init__.py Normal file
View File

@ -0,0 +1,15 @@
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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__('pkg_resources').declare_namespace(__name__)

View File

View File

@ -0,0 +1,22 @@
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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.
"""A Hyper-V Cluster Nova Compute driver."""
from hyperv.nova.cluster import driver
# NOTE: nova changed the way it imports drivers. All drivers must belong
# in the nova.virt namespace.
HyperVClusterDriver = driver.HyperVClusterDriver

View File

@ -0,0 +1,24 @@
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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.
"""
A Hyper-V Nova Compute driver.
"""
from hyperv.nova import driver
# NOTE: nova changed the way it imports drivers. All drivers must belong
# in the nova.virt namespace.
HyperVDriver = driver.HyperVDriver

View File

@ -25,6 +25,7 @@ keywords = openstack nova hyper-v compute
[files]
packages =
hyperv
nova.virt.compute_hyperv
[build_sphinx]
source-dir = doc/source

View File

@ -1,41 +0,0 @@
#!/bin/sh
# compute-hyperv repo depends on nova, which doesn't exist on pypi.
# This wrapper for tox's package installer will use the existing package
# if it exists, else use zuul-cloner if that program exists, else grab it
# from nova master via a hard-coded URL. That last case should only
# happen with devs running unit tests locally.
# From the tox.ini config page:
# install_command=ARGV
# default:
# pip install {opts} {packages}
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
nova_installed=$(echo "import nova" | python 2>/dev/null ; echo $?)
set -e
if [ $nova_installed -eq 0 ]; then
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
echo "Nova already installed; using existing package"
elif [ -x "$ZUUL_CLONER" ]; then
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
echo "ZUUL CLONER" > /tmp/tox_install.txt
cwd=$(/bin/pwd)
cd /tmp
$ZUUL_CLONER --cache-dir \
/opt/git \
git://git.openstack.org \
openstack/nova
cd openstack/nova
pip install -e .
cd "$cwd"
else
echo "PIP HARDCODE" > /tmp/tox_install.txt
pip install -U -egit+https://git.openstack.org/openstack/nova#egg=nova
fi
pip install -U $*
exit $?

View File

@ -8,7 +8,7 @@ usedevelop = True
# tox is silly... these need to be separated by a newline....
whitelist_externals = bash
find
install_command = {toxinidir}/tools/tox_install.sh {opts} {packages}
install_command = pip install -U {opts} {packages}
# Note the hash seed is set to 0 until hyperv can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir}
@ -17,6 +17,7 @@ setenv = VIRTUAL_ENV={envdir}
LANGUAGE=en_US
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-egit+https://github.com/openstack/nova#egg=nova
commands =
find . -type f -name "*.pyc" -delete
python setup.py testr --slowest --testr-args='{posargs}'