Merge "Enable HA on the edge which works as L2 gateway"

This commit is contained in:
Jenkins 2015-09-25 17:56:55 +00:00 committed by Gerrit Code Review
commit 3bebacb960
4 changed files with 23 additions and 0 deletions

View File

@ -1060,3 +1060,9 @@ class EdgeApplianceDriver(object):
except exceptions.VcnsApiException:
LOG.exception(_LE("Failed to delete bridge in the %s"),
device_name)
def update_edge_ha(self, edge_id):
ha_request = {
'featureType': "highavailability_4.0",
'enabled': True}
self.vcns.enable_ha(edge_id, ha_request)

View File

@ -787,3 +787,8 @@ class Vcns(object):
tuning.append(child)
return self.do_request(HTTP_PUT, uri, et.tostring(tuning),
format='xml', decode=True)
def enable_ha(self, edge_id, request_config):
"""Enable HA in the given edge."""
uri = "/api/4.0/edges/%s/highavailability/config?async=true" % edge_id
return self.do_request(HTTP_PUT, uri, request_config)

View File

@ -35,6 +35,8 @@ LOG = logging.getLogger(__name__)
class NsxvL2GatewayDriver(l2gateway_db.L2GatewayMixin):
"""Class to handle API calls for L2 gateway and NSXv backend."""
@property
def _core_plugin(self):
return manager.NeutronManager.get_plugin()
@ -95,6 +97,9 @@ class NsxvL2GatewayDriver(l2gateway_db.L2GatewayMixin):
lrouter['id'])
if not edge_binding:
raise nsx_exc.NsxL2GWDeviceNotFound()
# Enable edge HA on the DLR
edge_id = edge_binding['edge_id']
self._edge_manager.nsxv_manager.update_edge_ha(edge_id)
return edge_binding['edge_id']
def _get_device(self, context, l2gw_id):

View File

@ -1096,3 +1096,10 @@ class FakeVcns(object):
def configure_aggregate_publishing(self):
pass
def enable_ha(self, edge_id, request_config):
header = {
'status': 201
}
response = ''
return (header, response)