Now the package can be installed alongside Nova.

Since this is apparently not getting into Nova it needs to be renamed
so the package name won't conflict.

Change-Id: Ib449e99c2a7756e46e4626a84ddb246265476bd3
This commit is contained in:
Tim Simpson 2013-09-18 09:10:44 -05:00 committed by Paul Marshall
parent c13cac5e31
commit fabe341771
37 changed files with 154 additions and 93 deletions

10
debian/rules vendored
View File

@ -15,11 +15,11 @@ clean:
binary-arch: binary-indep
binary-indep:
dh_installdirs /usr/lib/python$(PYVERS)/dist-packages/nova/virt /usr/lib/python$(PYVERS)/dist-packages/nova/tests /etc/nova/rootwrap.d
cp -R $(CURDIR)/nova/virt/openvz $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/nova/virt
cp -R $(CURDIR)/nova/tests/openvz $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/nova/tests
install -d -m 755 $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/nova/virt
binary-indep:
dh_installdirs /usr/lib/python$(PYVERS)/dist-packages/ovznovadriver /usr/lib/python$(PYVERS)/dist-packages/nova/tests /etc/nova/rootwrap.d
cp -R $(CURDIR)/ovznovadriver/openvz $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/ovznovadriver
cp -R $(CURDIR)/ovznovadriver/tests/openvz $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/nova/tests
install -d -m 755 $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/ovznovadriver
install -d -m 755 $(CURDIR)/debian/openvz-nova-driver/usr/lib/python$(PYVERS)/dist-packages/nova/tests
install -D -m 0400 $(CURDIR)/etc/nova/rootwrap.d/openvz.filters $(CURDIR)/debian/openvz-nova-driver/etc/nova/rootwrap.d/
dh_testdir

View File

