remove unused code in serverprovider and tests
This patch removes some unused code in provider.py and test_provider.py. Specifically in provider.py it removes class ImageDTO(utils.ImmutableMixin) in class ProviderFactor it removes functions upload_image and destroy_image In test_provider.py it removes class ImageDTOTestCase(test.TestCase) Change-Id: I4f66ade949b196ace42f0500b4ac3e610e4dbb53
This commit is contained in:
parent
ca6fb4b0a4
commit
5ac225e212
@ -53,17 +53,6 @@ class Server(utils.ImmutableMixin):
|
||||
port=creds['port'], password=creds['password'])
|
||||
|
||||
|
||||
class ImageDTO(utils.ImmutableMixin):
|
||||
"""Represent information about created image.
|
||||
ProviderFactory.upload_image should return instance of this class.
|
||||
"""
|
||||
def __init__(self, uuid, image_format, container_format):
|
||||
self.uuid = uuid
|
||||
self.image_format = image_format
|
||||
self.container_format = container_format
|
||||
super(ImageDTO, self).__init__()
|
||||
|
||||
|
||||
class ResourceManager(object):
|
||||
"""Supervise resources of a deployment.
|
||||
|
||||
@ -143,24 +132,6 @@ class ProviderFactory(object):
|
||||
"""Returns list of names of available engines."""
|
||||
return [e.__name__ for e in utils.itersubclasses(ProviderFactory)]
|
||||
|
||||
# TODO(akscram): Unused method.
|
||||
def upload_image(self, file_path, disk_format, container_format):
|
||||
"""Upload image that could be used in creating new vms.
|
||||
:file_path: Path to the file with image
|
||||
:disk_format: qcow, qcow2, iso and so on..
|
||||
:container_format: bare, ovf, aki and so on..
|
||||
For more details about formats take a look at:
|
||||
http://docs.openstack.org/developer/glance/formats.html
|
||||
|
||||
:returns: ImageDTO instance
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
# TODO(akscram): Unused method.
|
||||
def destroy_image(self, image_uuid):
|
||||
"""Destroy image by image indentificator."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_servers(self, image_uuid=None, type_id=None, amount=1):
|
||||
"""Create VMs with chosen image.
|
||||
|
@ -74,12 +74,6 @@ class ProviderTestCase(test.TestCase):
|
||||
def test_vm_prvoider_factory_is_abstract(self):
|
||||
self.assertRaises(TypeError, ProviderFactory)
|
||||
|
||||
def test_image_methods_raise_not_implemented(self):
|
||||
provider = FAKE_PROVIDERS[0](None, None)
|
||||
self.assertRaises(NotImplementedError,
|
||||
provider.upload_image, None, None, None)
|
||||
self.assertRaises(NotImplementedError, provider.destroy_image, None)
|
||||
|
||||
|
||||
class ServerTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
@ -101,15 +95,6 @@ class ServerTestCase(test.TestCase):
|
||||
self.assertEqual(getattr(server_one, k), getattr(server_two, k))
|
||||
|
||||
|
||||
class ImageDTOTestCase(test.TestCase):
|
||||
def test_init_image_dto(self):
|
||||
vals = ['uuid', 'qcow2', 'bare']
|
||||
keys = ['uuid', 'image_format', 'container_format']
|
||||
server = serverprovider.ImageDTO(*vals)
|
||||
for k, v in dict(zip(keys, vals)).iteritems():
|
||||
self.assertEqual(getattr(server, k), v)
|
||||
|
||||
|
||||
class ResourceManagerTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
super(ResourceManagerTestCase, self).setUp()
|
||||
|
Loading…
Reference in New Issue
Block a user