Move solver-scheduler's top directory from 'nova' to 'nova_solverscheduler'

The nova solver scheduler was designed to be a drop-in patch for nova, and it
uses 'nova' as the directory now, however it's easier to manage the project
as an individual python package, therefore we want to move the top directory
out to a separate one, which is called 'nova_solverscheduler'. This patch
will modify the module import dependencies and also add necessary init files
so as to turn the project into a complete python package.

Change-Id: I62550c84f157db398da5edbef514832e1351f66f
This commit is contained in:
Xinyuan Huang 2015-05-16 17:54:22 -07:00
parent cd1b540b52
commit 6c3c0fc8ff
83 changed files with 198 additions and 148 deletions

View File

@ -35,8 +35,8 @@ In order to enable nova-solver-scheduler, we need to have the following minimal
```
[DEFAULT]
... (other options)
scheduler_driver=nova.scheduler.solver_scheduler.ConstraintSolverScheduler
scheduler_host_manager=nova.scheduler.solver_scheduler_host_manager.SolverSchedulerHostManager
scheduler_driver=nova_solverscheduler.scheduler.solver_scheduler.ConstraintSolverScheduler
scheduler_host_manager=nova_solverscheduler.scheduler.solver_scheduler_host_manager.SolverSchedulerHostManager
```
## Solvers
@ -47,7 +47,7 @@ The following option in the "[solver_scheduler]" section of nova config should b
```
[solver_scheduler]
scheduler_host_solver=nova.scheduler.solvers.fast_solver.FastSolver
scheduler_host_solver=nova_solverscheduler.scheduler.solvers.fast_solver.FastSolver
```
## Costs and Constraints

View File

@ -33,7 +33,8 @@ LOG = logging.getLogger(__name__)
solver_opts = [
cfg.StrOpt('scheduler_host_solver',
default='nova.scheduler.solvers.fast_solver.FastSolver',
default='nova_solverscheduler.scheduler.solvers.fast_solver.'
'FastSolver',
help='The pluggable solver implementation to use. By '
'default, use the FastSolver.'),
]

View File