@ -2,84 +2,84 @@
# This file should be owned by (and only-writeable by) the root user
[Filters]
# nova/virt/openvz/utils.py: 'mount', '-o', 'defaults' ...
# ovznovadriver/openvz/utils.py: 'mount', '-o', 'defaults' ...
mount: CommandFilter, /bin/mount, root
# nova/virt/openvz/utils.py: 'umount'
# ovznovadriver/openvz/utils.py: 'umount'
umount: CommandFilter, /bin/umount, root
# nova/virt/openvz/utils.py: 'mkdir', path
# ovznovadriver/openvz/utils.py: 'mkdir', path
mkdir: CommandFilter, /bin/mkdir, root
# nova/virt/openvz/utils.py: 'chown', owner_uid, path
# ovznovadriver/openvz/utils.py: 'chown', owner_uid, path
chown: CommandFilter, /bin/chown, root
# nova/virt/openvz/utils.py: 'chmod'
# ovznovadriver/openvz/utils.py: 'chmod'
chmod: CommandFilter, /bin/chmod, root
# nova/virt/openvz/volume_drivers/iscsi.py: 'iscsiadm', '-m', ...
# ovznovadriver/openvz/volume_drivers/iscsi.py: 'iscsiadm', '-m', ...
iscsiadm: CommandFilter, iscsiadm, root
# nova/virt/openvz/volume.py: fdisk %(dev_path)s
# ovznovadriver/openvz/volume.py: fdisk %(dev_path)s
fdisk: CommandFilter, /sbin/fdisk, root
# nova/virt/openvz/driver.py: 'arping', '-U', floating_ip, '-A', '-I', ...
# ovznovadriver/openvz/driver.py: 'arping', '-U', floating_ip, '-A', '-I', ...
arping: CommandFilter, arping, root
# nova/virt/openvz/file.py: 'touch', target
# ovznovadriver/openvz/file.py: 'touch', target
touch: CommandFilter, /usr/bin/touch, root
# Rackspace Openvz starts here
# nova/compute/manager.py: 'blockdev', '--getsize64', host_device
blockdev: CommandFilter, /sbin/blockdev, root
# nova/virt/openvz/driver.py: '/usr/sbin/vzlist'
# ovznovadriver/openvz/driver.py: '/usr/sbin/vzlist'
vzlist: CommandFilter, /usr/sbin/vzlist, root
# nova/virt/openvz/driver.py: '/usr/sbin/vzctl'
# ovznovadriver/openvz/driver.py: '/usr/sbin/vzctl'
vzctl: CommandFilter, /usr/sbin/vzctl, root
# nova/virt/openvz/driver.py: '/bin/rm'
# ovznovadriver/openvz/driver.py: '/bin/rm'
rm: CommandFilter, /bin/rm, root
# nova/virt/openvz/driver.py:
# ovznovadriver/openvz/driver.py:
cpuinfo: ReadFileFilter, /proc/cpuinfo
# nova/virt/openvz/driver.py:
# ovznovadriver/openvz/driver.py:
meminfo: ReadFileFilter, /proc/meminfo
# nova/virt/openvz/driver.py: '/usr/sbin/vzcpucheck'
# ovznovadriver/openvz/driver.py: '/usr/sbin/vzcpucheck'
vzcpucheck: CommandFilter, /usr/sbin/vzcpucheck, root
# nova/virt/openvz/driver.py: '/bin/rmdir'
# ovznovadriver/openvz/driver.py: '/bin/rmdir'
rmdir: CommandFilter, /bin/rmdir, root
# nova/virt/openvz/volume_drivers/iscsi.py: '/usr/bin/iscsiadm'
# ovznovadriver/openvz/volume_drivers/iscsi.py: '/usr/bin/iscsiadm'
iscsiadm_usrsbin: CommandFilter, /usr/bin/iscsiadm, root
# nova/virt/openvz/utils.py: '/sbin/blkid'
# ovznovadriver/openvz/utils.py: '/sbin/blkid'
blkid: CommandFilter, /sbin/blkid, root
# nova/virt/openvz/network_plugins/tc.py
# ovznovadriver/openvz/network_plugins/tc.py
tc: CommandFilter, /sbin/tc, root
# nova/virt/openvz/volume.py
# ovznovadriver/openvz/volume.py
ls: CommandFilter, /bin/ls, root
# nova/virt/openvz/volume.py
# ovznovadriver/openvz/volume.py
sfdisk: CommandFilter, /sbin/sfdisk, root
# nova/virt/openvz/volume.py
# ovznovadriver/openvz/volume.py
mknod: CommandFilter, /bin/mknod, root
# nova/virt/openvz/driver.py
# ovznovadriver/openvz/driver.py
vzmigrate: CommandFilter, /usr/sbin/vzmigrate, root
# nova/virt/openvz/migrate.py
# ovznovadriver/openvz/migrate.py
cp: CommandFilter, /bin/cp, root
# nova/virt/openvz/utils.py
# ovznovadriver/openvz/utils.py
tar: CommandFilter, /bin/tar, root
# nova/virt/openvz/migration_drivers/rsync.py
# ovznovadriver/openvz/migration_drivers/rsync.py
rsync: CommandFilter, /usr/bin/rsync, root

12
ovznovadriver/__init__.py Normal file
View File

@ -0,0 +1,12 @@
"""
OpenVZ Nova Driver
------------------
This is included in this oddly named directory instead of "nova/virt" since in
the later case it wouldn't be possible to have a setup.py and thus develop on
it at the same time without shadowing the real nova package.
If you don't like that, complain to the Nova core team so they accept this
driver into the actual Nova codebase, or go write a ton of code for libvirt.
"""

View File

@ -0,0 +1,3 @@
#TODO(tim.simpson): Figure out some way to link this to Nova's localization
# function.
_ = str

View File

@ -15,6 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.virt.openvz import driver
from ovznovadriver.openvz import driver
OpenVzDriver = driver.OpenVzDriver

View File

