Change amphora_id to compute_id in compute drivers

Change-Id: I5105eb3fc432d0866a5a106534d6d63b4f315835
This commit is contained in:
Brandon Logan 2015-10-01 14:17:50 -05:00
parent cce4031fb7
commit 6f7c635661
5 changed files with 30 additions and 30 deletions

View File

@ -55,19 +55,19 @@ class ComputeBase(object):
pass
@abc.abstractmethod
def status(self, amphora_id):
def status(self, compute_id):
"""Check whether the specified amphora is up
:param amphora_id: the ID of the desired amphora
:param compute_id: the ID of the desired amphora
:returns: The compute "status" response ("ONLINE" or "OFFLINE")
"""
pass
@abc.abstractmethod
def get_amphora(self, amphora_id):
def get_amphora(self, compute_id):
"""Retrieve an amphora object
:param amphora_id: the id of the desired amphora
:param compute_id: the id of the desired amphora
:returns: the amphora object
"""
pass

View File

@ -45,23 +45,23 @@ class NoopManager(object):
compute_id = uuidutils.generate_uuid()
return compute_id
def delete(self, amphora_id):
LOG.debug("Compute %s no-op, amphora_id %s",
self.__class__.__name__, amphora_id)
self.computeconfig[amphora_id] = (amphora_id, 'delete')
def delete(self, compute_id):
LOG.debug("Compute %s no-op, compute_id %s",
self.__class__.__name__, compute_id)
self.computeconfig[compute_id] = (compute_id, 'delete')
def status(self, amphora_id):
LOG.debug("Compute %s no-op, amphora_id %s",
self.__class__.__name__, amphora_id)
self.computeconfig[amphora_id] = (amphora_id, 'status')
def status(self, compute_id):
LOG.debug("Compute %s no-op, compute_id %s",
self.__class__.__name__, compute_id)
self.computeconfig[compute_id] = (compute_id, 'status')
return constants.UP
def get_amphora(self, amphora_id):
LOG.debug("Compute %s no-op, amphora_id %s",
self.__class__.__name__, amphora_id)
self.computeconfig[amphora_id] = (amphora_id, 'get_amphora')
def get_amphora(self, compute_id):
LOG.debug("Compute %s no-op, compute_id %s",
self.__class__.__name__, compute_id)
self.computeconfig[compute_id] = (compute_id, 'get_amphora')
return data_models.Amphora(
compute_id=amphora_id,
compute_id=compute_id,
status=constants.ACTIVE,
lb_network_ip='192.0.2.1'
)
@ -81,11 +81,11 @@ class NoopComputeDriver(driver_base.ComputeBase):
config_drive_files, user_data, port_ids)
return compute_id
def delete(self, amphora_id):
self.driver.delete(amphora_id)
def delete(self, compute_id):
self.driver.delete(compute_id)
def status(self, amphora_id):
return self.driver.status(amphora_id)
def status(self, compute_id):
return self.driver.status(compute_id)
def get_amphora(self, amphora_id):
return self.driver.get_amphora(amphora_id)
def get_amphora(self, compute_id):
return self.driver.get_amphora(compute_id)

View File

@ -97,14 +97,14 @@ class VirtualMachineManager(compute_base.ComputeBase):
LOG.exception(_LE("Error deleting nova virtual machine."))
raise exceptions.ComputeDeleteException()
def status(self, amphora_id):
def status(self, compute_id):
'''Retrieve the status of a virtual machine.
:param amphora_id: virtual machine UUID
:param compute_id: virtual machine UUID
:returns: constant of amphora status
'''
try:
amphora = self.get_amphora(amphora_id=amphora_id)
amphora = self.get_amphora(compute_id)
if amphora and amphora.status == 'ACTIVE':
return constants.UP
except Exception:
@ -112,7 +112,7 @@ class VirtualMachineManager(compute_base.ComputeBase):
raise exceptions.ComputeStatusException()
return constants.DOWN
def get_amphora(self, amphora_id):
def get_amphora(self, compute_id):
'''Retrieve the information in nova of a virtual machine.
:param amphora_id: virtual machine UUID
@ -120,7 +120,7 @@ class VirtualMachineManager(compute_base.ComputeBase):
'''
# utilize nova client ServerManager 'get' method to retrieve info
try:
amphora = self.manager.get(amphora_id)
amphora = self.manager.get(compute_id)
except Exception:
LOG.exception(_LE("Error retrieving nova virtual machine."))
raise exceptions.ComputeGetException()

View File

@ -134,7 +134,7 @@ class ComputeDelete(BaseComputeTask):
LOG.debug("Compute Delete execute for amphora with id %s", amphora.id)
try:
self.compute.delete(compute_id=amphora.compute_id)
self.compute.delete(amphora.compute_id)
except Exception:
LOG.exception(_LE("Compute delete for amphora id: %s failed"),
amphora.id)

View File

@ -228,4 +228,4 @@ class TestComputeTasks(base.TestCase):
delete_compute = compute_tasks.ComputeDelete()
delete_compute.execute(_amphora_mock)
mock_driver.delete.assert_called_once_with(compute_id=COMPUTE_ID)
mock_driver.delete.assert_called_once_with(COMPUTE_ID)