Merge "Analyze re-raised exceptions in Cisco Plugin"
This commit is contained in:
commit
3ca3f0a261
@ -269,7 +269,8 @@ def reserve_vlan(db_session, network_profile):
|
|||||||
physical_network = alloc.physical_network
|
physical_network = alloc.physical_network
|
||||||
alloc.allocated = True
|
alloc.allocated = True
|
||||||
return (physical_network, segment_type, segment_id, "0.0.0.0")
|
return (physical_network, segment_type, segment_id, "0.0.0.0")
|
||||||
raise q_exc.NoNetworkAvailable()
|
raise c_exc.NoMoreNetworkSegments(
|
||||||
|
network_profile_name=network_profile.name)
|
||||||
|
|
||||||
|
|
||||||
def reserve_vxlan(db_session, network_profile):
|
def reserve_vxlan(db_session, network_profile):
|
||||||
@ -297,7 +298,8 @@ def reserve_vxlan(db_session, network_profile):
|
|||||||
alloc.allocated = True
|
alloc.allocated = True
|
||||||
return (physical_network, segment_type,
|
return (physical_network, segment_type,
|
||||||
segment_id, get_multicast_ip(network_profile))
|
segment_id, get_multicast_ip(network_profile))
|
||||||
raise q_exc.NoNetworkAvailable()
|
raise c_exc.NoMoreNetworkSegments(
|
||||||
|
network_profile_name=network_profile.name)
|
||||||
|
|
||||||
|
|
||||||
def alloc_network(db_session, network_profile_id):
|
def alloc_network(db_session, network_profile_id):
|
||||||
@ -310,14 +312,10 @@ def alloc_network(db_session, network_profile_id):
|
|||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
network_profile = get_network_profile(db_session,
|
network_profile = get_network_profile(db_session,
|
||||||
network_profile_id)
|
network_profile_id)
|
||||||
try:
|
if network_profile.segment_type == c_const.NETWORK_TYPE_VLAN:
|
||||||
if network_profile.segment_type == c_const.NETWORK_TYPE_VLAN:
|
return reserve_vlan(db_session, network_profile)
|
||||||
return reserve_vlan(db_session, network_profile)
|
else:
|
||||||
else:
|
return reserve_vxlan(db_session, network_profile)
|
||||||
return reserve_vxlan(db_session, network_profile)
|
|
||||||
except q_exc.NoNetworkAvailable:
|
|
||||||
raise c_exc.NoMoreNetworkSegments(
|
|
||||||
network_profile_name=network_profile.name)
|
|
||||||
|
|
||||||
|
|
||||||
def reserve_specific_vlan(db_session, physical_network, vlan_id):
|
def reserve_specific_vlan(db_session, physical_network, vlan_id):
|
||||||
@ -908,10 +906,7 @@ class NetworkProfile_db_mixin(object):
|
|||||||
profile dictionary. Only these fields will be returned
|
profile dictionary. Only these fields will be returned
|
||||||
:returns: network profile dictionary
|
:returns: network profile dictionary
|
||||||
"""
|
"""
|
||||||
try:
|
profile = get_network_profile(context.session, id)
|
||||||
profile = get_network_profile(context.session, id)
|
|
||||||
except exc.NoResultFound:
|
|
||||||
raise c_exc.NetworkProfileIdNotFound(profile_id=id)
|
|
||||||
return self._make_network_profile_dict(profile, fields)
|
return self._make_network_profile_dict(profile, fields)
|
||||||
|
|
||||||
def get_network_profiles(self, context, filters=None, fields=None):
|
def get_network_profiles(self, context, filters=None, fields=None):
|
||||||
@ -1087,10 +1082,7 @@ class PolicyProfile_db_mixin(object):
|
|||||||
profile dictionary. Only these fields will be returned
|
profile dictionary. Only these fields will be returned
|
||||||
:returns: policy profile dictionary
|
:returns: policy profile dictionary
|
||||||
"""
|
"""
|
||||||
try:
|
profile = get_policy_profile(context.session, id)
|
||||||
profile = get_policy_profile(context.session, id)
|
|
||||||
except exc.NoResultFound:
|
|
||||||
raise c_exc.PolicyProfileIdNotFound(profile_id=id)
|
|
||||||
return self._make_policy_profile_dict(profile, fields)
|
return self._make_policy_profile_dict(profile, fields)
|
||||||
|
|
||||||
def get_policy_profiles(self, context, filters=None, fields=None):
|
def get_policy_profiles(self, context, filters=None, fields=None):
|
||||||
|
@ -281,12 +281,7 @@ class PluginV2(db_base_plugin_v2.NeutronDbPluginV2):
|
|||||||
def get_qos_details(self, tenant_id, qos_id):
|
def get_qos_details(self, tenant_id, qos_id):
|
||||||
"""Get QoS Details."""
|
"""Get QoS Details."""
|
||||||
LOG.debug(_("get_qos_details() called"))
|
LOG.debug(_("get_qos_details() called"))
|
||||||
try:
|
return cdb.get_qos(tenant_id, qos_id)
|
||||||
qos_level = cdb.get_qos(tenant_id, qos_id)
|
|
||||||
except Exception:
|
|
||||||
raise cexc.QosNotFound(tenant_id=tenant_id,
|
|
||||||
qos_id=qos_id)
|
|
||||||
return qos_level
|
|
||||||
|
|
||||||
def create_qos(self, tenant_id, qos_name, qos_desc):
|
def create_qos(self, tenant_id, qos_name, qos_desc):
|
||||||
"""Create a QoS level."""
|
"""Create a QoS level."""
|
||||||
@ -297,23 +292,12 @@ class PluginV2(db_base_plugin_v2.NeutronDbPluginV2):
|
|||||||
def delete_qos(self, tenant_id, qos_id):
|
def delete_qos(self, tenant_id, qos_id):
|
||||||
"""Delete a QoS level."""
|
"""Delete a QoS level."""
|
||||||
LOG.debug(_("delete_qos() called"))
|
LOG.debug(_("delete_qos() called"))
|
||||||
try:
|
|
||||||
cdb.get_qos(tenant_id, qos_id)
|
|
||||||
except Exception:
|
|
||||||
raise cexc.QosNotFound(tenant_id=tenant_id,
|
|
||||||
qos_id=qos_id)
|
|
||||||
return cdb.remove_qos(tenant_id, qos_id)
|
return cdb.remove_qos(tenant_id, qos_id)
|
||||||
|
|
||||||
def rename_qos(self, tenant_id, qos_id, new_name):
|
def rename_qos(self, tenant_id, qos_id, new_name):
|
||||||
"""Rename QoS level."""
|
"""Rename QoS level."""
|
||||||
LOG.debug(_("rename_qos() called"))
|
LOG.debug(_("rename_qos() called"))
|
||||||
try:
|
return cdb.update_qos(tenant_id, qos_id, new_name)
|
||||||
cdb.get_qos(tenant_id, qos_id)
|
|
||||||
except Exception:
|
|
||||||
raise cexc.QosNotFound(tenant_id=tenant_id,
|
|
||||||
qos_id=qos_id)
|
|
||||||
qos = cdb.update_qos(tenant_id, qos_id, new_name)
|
|
||||||
return qos
|
|
||||||
|
|
||||||
def get_all_credentials(self):
|
def get_all_credentials(self):
|
||||||
"""Get all credentials."""
|
"""Get all credentials."""
|
||||||
|
@ -71,7 +71,7 @@ class CiscoNEXUSDriver():
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# Raise a Neutron exception. Include a description of
|
# Raise a Neutron exception. Include a description of
|
||||||
# the original ncclient exception.
|
# the original ncclient exception. No need to preserve T/B
|
||||||
raise cexc.NexusConfigFailed(config=config, exc=e)
|
raise cexc.NexusConfigFailed(config=config, exc=e)
|
||||||
|
|
||||||
def get_credential(self, nexus_ip):
|
def get_credential(self, nexus_ip):
|
||||||
@ -107,7 +107,7 @@ class CiscoNEXUSDriver():
|
|||||||
self.connections[nexus_host] = man
|
self.connections[nexus_host] = man
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Raise a Neutron exception. Include a description of
|
# Raise a Neutron exception. Include a description of
|
||||||
# the original ncclient exception.
|
# the original ncclient exception. No need to preserve T/B.
|
||||||
raise cexc.NexusConnectFailed(nexus_host=nexus_host, exc=e)
|
raise cexc.NexusConnectFailed(nexus_host=nexus_host, exc=e)
|
||||||
|
|
||||||
return self.connections[nexus_host]
|
return self.connections[nexus_host]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user