Improve error message when flat network already exists
Fixes bug 1045601. When attempting to create a flat network on a physical_network on which a flat network is already allocated, the openvswitch and linuxbridge plugins return a FlatNetworkInUse exception rather than a VlanIdInUse exception referencing VLAN -1. Change-Id: Id79e917e1376ebbb199efc3f14d9f378c6a04050
This commit is contained in:
parent
b750bbafc3
commit
6159400e1a
@ -127,6 +127,11 @@ class VlanIdInUse(InUse):
|
|||||||
"%(physical_network)s is in use.")
|
"%(physical_network)s is in use.")
|
||||||
|
|
||||||
|
|
||||||
|
class FlatNetworkInUse(InUse):
|
||||||
|
message = _("Unable to create the flat network. "
|
||||||
|
"Physical network %(physical_network)s is in use.")
|
||||||
|
|
||||||
|
|
||||||
class TunnelIdInUse(InUse):
|
class TunnelIdInUse(InUse):
|
||||||
message = _("Unable to create the network. "
|
message = _("Unable to create the network. "
|
||||||
"The tunnel ID %(tunnel_id)s is in use.")
|
"The tunnel ID %(tunnel_id)s is in use.")
|
||||||
|
@ -17,12 +17,12 @@ import logging
|
|||||||
|
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
|
|
||||||
from quantum.common import constants
|
|
||||||
from quantum.common import exceptions as q_exc
|
from quantum.common import exceptions as q_exc
|
||||||
import quantum.db.api as db
|
import quantum.db.api as db
|
||||||
from quantum.db import models_v2
|
from quantum.db import models_v2
|
||||||
from quantum.openstack.common import cfg
|
from quantum.openstack.common import cfg
|
||||||
from quantum.plugins.linuxbridge.common import config
|
from quantum.plugins.linuxbridge.common import config
|
||||||
|
from quantum.plugins.linuxbridge.common import constants
|
||||||
from quantum.plugins.linuxbridge.db import l2network_models_v2
|
from quantum.plugins.linuxbridge.db import l2network_models_v2
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -113,6 +113,10 @@ def reserve_specific_network(session, physical_network, vlan_id):
|
|||||||
vlan_id=vlan_id).
|
vlan_id=vlan_id).
|
||||||
one())
|
one())
|
||||||
if state.allocated:
|
if state.allocated:
|
||||||
|
if vlan_id == constants.FLAT_VLAN_ID:
|
||||||
|
raise q_exc.FlatNetworkInUse(physical_network=
|
||||||
|
physical_network)
|
||||||
|
else:
|
||||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||||
physical_network=physical_network)
|
physical_network=physical_network)
|
||||||
LOG.debug("reserving specific vlan %s on physical network %s "
|
LOG.debug("reserving specific vlan %s on physical network %s "
|
||||||
|
@ -20,11 +20,11 @@ import logging
|
|||||||
|
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
|
|
||||||
from quantum.common import constants
|
|
||||||
from quantum.common import exceptions as q_exc
|
from quantum.common import exceptions as q_exc
|
||||||
from quantum.db import models_v2
|
from quantum.db import models_v2
|
||||||
import quantum.db.api as db
|
import quantum.db.api as db
|
||||||
from quantum.openstack.common import cfg
|
from quantum.openstack.common import cfg
|
||||||
|
from quantum.plugins.openvswitch.common import constants
|
||||||
from quantum.plugins.openvswitch import ovs_models_v2
|
from quantum.plugins.openvswitch import ovs_models_v2
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -132,6 +132,10 @@ def reserve_specific_vlan(session, physical_network, vlan_id):
|
|||||||
vlan_id=vlan_id).
|
vlan_id=vlan_id).
|
||||||
one())
|
one())
|
||||||
if alloc.allocated:
|
if alloc.allocated:
|
||||||
|
if vlan_id == constants.FLAT_VLAN_ID:
|
||||||
|
raise q_exc.FlatNetworkInUse(physical_network=
|
||||||
|
physical_network)
|
||||||
|
else:
|
||||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||||
physical_network=physical_network)
|
physical_network=physical_network)
|
||||||
LOG.debug("reserving specific vlan %s on physical network %s "
|
LOG.debug("reserving specific vlan %s on physical network %s "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user