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'])
data = """
{
"hpcs_action": "create",
"hpcs_action": "update",
"loadbalancers": [
{
"name": "a-new-loadbalancer",

View File

@ -47,9 +47,7 @@ class LBaaSController(object):
self.logger.info("Requested action: %s" % action)
try:
if action == 'CREATE':
return self._action_create()
elif action == 'UPDATE':
if action == 'UPDATE':
return self._action_update()
elif action == 'SUSPEND':
return self._action_suspend()
@ -68,9 +66,9 @@ class LBaaSController(object):
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
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
of the JSON message (other than the ACTION_FIELD field). Modifying
@ -201,13 +199,6 @@ class LBaaSController(object):
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):
""" Suspend a Load Balancer. """
try:

View File

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