Corrected some __init__() parameters
Removed log from __init__() parameters Removed get_logger methods Updated specs for above Added optional region parameter to noop compute driver Change-Id: Ie3ed4ebb5d0407cb18f7cf957334dab4bb821bf7
This commit is contained in:
parent
5bd04f8471
commit
8c9ee6d230
@ -20,14 +20,6 @@ import six
|
|||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class ComputeBase(object):
|
class ComputeBase(object):
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def get_logger(self):
|
|
||||||
"""Return logger to be used
|
|
||||||
|
|
||||||
:returns: the logger.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
||||||
key_name=None, sec_groups=None, network_ids=None,
|
key_name=None, sec_groups=None, network_ids=None,
|
||||||
@ -78,4 +70,4 @@ class ComputeBase(object):
|
|||||||
:param amphora_id: the id of the desired amphora
|
:param amphora_id: the id of the desired amphora
|
||||||
:returns: the amphora object
|
:returns: the amphora object
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
@ -24,9 +24,6 @@ class NoopManager(object):
|
|||||||
super(NoopManager, self).__init__()
|
super(NoopManager, self).__init__()
|
||||||
self.computeconfig = {}
|
self.computeconfig = {}
|
||||||
|
|
||||||
def get_logger(self):
|
|
||||||
LOG.debug("Compute %s no-op", self.__class__.__name__)
|
|
||||||
|
|
||||||
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
||||||
key_name=None, sec_groups=None, network_ids=None,
|
key_name=None, sec_groups=None, network_ids=None,
|
||||||
config_drive_files=None, user_data=None):
|
config_drive_files=None, user_data=None):
|
||||||
@ -60,14 +57,10 @@ class NoopManager(object):
|
|||||||
|
|
||||||
|
|
||||||
class NoopComputeDriver(driver_base.ComputeBase):
|
class NoopComputeDriver(driver_base.ComputeBase):
|
||||||
def __init__(self, log):
|
def __init__(self, region=None):
|
||||||
super(NoopComputeDriver, self).__init__()
|
super(NoopComputeDriver, self).__init__()
|
||||||
self.log = log
|
|
||||||
self.driver = NoopManager()
|
self.driver = NoopManager()
|
||||||
|
|
||||||
def get_logger(self):
|
|
||||||
self.driver.get_logger()
|
|
||||||
|
|
||||||
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
||||||
key_name=None, sec_groups=None, network_ids=None,
|
key_name=None, sec_groups=None, network_ids=None,
|
||||||
config_drive_files=None, user_data=None):
|
config_drive_files=None, user_data=None):
|
||||||
@ -83,4 +76,4 @@ class NoopComputeDriver(driver_base.ComputeBase):
|
|||||||
self.driver.status(amphora_id)
|
self.driver.status(amphora_id)
|
||||||
|
|
||||||
def get_amphora(self, amphora_id):
|
def get_amphora(self, amphora_id):
|
||||||
self.driver.get_amphora(amphora_id)
|
self.driver.get_amphora(amphora_id)
|
||||||
|
@ -40,10 +40,6 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
|||||||
self._nova_client = NovaAuth.get_nova_client(region)
|
self._nova_client = NovaAuth.get_nova_client(region)
|
||||||
self.manager = self._nova_client.servers
|
self.manager = self._nova_client.servers
|
||||||
|
|
||||||
def get_logger(self):
|
|
||||||
'''Retrieve a custom logger.'''
|
|
||||||
pass
|
|
||||||
|
|
||||||
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
def build(self, name="amphora_name", amphora_flavor=None, image_id=None,
|
||||||
key_name=None, sec_groups=None, network_ids=None,
|
key_name=None, sec_groups=None, network_ids=None,
|
||||||
config_drive_files=None, user_data=None):
|
config_drive_files=None, user_data=None):
|
||||||
|
@ -75,9 +75,8 @@ class NoopManager(object):
|
|||||||
|
|
||||||
|
|
||||||
class NoopNetworkDriver(driver_base.AbstractNetworkDriver):
|
class NoopNetworkDriver(driver_base.AbstractNetworkDriver):
|
||||||
def __init__(self, log):
|
def __init__(self):
|
||||||
super(NoopNetworkDriver, self).__init__()
|
super(NoopNetworkDriver, self).__init__()
|
||||||
self.log = log
|
|
||||||
self.driver = NoopManager()
|
self.driver = NoopManager()
|
||||||
|
|
||||||
def allocate_vip(self, port_id=None, network_id=None, ip_address=None):
|
def allocate_vip(self, port_id=None, network_id=None, ip_address=None):
|
||||||
@ -99,4 +98,4 @@ class NoopNetworkDriver(driver_base.AbstractNetworkDriver):
|
|||||||
self.driver.unplug_network(amphora_id, network_id)
|
self.driver.unplug_network(amphora_id, network_id)
|
||||||
|
|
||||||
def get_plugged_networks(self, amphora_id):
|
def get_plugged_networks(self, amphora_id):
|
||||||
self.driver.get_plugged_networks(amphora_id)
|
self.driver.get_plugged_networks(amphora_id)
|
||||||
|
@ -29,7 +29,7 @@ class TestNoopComputeDriver(base.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNoopComputeDriver, self).setUp()
|
super(TestNoopComputeDriver, self).setUp()
|
||||||
self.driver = driver.NoopComputeDriver(LOG)
|
self.driver = driver.NoopComputeDriver()
|
||||||
|
|
||||||
self.name = "amphora_name"
|
self.name = "amphora_name"
|
||||||
self.amphora_flavor = "m1.tiny"
|
self.amphora_flavor = "m1.tiny"
|
||||||
@ -41,9 +41,6 @@ class TestNoopComputeDriver(base.TestCase):
|
|||||||
self.user_data = "user_data"
|
self.user_data = "user_data"
|
||||||
self.amphora_id = self.FAKE_UUID_1
|
self.amphora_id = self.FAKE_UUID_1
|
||||||
|
|
||||||
def get_logger(self):
|
|
||||||
self.driver.get_logger()
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.driver.build(self.name, self.amphora_flavor, self.image_id,
|
self.driver.build(self.name, self.amphora_flavor, self.image_id,
|
||||||
self.key_name, self.sec_groups, self.network_ids,
|
self.key_name, self.sec_groups, self.network_ids,
|
||||||
@ -71,4 +68,4 @@ class TestNoopComputeDriver(base.TestCase):
|
|||||||
self.driver.status(self.amphora_id)
|
self.driver.status(self.amphora_id)
|
||||||
|
|
||||||
def get_amphora(self):
|
def get_amphora(self):
|
||||||
self.driver.get_amphora(self.amphora_id)
|
self.driver.get_amphora(self.amphora_id)
|
||||||
|
@ -30,7 +30,7 @@ class TestNoopNetworkDriver(base.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNoopNetworkDriver, self).setUp()
|
super(TestNoopNetworkDriver, self).setUp()
|
||||||
self.driver = driver.NoopNetworkDriver(LOG)
|
self.driver = driver.NoopNetworkDriver()
|
||||||
self.port_id = 88
|
self.port_id = 88
|
||||||
self.network_id = self.FAKE_UUID_3
|
self.network_id = self.FAKE_UUID_3
|
||||||
self.ip_address = "10.0.0.2"
|
self.ip_address = "10.0.0.2"
|
||||||
@ -90,4 +90,4 @@ class TestNoopNetworkDriver(base.TestCase):
|
|||||||
self.driver.get_plugged_networks(self.amphora_id)
|
self.driver.get_plugged_networks(self.amphora_id)
|
||||||
self.assertEqual((self.amphora_id, 'get_plugged_networks'),
|
self.assertEqual((self.amphora_id, 'get_plugged_networks'),
|
||||||
self.driver.driver.networkconfigconfig[(
|
self.driver.driver.networkconfigconfig[(
|
||||||
self.amphora_id)])
|
self.amphora_id)])
|
||||||
|
@ -34,9 +34,6 @@ Establish a base class to model the desire functionality:
|
|||||||
|
|
||||||
class AmphoraLoadBalancerDriver(object):
|
class AmphoraLoadBalancerDriver(object):
|
||||||
|
|
||||||
def get_logger(self):
|
|
||||||
#return the logger to use - this is a way to inject a custom logger for testing, etc
|
|
||||||
|
|
||||||
def update(self, listener, vip):
|
def update(self, listener, vip):
|
||||||
"""updates the amphora with a new configuration
|
"""updates the amphora with a new configuration
|
||||||
|
|
||||||
|
@ -35,15 +35,6 @@ Establish an abstract base class to model the desired functionality:
|
|||||||
|
|
||||||
class AmphoraComputeDriver(object):
|
class AmphoraComputeDriver(object):
|
||||||
|
|
||||||
def get_logger(self):
|
|
||||||
|
|
||||||
""" return the logger to use - this is a way to inject a
|
|
||||||
custom logger for testing, etc
|
|
||||||
|
|
||||||
:returns: the logger
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def build(self, amphora_type = VM, amphora_flavor = None,
|
def build(self, amphora_type = VM, amphora_flavor = None,
|
||||||
image_id = None, keys = None, sec_groups = None,
|
image_id = None, keys = None, sec_groups = None,
|
||||||
network_ids = None,config_drive_files = None,user_data=None):
|
network_ids = None,config_drive_files = None,user_data=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user