Get gantt to pass unit tests
Mostly a matter of having the appropriate modules imported from the gantt tree rather than the nova tree. Note that code can still import from the nova tree but this is only for non-scheduler related files. Ultimately we will remove all nova references from the gantt code but that is a future project. With these changes we can now have Jenkins gate on the unit tests. Change-Id: I3bcc9742cc9ab4188f67c2aa66ad97eca2bc08bb
This commit is contained in:
parent
e62cc17eb7
commit
989a2d04bb
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# TODO(mikal): move eventlet imports to nova.__init__ once we move to PBR
|
||||
# TODO(mikal): move eventlet imports to gantt.__init__ once we move to PBR
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -23,7 +23,7 @@ import sys
|
|||
# that the magic environment variable was set when the import happened.
|
||||
if ('eventlet' in sys.modules and
|
||||
os.environ.get('EVENTLET_NO_GREENDNS', '').lower() != 'yes'):
|
||||
raise ImportError('eventlet imported before nova/cmd/__init__ '
|
||||
raise ImportError('eventlet imported before gantt/cmd/__init__ '
|
||||
'(env var set to %s)'
|
||||
% os.environ.get('EVENTLET_NO_GREENDNS'))
|
||||
|
||||
|
|
|
@ -22,20 +22,21 @@ import sys
|
|||
|
||||
from oslo.config import cfg
|
||||
|
||||
from nova import config
|
||||
from nova.openstack.common import log as logging
|
||||
from nova import service
|
||||
from nova import utils
|
||||
|
||||
from gantt import config
|
||||
from gantt import service
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('scheduler_topic', 'nova.scheduler.rpcapi')
|
||||
CONF.import_opt('sched_topic', 'gantt.scheduler.rpcapi')
|
||||
|
||||
|
||||
def main():
|
||||
config.parse_args(sys.argv)
|
||||
logging.setup("nova")
|
||||
logging.setup("gantt")
|
||||
utils.monkey_patch()
|
||||
server = service.Service.create(binary='nova-scheduler',
|
||||
topic=CONF.scheduler_topic)
|
||||
server = service.Service.create(binary='gantt-sched',
|
||||
topic=CONF.sched_topic)
|
||||
service.serve(server)
|
||||
service.wait()
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
# under the License.
|
||||
|
||||
"""
|
||||
:mod:`nova.scheduler` -- Scheduler Nodes
|
||||
:mod:`gantt.scheduler` -- Scheduler Nodes
|
||||
=====================================================
|
||||
|
||||
.. automodule:: nova.scheduler
|
||||
.. automodule:: gantt.scheduler
|
||||
:platform: Unix
|
||||
:synopsis: Module that picks a compute node to run a VM instance.
|
||||
.. moduleauthor:: Sandy Walsh <sandy.walsh@rackspace.com>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
Manage hosts in the current zone.
|
||||
"""
|
||||
|
||||
from nova.scheduler import host_manager
|
||||
from gantt.scheduler import host_manager
|
||||
|
||||
|
||||
class BaremetalNodeState(host_manager.HostState):
|
||||
|
|
|
@ -28,7 +28,8 @@ from oslo.config import cfg
|
|||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova import exception
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.scheduler import driver
|
||||
|
||||
from gantt.scheduler import driver
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
|
||||
|
|
|
@ -36,13 +36,14 @@ from nova.openstack.common.gettextutils import _
|
|||
from nova.openstack.common import importutils
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import timeutils
|
||||
from nova import servicegroup
|
||||
|
||||
from gantt import servicegroup
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
scheduler_driver_opts = [
|
||||
cfg.StrOpt('scheduler_host_manager',
|
||||
default='nova.scheduler.host_manager.HostManager',
|
||||
default='gantt.scheduler.host_manager.HostManager',
|
||||
help='The scheduler host manager class to use'),
|
||||
cfg.IntOpt('scheduler_max_attempts',
|
||||
default=3,
|
||||
|
|
|
@ -29,9 +29,10 @@ from nova import notifier
|
|||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.pci import pci_request
|
||||
from nova.scheduler import driver
|
||||
from nova.scheduler import scheduler_options
|
||||
from nova.scheduler import utils as scheduler_utils
|
||||
|
||||
from gantt.scheduler import driver
|
||||
from gantt.scheduler import scheduler_options
|
||||
from gantt.scheduler import utils as scheduler_utils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
Scheduler host filters
|
||||
"""
|
||||
|
||||
from nova import filters
|
||||
from gantt import filters
|
||||
|
||||
|
||||
class BaseHostFilter(filters.BaseFilter):
|
||||
|
|
|
@ -21,7 +21,8 @@ import six
|
|||
from nova.compute import api as compute
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
from nova import db
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import extra_specs_ops
|
||||
|
||||
from gantt.scheduler import filters
|
||||
from gantt.scheduler.filters import extra_specs_ops
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
from nova import db
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
from nova.scheduler import filters
|
||||
from gantt.scheduler import filters
|
||||
|
||||
|
||||
class AllHostsFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
from oslo.config import cfg
|
||||
|
||||
from nova import db
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('default_availability_zone', 'nova.availability_zones')
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import extra_specs_ops
|
||||
|
||||
from gantt.scheduler import filters
|
||||
from gantt.scheduler.filters import extra_specs_ops
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -17,8 +17,9 @@ from oslo.config import cfg
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova import servicegroup
|
||||
|
||||
from gantt.scheduler import filters
|
||||
from gantt import servicegroup
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ from oslo.config import cfg
|
|||
from nova import db
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ from oslo.config import cfg
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ from distutils import versionpredicate
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova import utils
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ from oslo.config import cfg
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
from oslo.config import cfg
|
||||
|
||||
from nova.scheduler import filters
|
||||
from gantt.scheduler import filters
|
||||
|
||||
isolated_opts = [
|
||||
cfg.ListOpt('isolated_images',
|
||||
|
|
|
@ -18,7 +18,8 @@ import operator
|
|||
import six
|
||||
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
|
||||
class JsonFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -17,7 +17,8 @@ from oslo.config import cfg
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.scheduler import filters
|
||||
from gantt.scheduler import filters
|
||||
|
||||
|
||||
class PciPassthroughFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -19,7 +19,8 @@ from oslo.config import cfg
|
|||
from nova import db
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -56,7 +56,8 @@ from nova.openstack.common.gettextutils import _
|
|||
from nova.openstack.common import jsonutils
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
# under the License.
|
||||
|
||||
from nova import db
|
||||
from nova.scheduler import filters
|
||||
|
||||
from gantt.scheduler import filters
|
||||
|
||||
|
||||
class TypeAffinityFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -32,15 +32,16 @@ from nova.openstack.common import log as logging
|
|||
from nova.openstack.common import timeutils
|
||||
from nova.pci import pci_request
|
||||
from nova.pci import pci_stats
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler import weights
|
||||
|
||||
from gantt.scheduler import filters
|
||||
from gantt.scheduler import weights
|
||||
|
||||
host_manager_opts = [
|
||||
cfg.MultiStrOpt('scheduler_available_filters',
|
||||
default=['nova.scheduler.filters.all_filters'],
|
||||
default=['gantt.scheduler.filters.all_filters'],
|
||||
help='Filter classes available to the scheduler which may '
|
||||
'be specified more than once. An entry of '
|
||||
'"nova.scheduler.filters.standard_filters" '
|
||||
'"gantt.scheduler.filters.standard_filters" '
|
||||
'maps to all filters included with nova.'),
|
||||
cfg.ListOpt('scheduler_default_filters',
|
||||
default=[
|
||||
|
@ -54,7 +55,7 @@ host_manager_opts = [
|
|||
help='Which filter class names to use for filtering hosts '
|
||||
'when not specified in the request.'),
|
||||
cfg.ListOpt('scheduler_weight_classes',
|
||||
default=['nova.scheduler.weights.all_weighers'],
|
||||
default=['gantt.scheduler.weights.all_weighers'],
|
||||
help='Which weight class names to use for weighing hosts'),
|
||||
]
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ from nova.compute import vm_states
|
|||
from nova.conductor import api as conductor_api
|
||||
from nova.conductor.tasks import live_migrate
|
||||
from nova import exception
|
||||
from nova import manager
|
||||
from nova.objects import instance as instance_obj
|
||||
from nova.openstack.common import excutils
|
||||
from nova.openstack.common import importutils
|
||||
|
@ -39,13 +38,15 @@ from nova.openstack.common import log as logging
|
|||
from nova.openstack.common import periodic_task
|
||||
from nova.openstack.common.rpc import common as rpc_common
|
||||
from nova import quota
|
||||
from nova.scheduler import utils as scheduler_utils
|
||||
|
||||
from gantt import manager
|
||||
from gantt.scheduler import utils as scheduler_utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
scheduler_driver_opt = cfg.StrOpt('scheduler_driver',
|
||||
default='nova.scheduler.filter_scheduler.FilterScheduler',
|
||||
default='gantt.scheduler.filter_scheduler.FilterScheduler',
|
||||
help='Default driver to use for the scheduler')
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
# Copyright 2013, Red Hat, Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Client side of the scheduler manager RPC API.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo import messaging
|
||||
|
||||
from nova.objects import base as objects_base
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova import rpc
|
||||
|
||||
rpcapi_opts = [
|
||||
cfg.StrOpt('scheduler_topic',
|
||||
default='scheduler',
|
||||
help='The topic scheduler nodes listen on'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(rpcapi_opts)
|
||||
|
||||
rpcapi_cap_opt = cfg.StrOpt('scheduler',
|
||||
help='Set a version cap for messages sent to scheduler services')
|
||||
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
|
||||
|
||||
|
||||
class SchedulerAPI(object):
|
||||
'''Client side of the scheduler rpc API.
|
||||
|
||||
API version history:
|
||||
|
||||
1.0 - Initial version.
|
||||
1.1 - Changes to prep_resize():
|
||||
- remove instance_uuid, add instance
|
||||
- remove instance_type_id, add instance_type
|
||||
- remove topic, it was unused
|
||||
1.2 - Remove topic from run_instance, it was unused
|
||||
1.3 - Remove instance_id, add instance to live_migration
|
||||
1.4 - Remove update_db from prep_resize
|
||||
1.5 - Add reservations argument to prep_resize()
|
||||
1.6 - Remove reservations argument to run_instance()
|
||||
1.7 - Add create_volume() method, remove topic from live_migration()
|
||||
|
||||
2.0 - Remove 1.x backwards compat
|
||||
2.1 - Add image_id to create_volume()
|
||||
2.2 - Remove reservations argument to create_volume()
|
||||
2.3 - Remove create_volume()
|
||||
2.4 - Change update_service_capabilities()
|
||||
- accepts a list of capabilities
|
||||
2.5 - Add get_backdoor_port()
|
||||
2.6 - Add select_hosts()
|
||||
|
||||
... Grizzly supports message version 2.6. So, any changes to existing
|
||||
methods in 2.x after that point should be done such that they can
|
||||
handle the version_cap being set to 2.6.
|
||||
|
||||
2.7 - Add select_destinations()
|
||||
2.8 - Deprecate prep_resize() -- JUST KIDDING. It is still used
|
||||
by the compute manager for retries.
|
||||
2.9 - Added the legacy_bdm_in_spec parameter to run_instance()
|
||||
|
||||
... Havana supports message version 2.9. So, any changes to existing
|
||||
methods in 2.x after that point should be done such that they can
|
||||
handle the version_cap being set to 2.9.
|
||||
|
||||
... - Deprecated live_migration() call, moved to conductor
|
||||
... - Deprecated select_hosts()
|
||||
'''
|
||||
|
||||
VERSION_ALIASES = {
|
||||
'grizzly': '2.6',
|
||||
'havana': '2.9',
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
super(SchedulerAPI, self).__init__()
|
||||
target = messaging.Target(topic=CONF.scheduler_topic, version='2.0')
|
||||
version_cap = self.VERSION_ALIASES.get(CONF.upgrade_levels.scheduler,
|
||||
CONF.upgrade_levels.scheduler)
|
||||
serializer = objects_base.NovaObjectSerializer()
|
||||
self.client = rpc.get_client(target, version_cap=version_cap,
|
||||
serializer=serializer)
|
||||
|
||||
def select_destinations(self, ctxt, request_spec, filter_properties):
|
||||
cctxt = self.client.prepare(version='2.7')
|
||||
return cctxt.call(ctxt, 'select_destinations',
|
||||
request_spec=request_spec, filter_properties=filter_properties)
|
||||
|
||||
def run_instance(self, ctxt, request_spec, admin_password,
|
||||
injected_files, requested_networks, is_first_time,
|
||||
filter_properties, legacy_bdm_in_spec=True):
|
||||
version = '2.0'
|
||||
msg_kwargs = {'request_spec': request_spec,
|
||||
'admin_password': admin_password,
|
||||
'injected_files': injected_files,
|
||||
'requested_networks': requested_networks,
|
||||
'is_first_time': is_first_time,
|
||||
'filter_properties': filter_properties}
|
||||
if self.client.can_send_version('2.9'):
|
||||
version = '2.9'
|
||||
msg_kwargs['legacy_bdm_in_spec'] = legacy_bdm_in_spec
|
||||
cctxt = self.client.prepare(version=version)
|
||||
return cctxt.cast(ctxt, 'run_instance', **msg_kwargs)
|
||||
|
||||
def prep_resize(self, ctxt, instance, instance_type, image,
|
||||
request_spec, filter_properties, reservations):
|
||||
instance_p = jsonutils.to_primitive(instance)
|
||||
instance_type_p = jsonutils.to_primitive(instance_type)
|
||||
reservations_p = jsonutils.to_primitive(reservations)
|
||||
image_p = jsonutils.to_primitive(image)
|
||||
self.client.cast(ctxt, 'prep_resize',
|
||||
instance=instance_p, instance_type=instance_type_p,
|
||||
image=image_p, request_spec=request_spec,
|
||||
filter_properties=filter_properties,
|
||||
reservations=reservations_p)
|
|
@ -19,7 +19,7 @@ Scheduler host weights
|
|||
|
||||
from oslo.config import cfg
|
||||
|
||||
from nova import weights
|
||||
from gantt import weights
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ from oslo.config import cfg
|
|||
from nova import exception
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import weights
|
||||
|
||||
from gantt.scheduler import weights
|
||||
|
||||
metrics_weight_opts = [
|
||||
cfg.FloatOpt('weight_multiplier',
|
||||
|
|
|
@ -22,7 +22,7 @@ number and the weighing has the opposite effect of the default.
|
|||
|
||||
from oslo.config import cfg
|
||||
|
||||
from nova.scheduler import weights
|
||||
from gantt.scheduler import weights
|
||||
|
||||
ram_weight_opts = [
|
||||
cfg.FloatOpt('ram_weight_multiplier',
|
||||
|
|
|
@ -33,11 +33,12 @@ from nova.openstack.common import importutils
|
|||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import rpc
|
||||
from nova.openstack.common import service
|
||||
from nova import servicegroup
|
||||
from nova import utils
|
||||
from nova import version
|
||||
from nova import wsgi
|
||||
|
||||
from gantt import servicegroup
|
||||
from gantt import version
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
service_opts = [
|
||||
|
@ -97,8 +98,8 @@ service_opts = [
|
|||
cfg.StrOpt('network_manager',
|
||||
default='nova.network.manager.VlanManager',
|
||||
help='full class name for the Manager for network'),
|
||||
cfg.StrOpt('scheduler_manager',
|
||||
default='nova.scheduler.manager.SchedulerManager',
|
||||
cfg.StrOpt('sched_manager',
|
||||
default='gantt.scheduler.manager.SchedulerManager',
|
||||
help='full class name for the Manager for scheduler'),
|
||||
cfg.IntOpt('service_down_time',
|
||||
default=60,
|
||||
|
@ -225,7 +226,7 @@ class Service(service.Service):
|
|||
|
||||
:param host: defaults to CONF.host
|
||||
:param binary: defaults to basename of executable
|
||||
:param topic: defaults to bin_name - 'nova-' part
|
||||
:param topic: defaults to bin_name - 'gantt-' part
|
||||
:param manager: defaults to CONF.<topic>_manager
|
||||
:param report_interval: defaults to CONF.report_interval
|
||||
:param periodic_enable: defaults to CONF.periodic_enable
|
||||
|
@ -238,10 +239,10 @@ class Service(service.Service):
|
|||
if not binary:
|
||||
binary = os.path.basename(sys.argv[0])
|
||||
if not topic:
|
||||
topic = binary.rpartition('nova-')[2]
|
||||
topic = binary.rpartition('gantt-')[2]
|
||||
if not manager:
|
||||
manager_cls = ('%s_manager' %
|
||||
binary.rpartition('nova-')[2])
|
||||
binary.rpartition('gantt-')[2])
|
||||
manager = CONF.get(manager_cls, None)
|
||||
if report_interval is None:
|
||||
report_interval = CONF.report_interval
|
||||
|
|
|
@ -41,9 +41,9 @@ class API(object):
|
|||
|
||||
_driver = None
|
||||
_driver_name_class_mapping = {
|
||||
'db': 'nova.servicegroup.drivers.db.DbDriver',
|
||||
'zk': 'nova.servicegroup.drivers.zk.ZooKeeperDriver',
|
||||
'mc': 'nova.servicegroup.drivers.mc.MemcachedDriver'
|
||||
'db': 'gantt.servicegroup.drivers.db.DbDriver',
|
||||
'zk': 'gantt.servicegroup.drivers.zk.ZooKeeperDriver',
|
||||
'mc': 'gantt.servicegroup.drivers.mc.MemcachedDriver'
|
||||
}
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
|
|
@ -21,11 +21,12 @@ from nova import context
|
|||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.servicegroup import api
|
||||
|
||||
from gantt.servicegroup import api
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('service_down_time', 'nova.service')
|
||||
CONF.import_opt('service_down_time', 'gantt.service')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@ from nova.openstack.common.gettextutils import _
|
|||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import memorycache
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.servicegroup import api
|
||||
|
||||
from gantt.servicegroup import api
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('service_down_time', 'nova.service')
|
||||
CONF.import_opt('service_down_time', 'gantt.service')
|
||||
CONF.import_opt('memcached_servers', 'nova.openstack.common.memorycache')
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ from nova.openstack.common.gettextutils import _
|
|||
from nova.openstack.common import importutils
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import loopingcall
|
||||
from nova.servicegroup import api
|
||||
|
||||
from gantt.servicegroup import api
|
||||
|
||||
evzookeeper = importutils.try_import('evzookeeper')
|
||||
membership = importutils.try_import('evzookeeper.membership')
|
||||
|
|
|
@ -49,8 +49,9 @@ from nova.openstack.common import log as logging
|
|||
from nova.openstack.common import timeutils
|
||||
from nova import paths
|
||||
from nova import service
|
||||
from nova.tests import conf_fixture
|
||||
from nova.tests import policy_fixture
|
||||
|
||||
from gantt.tests import conf_fixture
|
||||
from gantt.tests import policy_fixture
|
||||
|
||||
|
||||
test_opts = [
|
||||
|
|
|
@ -23,12 +23,13 @@ from nova import config
|
|||
from nova import ipv6
|
||||
from nova.openstack.common.fixture import config as config_fixture
|
||||
from nova import paths
|
||||
from nova.tests import utils
|
||||
|
||||
from gantt.tests import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('use_ipv6', 'nova.netconf')
|
||||
CONF.import_opt('host', 'nova.netconf')
|
||||
CONF.import_opt('scheduler_driver', 'nova.scheduler.manager')
|
||||
CONF.import_opt('scheduler_driver', 'gantt.scheduler.manager')
|
||||
CONF.import_opt('fake_network', 'nova.network.manager')
|
||||
CONF.import_opt('network_size', 'nova.network.manager')
|
||||
CONF.import_opt('num_networks', 'nova.network.manager')
|
||||
|
@ -50,9 +51,9 @@ class ConfFixture(config_fixture.Config):
|
|||
self.conf.set_default('fake_network', True)
|
||||
self.conf.set_default('flat_network_bridge', 'br100')
|
||||
self.conf.set_default('floating_ip_dns_manager',
|
||||
'nova.tests.utils.dns_manager')
|
||||
'gantt.tests.utils.dns_manager')
|
||||
self.conf.set_default('instance_dns_manager',
|
||||
'nova.tests.utils.dns_manager')
|
||||
'gantt.tests.utils.dns_manager')
|
||||
self.conf.set_default('network_size', 8)
|
||||
self.conf.set_default('num_networks', 2)
|
||||
self.conf.set_default('rpc_backend',
|
||||
|
|
|
@ -19,7 +19,8 @@ from oslo.config import cfg
|
|||
|
||||
from nova.openstack.common import policy as common_policy
|
||||
import nova.policy
|
||||
from nova.tests import fake_policy
|
||||
|
||||
from gantt.tests import fake_policy
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -21,8 +21,9 @@ import mox
|
|||
from nova.compute import vm_states
|
||||
from nova import db
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.scheduler import filter_scheduler
|
||||
from nova.scheduler import host_manager
|
||||
|
||||
from gantt.scheduler import filter_scheduler
|
||||
from gantt.scheduler import host_manager
|
||||
|
||||
|
||||
COMPUTE_NODES = [
|
||||
|
|
|
@ -29,9 +29,10 @@ from nova.conductor import api as conductor_api
|
|||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova.scheduler import chance
|
||||
from nova.scheduler import driver
|
||||
from nova.tests.scheduler import test_scheduler
|
||||
|
||||
from gantt.scheduler import chance
|
||||
from gantt.scheduler import driver
|
||||
from gantt.tests.scheduler import test_scheduler
|
||||
|
||||
|
||||
class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
|
|
@ -26,13 +26,14 @@ from nova import context
|
|||
from nova import db
|
||||
from nova import exception
|
||||
from nova.pci import pci_request
|
||||
from nova.scheduler import driver
|
||||
from nova.scheduler import filter_scheduler
|
||||
from nova.scheduler import host_manager
|
||||
from nova.scheduler import utils as scheduler_utils
|
||||
from nova.scheduler import weights
|
||||
from nova.tests.scheduler import fakes
|
||||
from nova.tests.scheduler import test_scheduler
|
||||
|
||||
from gantt.scheduler import driver
|
||||
from gantt.scheduler import filter_scheduler
|
||||
from gantt.scheduler import host_manager
|
||||
from gantt.scheduler import utils as scheduler_utils
|
||||
from gantt.scheduler import weights
|
||||
from gantt.tests.scheduler import fakes
|
||||
from gantt.tests.scheduler import test_scheduler
|
||||
|
||||
|
||||
def fake_get_filtered_hosts(hosts, filter_properties, index):
|
||||
|
|
|
@ -18,9 +18,10 @@ Tests For Scheduler Host Filters.
|
|||
import inspect
|
||||
import sys
|
||||
|
||||
from nova import filters
|
||||
from nova import loadables
|
||||
from nova import test
|
||||
|
||||
from gantt import filters
|
||||
from gantt import test
|
||||
|
||||
|
||||
class Filter1(filters.BaseFilter):
|
||||
|
|
|
@ -25,14 +25,15 @@ from nova import db
|
|||
from nova.openstack.common import jsonutils
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.pci import pci_stats
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import extra_specs_ops
|
||||
from nova.scheduler.filters import trusted_filter
|
||||
from nova import servicegroup
|
||||
from nova import test
|
||||
from nova.tests.scheduler import fakes
|
||||
from nova import utils
|
||||
|
||||
from gantt.scheduler import filters
|
||||
from gantt.scheduler.filters import extra_specs_ops
|
||||
from gantt.scheduler.filters import trusted_filter
|
||||
from gantt import servicegroup
|
||||
from gantt import test
|
||||
from gantt.tests.scheduler import fakes
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('my_ip', 'nova.netconf')
|
||||
|
||||
|
@ -256,7 +257,7 @@ class HostFiltersTestCase(test.NoDBTestCase):
|
|||
['>=', '$free_disk_mb', 200 * 1024]])
|
||||
filter_handler = filters.HostFilterHandler()
|
||||
classes = filter_handler.get_matching_classes(
|
||||
['nova.scheduler.filters.all_filters'])
|
||||
['gantt.scheduler.filters.all_filters'])
|
||||
self.class_map = {}
|
||||
for cls in classes:
|
||||
self.class_map[cls.__name__] = cls
|
||||
|
|
|
@ -21,13 +21,14 @@ from nova import db
|
|||
from nova import exception
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler import host_manager
|
||||
from nova import test
|
||||
from nova.tests import matchers
|
||||
from nova.tests.scheduler import fakes
|
||||
from nova import utils
|
||||
|
||||
from gantt.scheduler import filters
|
||||
from gantt.scheduler import host_manager
|
||||
from gantt import test
|
||||
from gantt.tests import matchers
|
||||
from gantt.tests.scheduler import fakes
|
||||
|
||||
|
||||
class FakeFilterClass1(filters.BaseHostFilter):
|
||||
def host_passes(self, host_state, filter_properties):
|
||||
|
|
|
@ -35,17 +35,18 @@ from nova.image import glance
|
|||
from nova import notifier as notify
|
||||
from nova.objects import instance as instance_obj
|
||||
from nova.openstack.common.rpc import common as rpc_common
|
||||
from nova.scheduler import driver
|
||||
from nova.scheduler import manager
|
||||
from nova import servicegroup
|
||||
from nova import test
|
||||
from nova.tests import fake_instance
|
||||
from nova.tests import fake_instance_actions
|
||||
from nova.tests.image import fake as fake_image
|
||||
from nova.tests import matchers
|
||||
from nova.tests.scheduler import fakes
|
||||
from nova import utils
|
||||
|
||||
from gantt.scheduler import driver
|
||||
from gantt.scheduler import manager
|
||||
from gantt import servicegroup
|
||||
from gantt import test
|
||||
from gantt.tests import fake_instance
|
||||
from gantt.tests import fake_instance_actions
|
||||
from gantt.tests.image import fake as fake_image
|
||||
from gantt.tests import matchers
|
||||
from gantt.tests.scheduler import fakes
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
|
@ -54,7 +55,7 @@ class SchedulerManagerTestCase(test.NoDBTestCase):
|
|||
|
||||
manager_cls = manager.SchedulerManager
|
||||
driver_cls = driver.Scheduler
|
||||
driver_cls_name = 'nova.scheduler.driver.Scheduler'
|
||||
driver_cls_name = 'gantt.scheduler.driver.Scheduler'
|
||||
|
||||
def setUp(self):
|
||||
super(SchedulerManagerTestCase, self).setUp()
|
||||
|
|
|
@ -20,8 +20,9 @@ import datetime
|
|||
import StringIO
|
||||
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.scheduler import scheduler_options
|
||||
from nova import test
|
||||
|
||||
from gantt.scheduler import scheduler_options
|
||||
from gantt import test
|
||||
|
||||
|
||||
class FakeSchedulerOptions(scheduler_options.SchedulerOptions):
|
||||
|
|
|
@ -24,8 +24,9 @@ from nova.conductor import api as conductor_api
|
|||
from nova import db
|
||||
from nova import notifications
|
||||
from nova import notifier as notify
|
||||
from nova.scheduler import utils as scheduler_utils
|
||||
from nova import test
|
||||
|
||||
from gantt.scheduler import utils as scheduler_utils
|
||||
from gantt import test
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@ Tests For Scheduler weights.
|
|||
from nova import context
|
||||
from nova import exception
|
||||
from nova.openstack.common.fixture import mockpatch
|
||||
from nova.scheduler import weights
|
||||
from nova import test
|
||||
from nova.tests import matchers
|
||||
from nova.tests.scheduler import fakes
|
||||
|
||||
from gantt.scheduler import weights
|
||||
from gantt import test
|
||||
from gantt.tests import matchers
|
||||
from gantt.tests.scheduler import fakes
|
||||
|
||||
|
||||
class TestWeighedHost(test.NoDBTestCase):
|
||||
|
@ -50,7 +51,7 @@ class RamWeigherTestCase(test.NoDBTestCase):
|
|||
self.host_manager = fakes.FakeHostManager()
|
||||
self.weight_handler = weights.HostWeightHandler()
|
||||
self.weight_classes = self.weight_handler.get_matching_classes(
|
||||
['nova.scheduler.weights.ram.RAMWeigher'])
|
||||
['gantt.scheduler.weights.ram.RAMWeigher'])
|
||||
|
||||
def _get_weighed_host(self, hosts, weight_properties=None):
|
||||
if weight_properties is None:
|
||||
|
@ -113,7 +114,7 @@ class MetricsWeigherTestCase(test.NoDBTestCase):
|
|||
self.host_manager = fakes.FakeHostManager()
|
||||
self.weight_handler = weights.HostWeightHandler()
|
||||
self.weight_classes = self.weight_handler.get_matching_classes(
|
||||
['nova.scheduler.weights.metrics.MetricsWeigher'])
|
||||
['gantt.scheduler.weights.metrics.MetricsWeigher'])
|
||||
|
||||
def _get_weighed_host(self, hosts, setting, weight_properties=None):
|
||||
if not weight_properties:
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
|
||||
import pbr.version
|
||||
|
||||
NOVA_VENDOR = "OpenStack Foundation"
|
||||
NOVA_PRODUCT = "OpenStack Nova"
|
||||
NOVA_PACKAGE = None # OS distro package version suffix
|
||||
from nova.openstack.common.gettextutils import _
|
||||
|
||||
GANTT_VENDOR = "OpenStack Foundation"
|
||||
GANTT_PRODUCT = "OpenStack Gantt"
|
||||
GANTT_PACKAGE = None # OS distro package version suffix
|
||||
|
||||
loaded = False
|
||||
version_info = pbr.version.VersionInfo('nova')
|
||||
version_info = pbr.version.VersionInfo('gantt')
|
||||
version_string = version_info.version_string
|
||||
|
||||
|
||||
|
@ -35,7 +37,7 @@ def _load_config():
|
|||
|
||||
from nova.openstack.common import log as logging
|
||||
|
||||
global loaded, NOVA_VENDOR, NOVA_PRODUCT, NOVA_PACKAGE
|
||||
global loaded, GANTT_VENDOR, GANTT_PRODUCT, GANTT_PACKAGE
|
||||
if loaded:
|
||||
return
|
||||
|
||||
|
@ -49,39 +51,39 @@ def _load_config():
|
|||
cfg = ConfigParser.RawConfigParser()
|
||||
cfg.read(cfgfile)
|
||||
|
||||
NOVA_VENDOR = cfg.get("Nova", "vendor")
|
||||
if cfg.has_option("Nova", "vendor"):
|
||||
NOVA_VENDOR = cfg.get("Nova", "vendor")
|
||||
GANTT_VENDOR = cfg.get("Gantt", "vendor")
|
||||
if cfg.has_option("Gantt", "vendor"):
|
||||
GANTT_VENDOR = cfg.get("Gantt", "vendor")
|
||||
|
||||
NOVA_PRODUCT = cfg.get("Nova", "product")
|
||||
if cfg.has_option("Nova", "product"):
|
||||
NOVA_PRODUCT = cfg.get("Nova", "product")
|
||||
GANTT_PRODUCT = cfg.get("Gantt", "product")
|
||||
if cfg.has_option("Gantt", "product"):
|
||||
GANTT_PRODUCT = cfg.get("Gantt", "product")
|
||||
|
||||
NOVA_PACKAGE = cfg.get("Nova", "package")
|
||||
if cfg.has_option("Nova", "package"):
|
||||
NOVA_PACKAGE = cfg.get("Nova", "package")
|
||||
GANTT_PACKAGE = cfg.get("Gantt", "package")
|
||||
if cfg.has_option("Gantt", "package"):
|
||||
GANTT_PACKAGE = cfg.get("Gantt", "package")
|
||||
except Exception as ex:
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG.error(("Failed to load %(cfgfile)s: %(ex)s"),
|
||||
LOG.error(_("Failed to load %(cfgfile)s: %(ex)s"),
|
||||
{'cfgfile': cfgfile, 'ex': ex})
|
||||
|
||||
|
||||
def vendor_string():
|
||||
_load_config()
|
||||
|
||||
return NOVA_VENDOR
|
||||
return GANTT_VENDOR
|
||||
|
||||
|
||||
def product_string():
|
||||
_load_config()
|
||||
|
||||
return NOVA_PRODUCT
|
||||
return GANTT_PRODUCT
|
||||
|
||||
|
||||
def package_string():
|
||||
_load_config()
|
||||
|
||||
return NOVA_PACKAGE
|
||||
return GANTT_PACKAGE
|
||||
|
||||
|
||||
def version_string_with_package():
|
||||
|
|
|
@ -13,3 +13,5 @@ sphinx>=1.1.2,<1.2
|
|||
oslo.sphinx
|
||||
testrepository>=0.0.17
|
||||
testtools>=0.9.32
|
||||
|
||||
http://tarballs.openstack.org/nova/nova-2014.1.b2.tar.gz#egg=nova
|
||||
|
|
|
@ -36,7 +36,7 @@ ignore_messages = ["An attribute affected in gantt.tests"]
|
|||
# Note(maoy): we ignore all errors in openstack.common because it should be
|
||||
# checked elsewhere. We also ignore gantt.tests for now due to high false
|
||||
# positive rate.
|
||||
ignore_modules = ["gantt/openstack/common/", "gantt/tests/"]
|
||||
ignore_modules = ["gantt/tests/"]
|
||||
|
||||
KNOWN_PYLINT_EXCEPTIONS_FILE = "tools/pylint_exceptions"
|
||||
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -48,7 +48,7 @@ commands = {posargs}
|
|||
# H102 Apache 2.0 license header not found
|
||||
|
||||
# E125 is deliberately excluded. See https://github.com/jcrocholl/pep8/issues/126
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E711,E712,H102,H302,H404,F403,F811,F841,H803
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E711,E712,H102,H404,F403,F811,F841,H302,H803
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||
|
||||
[hacking]
|
||||
|
|
Loading…
Reference in New Issue