@ -32,15 +32,16 @@ from nova.openstack.common import log as logging
from nova.openstack.common import loopingcall
from nova.virt import driver
from nova.virt import images
from nova.virt.openvz import file as ovzfile
from nova.virt.openvz.file_ext import boot as ovzboot
from nova.virt.openvz.file_ext import ext_storage
from nova.virt.openvz.file_ext import shutdown as ovzshutdown
from nova.virt.openvz import migration as ovz_migration
from nova.virt.openvz import network as ovznetwork
from nova.virt.openvz.network_drivers import tc as ovztc
from nova.virt.openvz import utils as ovz_utils
from nova.virt.openvz.volume_drivers import iscsi as ovziscsi
from ovznovadriver.localization import _
from ovznovadriver.openvz import file as ovzfile
from ovznovadriver.openvz.file_ext import boot as ovzboot
from ovznovadriver.openvz.file_ext import ext_storage
from ovznovadriver.openvz.file_ext import shutdown as ovzshutdown
from ovznovadriver.openvz import migration as ovz_migration
from ovznovadriver.openvz import network as ovznetwork
from ovznovadriver.openvz.network_drivers import tc as ovztc
from ovznovadriver.openvz import utils as ovz_utils
from ovznovadriver.openvz.volume_drivers import iscsi as ovziscsi
import os
from oslo.config import cfg
import socket
@ -69,7 +70,7 @@ openvz_conn_opts = [
default='G',
help='Disk subscription increment'),
cfg.StrOpt('ovz_vif_driver',
default='nova.virt.openvz.network_drivers'
default='ovznovadriver.openvz.network_drivers'
'.network_bridge.OVZNetworkBridgeDriver',
help='The openvz VIF driver to configures the VIFs'),
cfg.StrOpt('ovz_mount_options',
@ -82,7 +83,7 @@ openvz_conn_opts = [
default='eth0',
help='Device to use as the root device for tc rules'),
cfg.StrOpt('ovz_tc_template_dir',
default='$pybasedir/nova/virt/openvz/network_drivers/templates',
default='$pybasedir/../openvz-nova-driver/ovznovadriver/openvz/network_drivers/templates',
help='Where the tc templates are located'),
cfg.StrOpt('ovz_tmp_dir',
default='/var/tmp',
@ -189,7 +190,7 @@ CONF = cfg.CONF
CONF.register_opts(openvz_conn_opts)
CONF.import_opt('host', 'nova.config')
LOG = logging.getLogger('nova.virt.openvz.driver')
LOG = logging.getLogger('ovznovadriver.openvz.driver')
class OpenVzDriver(driver.ComputeDriver):

View File

@ -21,14 +21,15 @@ is sketchy at best.
"""
from nova import exception
from ovznovadriver.localization import _
from nova.openstack.common import log as logging
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.file')
LOG = logging.getLogger('ovznovadriver.openvz.file')
class OVZFile(object):

View File

@ -21,12 +21,12 @@ using the host node's context so we are implementing one here
"""
from nova.openstack.common import log as logging
from nova.virt.openvz import file as ovzfile
from ovznovadriver.openvz import file as ovzfile
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.file_ext.boot')
LOG = logging.getLogger('ovznovadriver.openvz.file_ext.boot')
class OVZBootFile(ovzfile.OVZFile):

View File

@ -22,14 +22,15 @@ is sketchy at best.
import json
from nova.openstack.common import log as logging
from nova.virt.openvz import file as ovzfile
from ovznovadriver.localization import _
from ovznovadriver.openvz import file as ovzfile
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.file_ext.ext_storage')
LOG = logging.getLogger('ovznovadriver.openvz.file_ext.ext_storage')
class OVZExtStorage(object):

View File

@ -20,12 +20,13 @@ OpenVz doesn't have provision for a script to be run before a container
is stopped but with the host node's context so we are implementing one here.
"""
from nova.openstack.common import log as logging
from nova.virt.openvz import file as ovzfile
from ovznovadriver.localization import _
from ovznovadriver.openvz import file as ovzfile
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.file_ext.shutdown')
LOG = logging.getLogger('ovznovadriver.openvz.file_ext.shutdown')
class OVZShutdownFile(ovzfile.OVZFile):

View File

@ -19,7 +19,7 @@
A driver specific to OpenVz as the support for Ovz in libvirt
is sketchy at best.
"""
from nova.virt.openvz import file as ovzfile
from ovznovadriver.openvz import file as ovzfile
import os
from oslo.config import cfg

View File

@ -19,7 +19,7 @@
A driver specific to OpenVz as the support for Ovz in libvirt
is sketchy at best.
"""
from nova.virt.openvz import file as ovzfile
from ovznovadriver.openvz import file as ovzfile
import os
from oslo.config import cfg

View File

@ -21,12 +21,13 @@ is sketchy at best.
"""
from nova import exception
from nova.openstack.common import log as logging
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.localization import _
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.volume')
LOG = logging.getLogger('ovznovadriver.openvz.volume')
class OVZMigration(object):
@ -356,7 +357,7 @@ class OVZMigration(object):
def _setup_transport(self, src_path, dest_path, skip_list=None):
if CONF.ovz_migration_transport == 'rsync':
from nova.virt.openvz.migration_drivers import rsync
from ovznovadriver.openvz.migration_drivers import rsync
return rsync.OVZMigrationRsyncTransport(
src_path, dest_path, self.instance['id'],
self.destination_host, skip_list)

View File

@ -19,13 +19,14 @@
Driver for OVZ Migrations. Uses rsync as a backend.
"""
from nova.openstack.common import log as logging
from nova.virt.openvz.migration_drivers import transport
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.localization import _
from ovznovadriver.openvz.migration_drivers import transport
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.migration_drivers.rsync')
LOG = logging.getLogger('ovznovadriver.openvz.migration_drivers.rsync')
class OVZMigrationRsyncTransport(transport.OVZMigrationTransport):

View File

@ -20,11 +20,12 @@ Generic transport class for OVZ Migrations. Common methods will be placed
in this file for reuse.
"""
from nova.openstack.common import log as logging
from ovznovadriver.localization import _
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.migration_drivers.transport')
LOG = logging.getLogger('ovznovadriver.openvz.migration_drivers.transport')
class OVZMigrationTransport(object):

View File

@ -23,16 +23,17 @@ is sketchy at best.
from Cheetah import Template
from nova import exception
from nova.openstack.common import log as logging
from nova.virt.openvz import file as ovzfile
from nova.virt.openvz.file_ext import boot as ovzboot
from nova.virt.openvz.file_ext import shutdown as ovzshutdown
from nova.virt.openvz.network_drivers import tc as ovztc
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.localization import _
from ovznovadriver.openvz import file as ovzfile
from ovznovadriver.openvz.file_ext import boot as ovzboot
from ovznovadriver.openvz.file_ext import shutdown as ovzshutdown
from ovznovadriver.openvz.network_drivers import tc as ovztc
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.network')
LOG = logging.getLogger('ovznovadriver.openvz.network')
class OVZNetworkInterfaces(object):

View File

@ -21,9 +21,10 @@ is sketchy at best.
"""
from nova.network import linux_net
from ovznovadriver.localization import _
from nova.openstack.common import log as logging
LOG = logging.getLogger('nova.virt.openvz.network_drivers.network_bridge')
LOG = logging.getLogger('ovznovadriver.openvz.network_drivers.network_bridge')
class OVZNetworkBridgeDriver(object):

View File

@ -20,13 +20,14 @@ from nova import context
from nova import exception
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.localization import _
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
import random
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.network_drivers.tc')
LOG = logging.getLogger('ovznovadriver.openvz.network_drivers.tc')
global _ovz_tc_available_ids
global _ovz_tc_inflight_ids

View File

@ -26,6 +26,7 @@ from nova import context
from nova import exception
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from ovznovadriver.localization import _
from nova import utils
import os
from oslo.config import cfg
@ -35,7 +36,7 @@ import sys
import uuid
CONF = cfg.CONF
LOG = logging.getLogger('nova.virt.openvz.utils')
LOG = logging.getLogger('ovznovadriver.openvz.utils')
conductor = api.API()

View File

@ -24,8 +24,9 @@ import glob
from nova import exception
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.virt.openvz import file as ovzfile
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.localization import _
from ovznovadriver.openvz import file as ovzfile
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
import re
@ -38,7 +39,7 @@ CONF.register_opt(
help='Number of attempts before we determine that a device '
'has had time to settle and we are beyond a reasonable '
'wait time'))
LOG = logging.getLogger('nova.virt.openvz.volume')
LOG = logging.getLogger('ovznovadriver.openvz.volume')
class OVZVolume(object):

View File

@ -23,8 +23,9 @@ from nova import exception
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.virt.openvz import utils as ovz_utils
from nova.virt.openvz import volume as ovzvolume
from ovznovadriver.localization import _
from ovznovadriver.openvz import utils as ovz_utils
from ovznovadriver.openvz import volume as ovzvolume
from oslo.config import cfg
@ -34,7 +35,7 @@ CONF.register_opt(
default=1,
help='Number of attempts to make an iscsi connection'))
LOG = logging.getLogger('nova.virt.openvz.volume_drivers.iscsi')
LOG = logging.getLogger('ovznovadriver.openvz.volume_drivers.iscsi')
class OVZISCSIStorageDriver(ovzvolume.OVZVolume):

View File

@ -19,7 +19,7 @@ from Cheetah import Template
import json
from nova.compute import power_state
from nova import exception
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
import random

View File

@ -23,11 +23,11 @@ from nova.compute import power_state
from nova import exception
from nova.openstack.common import processutils
from nova import test
from nova.tests.openvz import fakes
from nova.virt.openvz import driver as openvz_conn
from nova.virt.openvz.file_ext import ext_storage
from nova.virt.openvz import migration
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.tests.openvz import fakes
from ovznovadriver.openvz import driver as openvz_conn
from ovznovadriver.openvz.file_ext import ext_storage
from ovznovadriver.openvz import migration
from ovznovadriver.openvz import utils as ovz_utils
import os
from oslo.config import cfg
@ -42,7 +42,7 @@ class OpenVzDriverTestCase(test.TestCase):
except AttributeError:
CONF.register_opt(
cfg.StrOpt('injected_network_template',
default='nova/virt/interfaces.template',
default='ovznovadriver/interfaces.template',
help='Stub for network template '
'for testing purposes'))
CONF.use_ipv6 = False

View File

@ -18,7 +18,7 @@
import json
from nova import test
from nova.tests.openvz import fakes
from nova.virt.openvz.file_ext import ext_storage
from ovznovadriver.openvz.file_ext import ext_storage
import os
from oslo.config import cfg

View File

@ -20,9 +20,9 @@ import mox
from nova import exception
from nova import test
from nova.tests.openvz import fakes
from nova.virt.openvz import driver as openvz_conn
from nova.virt.openvz import file as ovzfile
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.openvz import driver as openvz_conn
from ovznovadriver.openvz import file as ovzfile
from ovznovadriver.openvz import utils as ovz_utils
from oslo.config import cfg
CONF = cfg.CONF

View File

@ -19,9 +19,9 @@ import mox
from nova import exception
from nova import test
from nova.tests.openvz import fakes
from nova.virt.openvz import driver as openvz_conn
from nova.virt.openvz import network as openvz_net
from nova.virt.openvz.network_drivers import network_bridge
from ovznovadriver.openvz import driver as openvz_conn
from ovznovadriver.openvz import network as openvz_net
from ovznovadriver.openvz.network_drivers import network_bridge
from oslo.config import cfg
CONF = cfg.CONF
@ -36,7 +36,7 @@ class OpenVzNetworkTestCase(test.TestCase):
CONF.register_opt(
cfg.StrOpt(
'injected_network_template',
default='nova/virt/interfaces.template',
default='ovznovadriver/interfaces.template',
help='Stub for network template for testing purposes')
)
CONF.use_ipv6 = False

View File

@ -20,7 +20,7 @@ from nova import exception
from nova.openstack.common import processutils
from nova import test
from nova.tests.openvz import fakes
from nova.virt.openvz import utils as ovz_utils
from ovznovadriver.openvz import utils as ovz_utils
from oslo.config import cfg
import uuid

33
setup.py Normal file
View File

@ -0,0 +1,33 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 setuptools
setuptools.setup(
name='openvz-nova-driver',
version='0.1.0',
description='The OpenVZ Driver for Nova',
author='Rackspace',
packages=setuptools.find_packages(exclude=['debian', 'etc']),
include_package_data=True,
# i dont know where to put this package to make sure its built
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.6',
'Environment :: No Input/Output (Daemon)',
]
)