[API][MGM]: Improved floating IP error handling

* Floating IPs assign failures now mark the device and its LBs in an ERROR state
* Floating IPs assigned at the end of create LB
* MGM has a little bit more info

Change-Id: I29ad567ea68bd03081190e7ea26fb2b666cbe3ac
This commit is contained in:
Andrew Hutchings
2013-10-14 23:33:11 +01:00
committed by David Shrewsbury
parent 6e601de80d
commit 204a9871df
3 changed files with 18 additions and 3 deletions

View File

@@ -333,9 +333,10 @@ class LoadBalancersController(RestController):
session.rollback()
raise ExhaustedError('No virtual IPs available')
vip.device = device.id
submit_vip_job(
'ASSIGN', device.name, str(ipaddress.IPv4Address(vip.ip))
)
# For use after transaction
device_name = device.name
vip_ip = vip.ip
else:
virtual_id = body.virtualIps[0].id
# This is an additional load balancer
@@ -453,6 +454,11 @@ class LoadBalancersController(RestController):
submit_job(
'UPDATE', device.name, device.id, lb.id
)
if body.virtualIps == Unset:
submit_vip_job(
'ASSIGN', device_name, str(ipaddress.IPv4Address(vip_ip))
)
return return_data
@wsme_pecan.wsexpose(None, body=LBPut, status_code=202)

View File

@@ -109,6 +109,11 @@ class GearmanClientThread(object):
self.logger.error(
"Failed to assign IP {0} to device {1}".format(self.lbid, data)
)
with db_session() as session:
device = session.query(Device).\
filter(Device.name == data).first()
errmsg = 'Floating IP assign failed'
self._set_error(device.id, errmsg, session)
def send_remove(self, data):
job_data = {

View File

@@ -78,6 +78,10 @@ class AssignIpController(object):
)
try:
node_id = nova.get_node(self.msg['name'])
self.logger.info(
'Node name {0} identified as ID {1}'
.format(self.msg['name'], node_id)
)
nova.vip_assign(node_id, self.msg['ip'])
if cfg.CONF['mgm']['tcp_check_port']:
self.check_ip(self.msg['ip'],