Server Pools Storage
This partially implements the changes needed for server pools. Done is: - Added pools table - Added pool_attributes table - Added pool CRUD calls in central and storage with unit tests - Created default pool Still to do in separte patchset(s): - Add pool_id column to domains table and change necessary code - Migrate servers from servers table pool_ attributes table and change necessary code - Remove all old server API code Partially-implements: blueprint server-pools-storage Change-Id: I55cd2fab94cef0e72d4f6cac2b24734f24390711
This commit is contained in:
@@ -261,6 +261,13 @@ class TestCase(base.BaseTestCase):
|
||||
'action': 'DELETE'
|
||||
}]
|
||||
|
||||
pool_fixtures = [
|
||||
{'name': 'test1',
|
||||
'provisioner': 'UNMANAGED'},
|
||||
{'name': 'test2',
|
||||
'provisioner': 'UNMANAGED'}
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestCase, self).setUp()
|
||||
|
||||
@@ -474,6 +481,13 @@ class TestCase(base.BaseTestCase):
|
||||
_values.update(values)
|
||||
return _values
|
||||
|
||||
def get_pool_fixture(self, fixture=0, values=None):
|
||||
values = values or {}
|
||||
|
||||
_values = copy.copy(self.pool_fixtures[fixture])
|
||||
_values.update(values)
|
||||
return _values
|
||||
|
||||
def create_server(self, **kwargs):
|
||||
context = kwargs.pop('context', self.admin_context)
|
||||
fixture = kwargs.pop('fixture', 0)
|
||||
@@ -562,6 +576,18 @@ class TestCase(base.BaseTestCase):
|
||||
return self.central_service.create_blacklist(
|
||||
context, blacklist=blacklist)
|
||||
|
||||
def create_pool(self, **kwargs):
|
||||
context = kwargs.pop('context', self.admin_context)
|
||||
fixture = kwargs.pop('fixture', 0)
|
||||
|
||||
values = self.get_pool_fixture(fixture=fixture, values=kwargs)
|
||||
|
||||
if 'tenant_id' not in values:
|
||||
values['tenant_id'] = context.tenant
|
||||
|
||||
return self.central_service.create_pool(
|
||||
context, objects.Pool(**values))
|
||||
|
||||
def _ensure_interface(self, interface, implementation):
|
||||
for name in interface.__abstractmethods__:
|
||||
in_arginfo = inspect.getargspec(getattr(interface, name))
|
||||
|
||||
Reference in New Issue
Block a user