Clean imports in code
This patch set modifies lines which are importing objects instead of modules in designate/scheduler/*. As per open-stack import guide lines, user should import modules in a file not objects. http://docs.openstack.org/developer/hacking/#imports Change-Id: Ie843800c18e8d236b0cff4192504592b060c1ee3
This commit is contained in:
parent
c8fa7ef289
commit
06c4bc0ff2
|
@ -15,7 +15,7 @@
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from designate.scheduler.base import Scheduler
|
from designate.scheduler import base
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -29,4 +29,4 @@ cfg.CONF.register_opts([
|
||||||
|
|
||||||
def get_scheduler(storage):
|
def get_scheduler(storage):
|
||||||
|
|
||||||
return Scheduler(storage=storage)
|
return base.Scheduler(storage=storage)
|
||||||
|
|
|
@ -16,12 +16,12 @@ from oslo_log import log as logging
|
||||||
from oslo_utils.strutils import bool_from_string
|
from oslo_utils.strutils import bool_from_string
|
||||||
|
|
||||||
from designate.objects import PoolAttributeList
|
from designate.objects import PoolAttributeList
|
||||||
from designate.scheduler.filters.base import Filter
|
from designate.scheduler.filters import base
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AttributeFilter(Filter):
|
class AttributeFilter(base.Filter):
|
||||||
"""This allows users to choose the pool by supplying hints to this filter.
|
"""This allows users to choose the pool by supplying hints to this filter.
|
||||||
These are provided as attributes as part of the zone object provided at
|
These are provided as attributes as part of the zone object provided at
|
||||||
zone create time.
|
zone create time.
|
||||||
|
|
|
@ -13,12 +13,11 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from designate.scheduler.filters.base import Filter
|
from designate.scheduler.filters import base
|
||||||
from designate.objects import Pool
|
from designate import objects
|
||||||
from designate.objects import PoolList
|
|
||||||
|
|
||||||
|
|
||||||
class DefaultPoolFilter(Filter):
|
class DefaultPoolFilter(base.Filter):
|
||||||
"""This filter will always return the default pool specified in the
|
"""This filter will always return the default pool specified in the
|
||||||
designate config file
|
designate config file
|
||||||
|
|
||||||
|
@ -35,6 +34,7 @@ class DefaultPoolFilter(Filter):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def filter(self, context, pools, zone):
|
def filter(self, context, pools, zone):
|
||||||
pools = PoolList()
|
pools = objects.PoolList()
|
||||||
pools.append(Pool(id=cfg.CONF['service:central'].default_pool_id))
|
pools.append(
|
||||||
|
objects.Pool(id=cfg.CONF['service:central'].default_pool_id))
|
||||||
return pools
|
return pools
|
||||||
|
|
|
@ -14,9 +14,8 @@
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from designate.scheduler.filters.base import Filter
|
from designate.scheduler.filters import base
|
||||||
from designate.objects import Pool
|
from designate import objects
|
||||||
from designate.objects import PoolList
|
|
||||||
|
|
||||||
cfg.CONF.register_opts([
|
cfg.CONF.register_opts([
|
||||||
cfg.StrOpt('default_pool_id',
|
cfg.StrOpt('default_pool_id',
|
||||||
|
@ -25,7 +24,7 @@ cfg.CONF.register_opts([
|
||||||
], group='service:central')
|
], group='service:central')
|
||||||
|
|
||||||
|
|
||||||
class FallbackFilter(Filter):
|
class FallbackFilter(base.Filter):
|
||||||
"""If there is no zones available to schedule to, this filter will insert
|
"""If there is no zones available to schedule to, this filter will insert
|
||||||
the default_pool_id.
|
the default_pool_id.
|
||||||
|
|
||||||
|
@ -42,8 +41,9 @@ class FallbackFilter(Filter):
|
||||||
|
|
||||||
def filter(self, context, pools, zone):
|
def filter(self, context, pools, zone):
|
||||||
if len(pools) is 0:
|
if len(pools) is 0:
|
||||||
pools = PoolList()
|
pools = objects.PoolList()
|
||||||
pools.append(Pool(id=cfg.CONF['service:central'].default_pool_id))
|
pools.append(
|
||||||
|
objects.Pool(id=cfg.CONF['service:central'].default_pool_id))
|
||||||
return pools
|
return pools
|
||||||
else:
|
else:
|
||||||
return pools
|
return pools
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from designate.scheduler.filters.base import Filter
|
from designate.scheduler.filters import base
|
||||||
from designate import exceptions
|
from designate import exceptions
|
||||||
from designate import objects
|
from designate import objects
|
||||||
from designate import policy
|
from designate import policy
|
||||||
|
@ -21,7 +21,7 @@ from designate import policy
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PoolIDAttributeFilter(Filter):
|
class PoolIDAttributeFilter(base.Filter):
|
||||||
"""This allows users with the correct role to specify the exact pool_id
|
"""This allows users with the correct role to specify the exact pool_id
|
||||||
to schedule the supplied zone to.
|
to schedule the supplied zone to.
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,13 @@ import random
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from designate.scheduler.filters.base import Filter
|
from designate.scheduler.filters import base
|
||||||
from designate.objects import PoolList
|
from designate.objects import PoolList
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RandomFilter(Filter):
|
class RandomFilter(base.Filter):
|
||||||
"""Randomly chooses one of the input pools if there is multiple supplied.
|
"""Randomly chooses one of the input pools if there is multiple supplied.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
Loading…
Reference in New Issue