Remove CREATE action from worker msg protocol.

Fixes bug #1078774

CREATE is now replaced by UPDATE, which did the same thing anyway.

Change-Id: Ic446a349e053c7787209bdc227bd93b02d67dd12
This commit is contained in:
David Shrewsbury 2012-11-14 12:36:20 -05:00
parent 6b539f0e85
commit ca5445b3c5
3 changed files with 10 additions and 19 deletions

View File

@ -43,7 +43,7 @@ def main():
client = JSONGearmanClient(['localhost:4730']) client = JSONGearmanClient(['localhost:4730'])
data = """ data = """
{ {
"hpcs_action": "create", "hpcs_action": "update",
"loadbalancers": [ "loadbalancers": [
{ {
"name": "a-new-loadbalancer", "name": "a-new-loadbalancer",

View File

@ -47,9 +47,7 @@ class LBaaSController(object):
self.logger.info("Requested action: %s" % action) self.logger.info("Requested action: %s" % action)
try: try:
if action == 'CREATE': if action == 'UPDATE':
return self._action_create()
elif action == 'UPDATE':
return self._action_update() return self._action_update()
elif action == 'SUSPEND': elif action == 'SUSPEND':
return self._action_suspend() return self._action_suspend()
@ -68,9 +66,9 @@ class LBaaSController(object):
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
return self.msg return self.msg
def _action_create(self): def _action_update(self):
""" """
Create a Load Balancer. Create/Update a Load Balancer.
This is the only method (so far) that actually parses the contents This is the only method (so far) that actually parses the contents
of the JSON message (other than the ACTION_FIELD field). Modifying of the JSON message (other than the ACTION_FIELD field). Modifying
@ -201,13 +199,6 @@ class LBaaSController(object):
return self.msg return self.msg
def _action_update(self):
""" Update a Load Balancer. """
# NOTE(shrews): We would need to know the current configuration of
# the load balancer to do an update. Note sure this is really feasible,
# so for now we just do the same as CREATE.
return self._action_create()
def _action_suspend(self): def _action_suspend(self):
""" Suspend a Load Balancer. """ """ Suspend a Load Balancer. """
try: try:

View File

@ -27,7 +27,7 @@ class TestWorkerController(unittest.TestCase):
def testCreate(self): def testCreate(self):
msg = { msg = {
c.ACTION_FIELD: 'CREATE', c.ACTION_FIELD: 'UPDATE',
'loadbalancers': [ 'loadbalancers': [
{ {
'protocol': 'http', 'protocol': 'http',
@ -47,7 +47,7 @@ class TestWorkerController(unittest.TestCase):
def testUpdate(self): def testUpdate(self):
msg = { msg = {
c.ACTION_FIELD: 'CREATE', c.ACTION_FIELD: 'UPDATE',
'loadbalancers': [ 'loadbalancers': [
{ {
'protocol': 'http', 'protocol': 'http',
@ -94,7 +94,7 @@ class TestWorkerController(unittest.TestCase):
def testCreateMissingLBs(self): def testCreateMissingLBs(self):
msg = { msg = {
c.ACTION_FIELD: 'CREATE' c.ACTION_FIELD: 'UPDATE'
} }
controller = c(self.logger, self.driver, msg) controller = c(self.logger, self.driver, msg)
response = controller.run() response = controller.run()
@ -102,7 +102,7 @@ class TestWorkerController(unittest.TestCase):
def testCreateMissingNodes(self): def testCreateMissingNodes(self):
msg = { msg = {
c.ACTION_FIELD: 'CREATE', c.ACTION_FIELD: 'UPDATE',
'loadbalancers': [ { 'protocol': 'http' } ] 'loadbalancers': [ { 'protocol': 'http' } ]
} }
controller = c(self.logger, self.driver, msg) controller = c(self.logger, self.driver, msg)
@ -111,7 +111,7 @@ class TestWorkerController(unittest.TestCase):
def testCreateMissingProto(self): def testCreateMissingProto(self):
msg = { msg = {
c.ACTION_FIELD: 'CREATE', c.ACTION_FIELD: 'UPDATE',
'loadbalancers': [ 'loadbalancers': [
{ {
'nodes': [ 'nodes': [
@ -129,7 +129,7 @@ class TestWorkerController(unittest.TestCase):
def testBadAlgorithm(self): def testBadAlgorithm(self):
msg = { msg = {
c.ACTION_FIELD: 'CREATE', c.ACTION_FIELD: 'UPDATE',
'loadbalancers': [ 'loadbalancers': [
{ {
'protocol': 'http', 'protocol': 'http',