@ -19,9 +19,9 @@ Scheduler host constraint solvers
from oslo.config import cfg
from nova.scheduler.solvers import constraints
from nova.scheduler.solvers import costs
from nova import solver_scheduler_exception as exception
from nova_solverscheduler.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler import solver_scheduler_exception as exception
scheduler_solver_opts = [
cfg.ListOpt('scheduler_solver_costs',

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import compute_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class ActiveHostsConstraint(constraints.BaseFilterConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import affinity_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class SameHostConstraint(constraints.BaseFilterConstraint):

View File

@ -18,7 +18,7 @@ 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.solvers.constraints import disk_constraint
from nova_solverscheduler.scheduler.solvers.constraints import disk_constraint
CONF = cfg.CONF
CONF.import_opt('disk_allocation_ratio', 'nova.scheduler.filters.disk_filter')

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import aggregate_image_properties_isolation
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class AggregateImagePropertiesIsolationConstraint(

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import aggregate_instance_extra_specs
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class AggregateInstanceExtraSpecsConstraint(constraints.BaseFilterConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import aggregate_multitenancy_isolation
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class AggregateMultiTenancyIsolationConstraint(

View File

@ -18,7 +18,7 @@ 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.solvers.constraints import ram_constraint
from nova_solverscheduler.scheduler.solvers.constraints import ram_constraint
CONF = cfg.CONF
CONF.import_opt('ram_allocation_ratio', 'nova.scheduler.filters.ram_filter')

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import type_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class AggregateTypeAffinityConstraint(constraints.BaseFilterConstraint):

View File

@ -18,7 +18,7 @@ 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.solvers.constraints import vcpu_constraint
from nova_solverscheduler.scheduler.solvers.constraints import vcpu_constraint
CONF = cfg.CONF
CONF.import_opt('cpu_allocation_ratio', 'nova.scheduler.filters.core_filter')

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import availability_zone_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class AvailabilityZoneConstraint(constraints.BaseFilterConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import compute_capabilities_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class ComputeCapabilitiesConstraint(constraints.BaseFilterConstraint):

View File

@ -18,7 +18,7 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
CONF = cfg.CONF
CONF.import_opt('disk_allocation_ratio', 'nova.scheduler.filters.disk_filter')

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import image_props_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class ImagePropertiesConstraint(constraints.BaseFilterConstraint):

View File

@ -17,7 +17,7 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
LOG = logging.getLogger(__name__)

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import isolated_hosts_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class IsolatedHostsConstraint(constraints.BaseFilterConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import json_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class JsonConstraint(constraints.BaseFilterConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import metrics_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class MetricsConstraint(constraints.BaseFilterConstraint):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class NoConstraint(constraints.BaseLinearConstraint):

View File

@ -17,7 +17,7 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
CONF = cfg.CONF
CONF.import_opt("max_instances_per_host",

View File

@ -17,7 +17,7 @@ import copy
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
LOG = logging.getLogger(__name__)

View File

@ -18,7 +18,7 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
CONF = cfg.CONF
CONF.import_opt('ram_allocation_ratio', 'nova.scheduler.filters.ram_filter')

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import retry_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class RetryConstraint(constraints.BaseFilterConstraint):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class ServerGroupAffinityConstraint(constraints.BaseLinearConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import trusted_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class TrustedHostsConstraint(constraints.BaseFilterConstraint):

View File

@ -14,7 +14,7 @@
# under the License.
from nova.scheduler.filters import type_filter
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
class TypeAffinityConstraint(constraints.BaseFilterConstraint):

View File

@ -17,7 +17,7 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import constraints
CONF = cfg.CONF
CONF.import_opt('cpu_allocation_ratio', 'nova.scheduler.filters.core_filter')

View File

@ -28,9 +28,9 @@ in the configuration file as the followings:
from oslo.config import cfg
from nova.scheduler.solvers import costs as solver_costs
from nova.scheduler.solvers.costs import utils as cost_utils
from nova.scheduler import utils
from nova_solverscheduler.scheduler.solvers import costs as solver_costs
from nova_solverscheduler.scheduler.solvers.costs import utils as cost_utils
metrics_cost_opts = [
cfg.FloatOpt('metrics_cost_multiplier',

View File

@ -25,8 +25,8 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler.solvers import costs as solver_costs
from nova.scheduler.solvers.costs import utils
from nova_solverscheduler.scheduler.solvers import costs as solver_costs
from nova_solverscheduler.scheduler.solvers.costs import utils
ram_cost_opts = [
cfg.FloatOpt('ram_cost_multiplier',

View File

@ -15,7 +15,7 @@
import operator
from nova.scheduler import solvers as scheduler_solver
from nova_solverscheduler.scheduler import solvers as scheduler_solver
class FastSolver(scheduler_solver.BaseHostSolver):

View File

@ -21,7 +21,7 @@ from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler import solvers as scheduler_solver
from nova_solverscheduler.scheduler import solvers as scheduler_solver
pulp_solver_opts = [
cfg.IntOpt('pulp_solver_timeout_seconds',

View File

@ -21,8 +21,8 @@ import mox
from nova.compute import vm_states
from nova import db
from nova.openstack.common import jsonutils
from nova.scheduler import solver_scheduler
from nova.scheduler import solver_scheduler_host_manager
from nova_solverscheduler.scheduler import solver_scheduler
from nova_solverscheduler.scheduler import solver_scheduler_host_manager
COMPUTE_NODES = [

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import active_hosts_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import active_hosts_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestActiveHostsConstraint(test.NoDBTestCase):
@ -35,7 +37,7 @@ class TestActiveHostsConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'active_hosts_constraint.ActiveHostsConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import affinity_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import affinity_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestSameHostConstraint(test.NoDBTestCase):
@ -35,7 +37,7 @@ class TestSameHostConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'affinity_constraint.SameHostConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):
@ -64,7 +66,7 @@ class TestDifferentHostConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'affinity_constraint.DifferentHostConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):
@ -93,7 +95,7 @@ class TestSimpleCidrAffinityConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'affinity_constraint.SimpleCidrAffinityConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -16,9 +16,10 @@
import mock
from nova import context
from nova.scheduler.solvers.constraints import aggregate_disk
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import aggregate_disk
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateDiskConstraint(test.NoDBTestCase):

View File

@ -15,10 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import \
aggregate_image_properties_isolation
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import aggregate_image_properties_isolation
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateImagePropertiesIsolationConstraint(test.NoDBTestCase):
@ -37,7 +38,7 @@ class TestAggregateImagePropertiesIsolationConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'aggregate_image_properties_isolation.'
'AggregateImagePropertiesIsolationConstraint.host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import aggregate_instance_extra_specs
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import aggregate_instance_extra_specs
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateInstanceExtraSpecsConstraint(test.NoDBTestCase):
@ -36,7 +38,7 @@ class TestAggregateInstanceExtraSpecsConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'aggregate_instance_extra_specs.'
'AggregateInstanceExtraSpecsConstraint.host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,10 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import \
aggregate_multitenancy_isolation
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import aggregate_multitenancy_isolation
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateMultiTenancyIsolationConstraint(test.NoDBTestCase):
@ -37,7 +38,7 @@ class TestAggregateMultiTenancyIsolationConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'aggregate_multitenancy_isolation.'
'AggregateMultiTenancyIsolationConstraint.host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -16,9 +16,10 @@
import mock
from nova import context
from nova.scheduler.solvers.constraints import aggregate_ram
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import aggregate_ram
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateRamConstraint(test.NoDBTestCase):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import aggregate_type_affinity
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import aggregate_type_affinity
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateTypeAffinityConstraint(test.NoDBTestCase):
@ -36,7 +38,7 @@ class TestAggregateTypeAffinityConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'aggregate_type_affinity.AggregateTypeAffinityConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -16,9 +16,10 @@
import mock
from nova import context
from nova.scheduler.solvers.constraints import aggregate_vcpu
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import aggregate_vcpu
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAggregateVcpuConstraint(test.NoDBTestCase):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import availability_zone_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import availability_zone_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestAvailabilityZoneConstraint(test.NoDBTestCase):
@ -36,7 +38,7 @@ class TestAvailabilityZoneConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'availability_zone_constraint.'
'AvailabilityZoneConstraint.host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import compute_capabilities_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import compute_capabilities_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestComputeCapabilitiesConstraint(test.NoDBTestCase):
@ -36,7 +38,7 @@ class TestComputeCapabilitiesConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'compute_capabilities_constraint.'
'ComputeCapabilitiesConstraint.host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -20,9 +20,10 @@ Tests for solver scheduler constraints.
import mock
from nova import context
from nova.scheduler.solvers import constraints
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers import constraints
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class ConstraintTestBase(test.NoDBTestCase):
@ -32,7 +33,8 @@ class ConstraintTestBase(test.NoDBTestCase):
self.context = context.RequestContext('fake', 'fake')
constraint_handler = constraints.ConstraintHandler()
classes = constraint_handler.get_matching_classes(
['nova.scheduler.solvers.constraints.all_constraints'])
['nova_solverscheduler.scheduler.solvers.constraints.'
'all_constraints'])
self.class_map = {}
for c in classes:
self.class_map[c.__name__] = c
@ -69,7 +71,7 @@ class TestBaseFilterConstraint(ConstraintTestBase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'BaseFilterConstraint.host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):
expected_cons_mat = [

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import disk_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import disk_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestDiskConstraint(test.NoDBTestCase):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import image_props_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import image_props_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestImagePropsConstraint(test.NoDBTestCase):
@ -35,7 +37,7 @@ class TestImagePropsConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'image_props_constraint.ImagePropertiesConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -13,9 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import io_ops_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import io_ops_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestIoOpsConstraint(test.NoDBTestCase):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import isolated_hosts_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import isolated_hosts_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestIsolatedHostsConstraint(test.NoDBTestCase):
@ -36,7 +38,7 @@ class TestIsolatedHostsConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'isolated_hosts_constraint.IsolatedHostsConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,9 +15,10 @@
import mock
from nova.scheduler.solvers.constraints import json_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import json_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestJsonConstraint(test.NoDBTestCase):
@ -35,7 +36,7 @@ class TestJsonConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'json_constraint.JsonConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import metrics_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import metrics_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestMetricsConstraint(test.NoDBTestCase):
@ -35,7 +37,7 @@ class TestMetricsConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'metrics_constraint.MetricsConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import no_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import no_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestNoConstraint(test.NoDBTestCase):

View File

@ -13,9 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import num_instances_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import num_instances_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestNumInstancesConstraint(test.NoDBTestCase):

View File

@ -16,9 +16,11 @@
import mock
from nova.pci import pci_stats
from nova.scheduler.solvers.constraints import pci_passthrough_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import pci_passthrough_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestPciPassthroughConstraint(test.NoDBTestCase):

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import ram_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import ram_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestRamConstraint(test.NoDBTestCase):

View File

@ -15,9 +15,10 @@
import mock
from nova.scheduler.solvers.constraints import retry_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import retry_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestRetryConstraint(test.NoDBTestCase):
@ -35,7 +36,7 @@ class TestRetryConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'retry_constraint.RetryConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -13,10 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import \
server_group_affinity_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import server_group_affinity_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestServerGroupAffinityConstraint(test.NoDBTestCase):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import trusted_hosts_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import trusted_hosts_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestTrustedHostsConstraint(test.NoDBTestCase):
@ -35,7 +37,7 @@ class TestTrustedHostsConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'trusted_hosts_constraint.TrustedHostsConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -15,9 +15,11 @@
import mock
from nova.scheduler.solvers.constraints import type_affinity_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints \
import type_affinity_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestTypeAffinityConstraint(test.NoDBTestCase):
@ -35,7 +37,7 @@ class TestTypeAffinityConstraint(test.NoDBTestCase):
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
@mock.patch('nova_solverscheduler.scheduler.solvers.constraints.'
'type_affinity_constraint.TypeAffinityConstraint.'
'host_filter_cls')
def test_get_constraint_matrix(self, mock_filter_cls):

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.constraints import vcpu_constraint
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers.constraints import vcpu_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestVcpuConstraint(test.NoDBTestCase):

View File

@ -18,8 +18,8 @@ Tests for solver scheduler costs.
"""
from nova import context
from nova.scheduler.solvers import costs
from nova import test
from nova_solverscheduler.scheduler.solvers import costs
class CostTestBase(test.NoDBTestCase):
@ -29,7 +29,7 @@ class CostTestBase(test.NoDBTestCase):
self.context = context.RequestContext('fake', 'fake')
cost_handler = costs.CostHandler()
classes = cost_handler.get_matching_classes(
['nova.scheduler.solvers.costs.all_costs'])
['nova_solverscheduler.scheduler.solvers.costs.all_costs'])
self.class_map = {}
for c in classes:
self.class_map[c.__name__] = c

View File

@ -17,10 +17,11 @@
from nova import context
from nova.openstack.common.fixture import mockpatch
from nova.scheduler.solvers import costs
from nova.scheduler.solvers.costs import ram_cost
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler.scheduler.solvers.costs import ram_cost
class TestMetricsCost(test.NoDBTestCase):
@ -32,7 +33,8 @@ class TestMetricsCost(test.NoDBTestCase):
self.host_manager = fakes.FakeSolverSchedulerHostManager()
self.cost_handler = costs.CostHandler()
self.cost_classes = self.cost_handler.get_matching_classes(
['nova.scheduler.solvers.costs.metrics_cost.MetricsCost'])
['nova_solverscheduler.scheduler.solvers.costs.metrics_cost.'
'MetricsCost'])
def _get_all_hosts(self):
ctxt = context.get_admin_context()

View File

@ -17,10 +17,11 @@
from nova import context
from nova.openstack.common.fixture import mockpatch
from nova.scheduler.solvers import costs
from nova.scheduler.solvers.costs import ram_cost
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler.scheduler.solvers.costs import ram_cost
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestRamCost(test.NoDBTestCase):
@ -32,7 +33,7 @@ class TestRamCost(test.NoDBTestCase):
self.host_manager = fakes.FakeSolverSchedulerHostManager()
self.cost_handler = costs.CostHandler()
self.cost_classes = self.cost_handler.get_matching_classes(
['nova.scheduler.solvers.costs.ram_cost.RamCost'])
['nova_solverscheduler.scheduler.solvers.costs.ram_cost.RamCost'])
def _get_all_hosts(self):
ctxt = context.get_admin_context()

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.scheduler.solvers.costs import utils
from nova import test
from nova_solverscheduler.scheduler.solvers.costs import utils
class CostUtilsTestCase(test.NoDBTestCase):

View File

@ -15,11 +15,12 @@
import mock
from nova.scheduler import solver_scheduler_host_manager as host_manager
from nova.scheduler.solvers import constraints
from nova.scheduler.solvers import costs
from nova.scheduler.solvers import fast_solver
from nova import test
from nova_solverscheduler.scheduler import solver_scheduler_host_manager \
as host_manager
from nova_solverscheduler.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler.scheduler.solvers import fast_solver
class FakeCost1(costs.BaseLinearCost):

View File

@ -19,11 +19,12 @@ Tests For Pulp-Solver.
import mock
from nova.scheduler import solver_scheduler_host_manager as host_manager
from nova.scheduler.solvers import constraints
from nova.scheduler.solvers import costs
from nova.scheduler.solvers import pulp_solver
from nova import test
from nova_solverscheduler.scheduler import solver_scheduler_host_manager \
as host_manager
from nova_solverscheduler.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler.scheduler.solvers import pulp_solver
class FakeCost1(costs.BaseLinearCost):

View File

@ -15,11 +15,11 @@
import mock
from nova.scheduler import solvers
from nova.scheduler.solvers import constraints
from nova.scheduler.solvers import costs
from nova import solver_scheduler_exception as exception
from nova import test
from nova_solverscheduler.scheduler import solvers
from nova_solverscheduler.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler import solver_scheduler_exception as exception
class FakeCost1(costs.BaseCost):

View File

@ -26,11 +26,12 @@ from nova import db
from nova import exception
from nova.scheduler import driver
from nova.scheduler import host_manager
from nova.scheduler import solver_scheduler
from nova.scheduler import weights
from nova import solver_scheduler_exception
from nova.tests.scheduler import solver_scheduler_fakes as fakes
from nova.tests.scheduler import test_scheduler
from nova_solverscheduler.scheduler import solver_scheduler
from nova_solverscheduler import solver_scheduler_exception
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
def fake_get_hosts_stripping_ignored_and_forced(hosts, filter_properties):

View File

@ -16,8 +16,9 @@
Tests For SolverSchedulerHostManager
"""
from nova.openstack.common import timeutils
from nova.scheduler import solver_scheduler_host_manager as host_manager
from nova import test
from nova_solverscheduler.scheduler import solver_scheduler_host_manager \
as host_manager
class SolverSchedulerHostManagerTestCase(test.NoDBTestCase):

View File

@ -48,7 +48,7 @@ Solvers
-------
All Solver implementations will be in the module
(:mod:`nova.scheduler.solvers`). A solver implementation should be a
(:mod:`nova_solverscheduler.scheduler.solvers`). A solver implementation should be a
subclass of ``solvers.BaseHostSolver`` and they implement the ``host_solve``
method. This method returns a list of host-instance tuples after solving
the constraints optimization problem.
@ -124,11 +124,11 @@ under the ``[solver_scheduler]`` namespace:
`The Solver Scheduler driver to use (required):`
``scheduler_driver=nova.scheduler.solver_scheduler.ConstraintSolverScheduler``
``scheduler_driver=nova_solverscheduler.scheduler.solver_scheduler.ConstraintSolverScheduler``
`The Solver implementation to use:`
``scheduler_host_solver=nova.scheduler.solvers.hosts_pulp_solver.HostsPulpSolver``
``scheduler_host_solver=nova_solverscheduler.scheduler.solvers.hosts_pulp_solver.HostsPulpSolver``
When using the default provided Solver implementation |HostsPulpSolver|, the
following default values of these settings can be modified:
@ -149,4 +149,4 @@ to spreading:`
``ram_allocation_ratio=1.5``
.. |HostsPulpSolver| replace:: :class:`HostsPulpSolver <nova.scheduler.solvers.hosts_pulp_solver.HostsPulpSolver>`
.. |HostsPulpSolver| replace:: :class:`HostsPulpSolver <nova_solverscheduler.scheduler.solvers.hosts_pulp_solver.HostsPulpSolver>`