raise Exception instead of LOG.error on cookie/mask inconsistency

Follow up to a comment by kevinbenton on
Idd0531cedda87224531cb8fb6a912ccd0f1554d5 .

The rationale is that one should never call delete a flow
with cookie=ANY_COOKIE and give a cookie_mask at the same time.

Change-Id: I20a03cb04f1bd3eb7a851e5458e2c662cfa3b132
This commit is contained in:
Thomas Morin 2017-03-28 08:46:38 -05:00
parent 9364f58ec5
commit 7fbdf77706
2 changed files with 5 additions and 5 deletions

View File

@ -345,8 +345,8 @@ class OVSBridge(BaseOVS):
# cookie to match flows whatever their cookie is
kw.pop('cookie')
if kw.get('cookie_mask'): # non-zero cookie mask
LOG.error(_LE("cookie=COOKIE_ANY but cookie_mask set "
"to %s"), kw.get('cookie_mask'))
raise Exception("cookie=COOKIE_ANY but cookie_mask "
"set to %s" % kw.get('cookie_mask'))
elif 'cookie' in kw:
# a cookie was specified, use it
kw['cookie'] = check_cookie_mask(kw['cookie'])

View File

@ -23,7 +23,7 @@ from oslo_utils import timeutils
import ryu.app.ofctl.api as ofctl_api
import ryu.exception as ryu_exc
from neutron._i18n import _, _LW, _LE
from neutron._i18n import _, _LW
from neutron.agent.common import ovs_lib
LOG = logging.getLogger(__name__)
@ -112,8 +112,8 @@ class OpenFlowSwitchMixin(object):
if cookie == ovs_lib.COOKIE_ANY:
cookie = 0
if cookie_mask != 0:
LOG.error(_LE("cookie=COOKIE_ANY but cookie_mask set to %s"),
cookie_mask)
raise Exception("cookie=COOKIE_ANY but cookie_mask set to %s" %
cookie_mask)
elif cookie == COOKIE_DEFAULT:
cookie = self._default_cookie
cookie_mask = ovs_lib.UINT64_BITMASK