Merge "Fixes i18n message for nec plugin"
This commit is contained in:
commit
2a10cd2b6c
@ -60,8 +60,9 @@ class NECQuantumAgent(object):
|
|||||||
|
|
||||||
def update_ports(self, port_added=[], port_removed=[]):
|
def update_ports(self, port_added=[], port_removed=[]):
|
||||||
"""RPC to update information of ports on Quantum Server"""
|
"""RPC to update information of ports on Quantum Server"""
|
||||||
LOG.info("update ports: added=%s, removed=%s" %
|
LOG.info(_("Update ports: added=%(port_added)s, "
|
||||||
(port_added, port_removed))
|
"removed=%(port_removed)s"),
|
||||||
|
locals())
|
||||||
try:
|
try:
|
||||||
rpc.call(self.context,
|
rpc.call(self.context,
|
||||||
topics.PLUGIN,
|
topics.PLUGIN,
|
||||||
@ -72,7 +73,7 @@ class NECQuantumAgent(object):
|
|||||||
'port_added': port_added,
|
'port_added': port_added,
|
||||||
'port_removed': port_removed}})
|
'port_removed': port_removed}})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.warn("update_ports() failed.")
|
LOG.warn(_("update_ports() failed."))
|
||||||
return
|
return
|
||||||
|
|
||||||
def _vif_port_to_port_info(self, vif_port):
|
def _vif_port_to_port_info(self, vif_port):
|
||||||
@ -101,7 +102,7 @@ class NECQuantumAgent(object):
|
|||||||
if port_added or port_removed:
|
if port_added or port_removed:
|
||||||
self.update_ports(port_added, port_removed)
|
self.update_ports(port_added, port_removed)
|
||||||
else:
|
else:
|
||||||
LOG.debug("No port changed.")
|
LOG.debug(_("No port changed."))
|
||||||
|
|
||||||
old_ports = new_ports
|
old_ports = new_ports
|
||||||
time.sleep(self.polling_interval)
|
time.sleep(self.polling_interval)
|
||||||
|
@ -26,19 +26,19 @@ database_opts = [
|
|||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
cfg.IntOpt('sql_min_pool_size',
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
default=1,
|
default=1,
|
||||||
help="Minimum number of SQL connections to keep open in a "
|
help=_("Minimum number of SQL connections to keep open in a "
|
||||||
"pool"),
|
"pool")),
|
||||||
cfg.IntOpt('sql_max_pool_size',
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
default=5,
|
default=5,
|
||||||
help="Maximum number of SQL connections to keep open in a "
|
help=_("Maximum number of SQL connections to keep open in a "
|
||||||
"pool"),
|
"pool")),
|
||||||
cfg.IntOpt('sql_idle_timeout',
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
default=3600,
|
default=3600,
|
||||||
help="Timeout in seconds before idle sql connections are "
|
help=_("Timeout in seconds before idle sql connections are "
|
||||||
"reaped"),
|
"reaped")),
|
||||||
cfg.BoolOpt('sql_dbpool_enable',
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
default=False,
|
default=False,
|
||||||
help="Enable the use of eventlet's db_pool for MySQL"),
|
help=_("Enable the use of eventlet's db_pool for MySQL")),
|
||||||
]
|
]
|
||||||
|
|
||||||
ovs_opts = [
|
ovs_opts = [
|
||||||
|
@ -54,7 +54,8 @@ class OFCClient(object):
|
|||||||
return httplib.HTTPConnection
|
return httplib.HTTPConnection
|
||||||
|
|
||||||
def do_request(self, method, action, body=None):
|
def do_request(self, method, action, body=None):
|
||||||
LOG.debug("Client request: %s %s [%s]" % (method, action, str(body)))
|
LOG.debug(_("Client request: %(method)s %(action)s [%(body)s]"),
|
||||||
|
locals())
|
||||||
|
|
||||||
if type(body) is dict:
|
if type(body) is dict:
|
||||||
body = json.dumps(body)
|
body = json.dumps(body)
|
||||||
@ -71,7 +72,9 @@ class OFCClient(object):
|
|||||||
conn.request(method, action, body, headers)
|
conn.request(method, action, body, headers)
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
data = res.read()
|
data = res.read()
|
||||||
LOG.debug("OFC returns [%s:%s]" % (str(res.status), data))
|
LOG.debug(_("OFC returns [%(status)s:%(data)s]"),
|
||||||
|
{'status': res.status,
|
||||||
|
'data': data})
|
||||||
if res.status in (httplib.OK,
|
if res.status in (httplib.OK,
|
||||||
httplib.CREATED,
|
httplib.CREATED,
|
||||||
httplib.ACCEPTED,
|
httplib.ACCEPTED,
|
||||||
@ -82,7 +85,7 @@ class OFCClient(object):
|
|||||||
reason = _("An operation on OFC is failed.")
|
reason = _("An operation on OFC is failed.")
|
||||||
raise nexc.OFCException(reason=reason)
|
raise nexc.OFCException(reason=reason)
|
||||||
except (socket.error, IOError), e:
|
except (socket.error, IOError), e:
|
||||||
reason = _("Failed to connect OFC : %s" % str(e))
|
reason = _("Failed to connect OFC : %s") % str(e)
|
||||||
LOG.error(reason)
|
LOG.error(reason)
|
||||||
raise nexc.OFCException(reason=reason)
|
raise nexc.OFCException(reason=reason)
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ def del_ofc_item(model, id):
|
|||||||
session.delete(item)
|
session.delete(item)
|
||||||
session.flush()
|
session.flush()
|
||||||
except sa.orm.exc.NoResultFound:
|
except sa.orm.exc.NoResultFound:
|
||||||
LOG.warning("_del_ofc_item(): NotFound item "
|
LOG.warning(_("_del_ofc_item(): NotFound item "
|
||||||
"(model=%s, id=%s) " % (model, id))
|
"(model=%(model)s, id=%(id)s) "), locals())
|
||||||
|
|
||||||
|
|
||||||
def get_portinfo(id):
|
def get_portinfo(id):
|
||||||
@ -122,5 +122,5 @@ def del_portinfo(id):
|
|||||||
session.delete(portinfo)
|
session.delete(portinfo)
|
||||||
session.flush()
|
session.flush()
|
||||||
except sa.orm.exc.NoResultFound:
|
except sa.orm.exc.NoResultFound:
|
||||||
LOG.warning("del_portinfo(): NotFound portinfo for "
|
LOG.warning(_("del_portinfo(): NotFound portinfo for "
|
||||||
"port_id: %s" % id)
|
"port_id: %s"), id)
|
||||||
|
@ -57,7 +57,7 @@ class NECPluginV2Base(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
raise q_exc.PacketFilterNotFound(id=id)
|
raise q_exc.PacketFilterNotFound(id=id)
|
||||||
except exc.MultipleResultsFound:
|
except exc.MultipleResultsFound:
|
||||||
LOG.error('Multiple packet_filters match for %s' % id)
|
LOG.error(_('Multiple packet_filters match for %s'), id)
|
||||||
raise q_exc.PacketFilterNotFound(id=id)
|
raise q_exc.PacketFilterNotFound(id=id)
|
||||||
return packet_filter
|
return packet_filter
|
||||||
|
|
||||||
|
@ -30,6 +30,6 @@ DRIVER_LIST = {
|
|||||||
|
|
||||||
|
|
||||||
def get_driver(driver_name):
|
def get_driver(driver_name):
|
||||||
LOG.info("Loading OFC driver: %s" % driver_name)
|
LOG.info(_("Loading OFC driver: %s"), driver_name)
|
||||||
driver_klass = DRIVER_LIST.get(driver_name) or driver_name
|
driver_klass = DRIVER_LIST.get(driver_name) or driver_name
|
||||||
return importutils.import_class(driver_klass)
|
return importutils.import_class(driver_klass)
|
||||||
|
@ -26,8 +26,8 @@ from quantum import quota
|
|||||||
quota_packet_filter_opts = [
|
quota_packet_filter_opts = [
|
||||||
cfg.IntOpt('quota_packet_filter',
|
cfg.IntOpt('quota_packet_filter',
|
||||||
default=100,
|
default=100,
|
||||||
help="number of packet_filters allowed per tenant, "
|
help=_("Number of packet_filters allowed per tenant, "
|
||||||
"-1 for unlimited")
|
"-1 for unlimited"))
|
||||||
]
|
]
|
||||||
# Register the configuration options
|
# Register the configuration options
|
||||||
cfg.CONF.register_opts(quota_packet_filter_opts, 'QUOTAS')
|
cfg.CONF.register_opts(quota_packet_filter_opts, 'QUOTAS')
|
||||||
|
@ -101,16 +101,16 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
port_status = OperationalStatus.ACTIVE
|
port_status = OperationalStatus.ACTIVE
|
||||||
if not port['admin_state_up']:
|
if not port['admin_state_up']:
|
||||||
LOG.debug("activate_port_if_ready(): skip, "
|
LOG.debug(_("activate_port_if_ready(): skip, "
|
||||||
"port.admin_state_up is False.")
|
"port.admin_state_up is False."))
|
||||||
port_status = OperationalStatus.DOWN
|
port_status = OperationalStatus.DOWN
|
||||||
elif not network['admin_state_up']:
|
elif not network['admin_state_up']:
|
||||||
LOG.debug("activate_port_if_ready(): skip, "
|
LOG.debug(_("activate_port_if_ready(): skip, "
|
||||||
"network.admin_state_up is False.")
|
"network.admin_state_up is False."))
|
||||||
port_status = OperationalStatus.DOWN
|
port_status = OperationalStatus.DOWN
|
||||||
elif not ndb.get_portinfo(port['id']):
|
elif not ndb.get_portinfo(port['id']):
|
||||||
LOG.debug("activate_port_if_ready(): skip, "
|
LOG.debug(_("activate_port_if_ready(): skip, "
|
||||||
"no portinfo for this port.")
|
"no portinfo for this port."))
|
||||||
port_status = OperationalStatus.DOWN
|
port_status = OperationalStatus.DOWN
|
||||||
|
|
||||||
# activate packet_filters before creating port on OFC.
|
# activate packet_filters before creating port on OFC.
|
||||||
@ -128,15 +128,15 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
if port_status in [OperationalStatus.ACTIVE]:
|
if port_status in [OperationalStatus.ACTIVE]:
|
||||||
if self.ofc.exists_ofc_port(port['id']):
|
if self.ofc.exists_ofc_port(port['id']):
|
||||||
LOG.debug("activate_port_if_ready(): skip, "
|
LOG.debug(_("activate_port_if_ready(): skip, "
|
||||||
"ofc_port already exists.")
|
"ofc_port already exists."))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.ofc.create_ofc_port(port['tenant_id'],
|
self.ofc.create_ofc_port(port['tenant_id'],
|
||||||
port['network_id'],
|
port['network_id'],
|
||||||
port['id'])
|
port['id'])
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = "create_ofc_port() failed due to %s" % exc
|
reason = _("create_ofc_port() failed due to %s") % exc
|
||||||
LOG.error(reason)
|
LOG.error(reason)
|
||||||
port_status = OperationalStatus.ERROR
|
port_status = OperationalStatus.ERROR
|
||||||
|
|
||||||
@ -156,12 +156,12 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
port['network_id'],
|
port['network_id'],
|
||||||
port['id'])
|
port['id'])
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = "delete_ofc_port() failed due to %s" % exc
|
reason = _("delete_ofc_port() failed due to %s") % exc
|
||||||
LOG.error(reason)
|
LOG.error(reason)
|
||||||
port_status = OperationalStatus.ERROR
|
port_status = OperationalStatus.ERROR
|
||||||
else:
|
else:
|
||||||
LOG.debug("deactivate_port(): skip, ofc_port does not "
|
LOG.debug(_("deactivate_port(): skip, ofc_port does not "
|
||||||
"exist.")
|
"exist."))
|
||||||
|
|
||||||
if port_status is not port['status']:
|
if port_status is not port['status']:
|
||||||
self._update_resource_status(context, "port", port['id'],
|
self._update_resource_status(context, "port", port['id'],
|
||||||
@ -180,8 +180,8 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
def create_network(self, context, network):
|
def create_network(self, context, network):
|
||||||
"""Create a new network entry on DB, and create it on OFC."""
|
"""Create a new network entry on DB, and create it on OFC."""
|
||||||
LOG.debug("NECPluginV2.create_network() called, "
|
LOG.debug(_("NECPluginV2.create_network() called, "
|
||||||
"network=%s ." % network)
|
"network=%s ."), network)
|
||||||
session = context.session
|
session = context.session
|
||||||
with session.begin(subtransactions=True):
|
with session.begin(subtransactions=True):
|
||||||
new_net = super(NECPluginV2, self).create_network(context, network)
|
new_net = super(NECPluginV2, self).create_network(context, network)
|
||||||
@ -196,7 +196,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
self.ofc.create_ofc_network(new_net['tenant_id'], new_net['id'],
|
self.ofc.create_ofc_network(new_net['tenant_id'], new_net['id'],
|
||||||
new_net['name'])
|
new_net['name'])
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = "create_network() failed due to %s" % exc
|
reason = _("create_network() failed due to %s") % exc
|
||||||
LOG.error(reason)
|
LOG.error(reason)
|
||||||
self._update_resource_status(context, "network", new_net['id'],
|
self._update_resource_status(context, "network", new_net['id'],
|
||||||
OperationalStatus.ERROR)
|
OperationalStatus.ERROR)
|
||||||
@ -212,8 +212,8 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
Update network entry on DB. If 'admin_state_up' was changed, activate
|
Update network entry on DB. If 'admin_state_up' was changed, activate
|
||||||
or deactivate ports and packetfilters associated with the network.
|
or deactivate ports and packetfilters associated with the network.
|
||||||
"""
|
"""
|
||||||
LOG.debug("NECPluginV2.update_network() called, "
|
LOG.debug(_("NECPluginV2.update_network() called, "
|
||||||
"id=%s network=%s ." % (id, network))
|
"id=%(id)s network=%(network)s ."), locals())
|
||||||
session = context.session
|
session = context.session
|
||||||
with session.begin(subtransactions=True):
|
with session.begin(subtransactions=True):
|
||||||
old_net = super(NECPluginV2, self).get_network(context, id)
|
old_net = super(NECPluginV2, self).get_network(context, id)
|
||||||
@ -262,7 +262,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
associated with the network. If the network is the last resource
|
associated with the network. If the network is the last resource
|
||||||
of the tenant, delete unnessary ofc_tenant.
|
of the tenant, delete unnessary ofc_tenant.
|
||||||
"""
|
"""
|
||||||
LOG.debug("NECPluginV2.delete_network() called, id=%s .", id)
|
LOG.debug(_("NECPluginV2.delete_network() called, id=%s ."), id)
|
||||||
net = super(NECPluginV2, self).get_network(context, id)
|
net = super(NECPluginV2, self).get_network(context, id)
|
||||||
tenant_id = net['tenant_id']
|
tenant_id = net['tenant_id']
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
try:
|
try:
|
||||||
self.ofc.delete_ofc_network(tenant_id, id)
|
self.ofc.delete_ofc_network(tenant_id, id)
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = "delete_network() failed due to %s" % exc
|
reason = _("delete_network() failed due to %s") % exc
|
||||||
# NOTE: The OFC configuration of this network could be remained
|
# NOTE: The OFC configuration of this network could be remained
|
||||||
# as an orphan resource. But, it does NOT harm any other
|
# as an orphan resource. But, it does NOT harm any other
|
||||||
# resources, so this plugin just warns.
|
# resources, so this plugin just warns.
|
||||||
@ -294,7 +294,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
try:
|
try:
|
||||||
self.ofc.delete_ofc_tenant(tenant_id)
|
self.ofc.delete_ofc_tenant(tenant_id)
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = "delete_ofc_tenant() failed due to %s" % exc
|
reason = _("delete_ofc_tenant() failed due to %s") % exc
|
||||||
LOG.warn(reason)
|
LOG.warn(reason)
|
||||||
|
|
||||||
def get_network(self, context, id, fields=None):
|
def get_network(self, context, id, fields=None):
|
||||||
@ -311,7 +311,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
def create_port(self, context, port):
|
def create_port(self, context, port):
|
||||||
"""Create a new port entry on DB, then try to activate it."""
|
"""Create a new port entry on DB, then try to activate it."""
|
||||||
LOG.debug("NECPluginV2.create_port() called, port=%s ." % port)
|
LOG.debug(_("NECPluginV2.create_port() called, port=%s ."), port)
|
||||||
new_port = super(NECPluginV2, self).create_port(context, port)
|
new_port = super(NECPluginV2, self).create_port(context, port)
|
||||||
self._update_resource_status(context, "port", new_port['id'],
|
self._update_resource_status(context, "port", new_port['id'],
|
||||||
OperationalStatus.BUILD)
|
OperationalStatus.BUILD)
|
||||||
@ -326,8 +326,8 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
Update network entry on DB. If admin_state_up was changed, activate
|
Update network entry on DB. If admin_state_up was changed, activate
|
||||||
or deactivate the port and packetfilters associated with it.
|
or deactivate the port and packetfilters associated with it.
|
||||||
"""
|
"""
|
||||||
LOG.debug("NECPluginV2.update_port() called, "
|
LOG.debug(_("NECPluginV2.update_port() called, "
|
||||||
"id=%s port=%s ." % (id, port))
|
"id=%(id)s port=%(port)s ."), locals())
|
||||||
old_port = super(NECPluginV2, self).get_port(context, id)
|
old_port = super(NECPluginV2, self).get_port(context, id)
|
||||||
new_port = super(NECPluginV2, self).update_port(context, id, port)
|
new_port = super(NECPluginV2, self).update_port(context, id, port)
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
def delete_port(self, context, id, l3_port_check=True):
|
def delete_port(self, context, id, l3_port_check=True):
|
||||||
"""Delete port and packet_filters associated with the port."""
|
"""Delete port and packet_filters associated with the port."""
|
||||||
LOG.debug("NECPluginV2.delete_port() called, id=%s ." % id)
|
LOG.debug(_("NECPluginV2.delete_port() called, id=%s ."), id)
|
||||||
port = super(NECPluginV2, self).get_port(context, id)
|
port = super(NECPluginV2, self).get_port(context, id)
|
||||||
|
|
||||||
self.deactivate_port(context, port)
|
self.deactivate_port(context, port)
|
||||||
@ -383,26 +383,26 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
pf_status = OperationalStatus.ACTIVE
|
pf_status = OperationalStatus.ACTIVE
|
||||||
if not packet_filter['admin_state_up']:
|
if not packet_filter['admin_state_up']:
|
||||||
LOG.debug("_activate_packet_filter_if_ready(): skip, "
|
LOG.debug(_("_activate_packet_filter_if_ready(): skip, "
|
||||||
"packet_filter.admin_state_up is False.")
|
"packet_filter.admin_state_up is False."))
|
||||||
pf_status = OperationalStatus.DOWN
|
pf_status = OperationalStatus.DOWN
|
||||||
elif not network['admin_state_up']:
|
elif not network['admin_state_up']:
|
||||||
LOG.debug("_activate_packet_filter_if_ready(): skip, "
|
LOG.debug(_("_activate_packet_filter_if_ready(): skip, "
|
||||||
"network.admin_state_up is False.")
|
"network.admin_state_up is False."))
|
||||||
pf_status = OperationalStatus.DOWN
|
pf_status = OperationalStatus.DOWN
|
||||||
elif in_port_id and in_port_id is in_port.get('id'):
|
elif in_port_id and in_port_id is in_port.get('id'):
|
||||||
LOG.debug("_activate_packet_filter_if_ready(): skip, "
|
LOG.debug(_("_activate_packet_filter_if_ready(): skip, "
|
||||||
"invalid in_port_id.")
|
"invalid in_port_id."))
|
||||||
pf_status = OperationalStatus.DOWN
|
pf_status = OperationalStatus.DOWN
|
||||||
elif in_port_id and not ndb.get_portinfo(in_port_id):
|
elif in_port_id and not ndb.get_portinfo(in_port_id):
|
||||||
LOG.debug("_activate_packet_filter_if_ready(): skip, "
|
LOG.debug(_("_activate_packet_filter_if_ready(): skip, "
|
||||||
"no portinfo for in_port.")
|
"no portinfo for in_port."))
|
||||||
pf_status = OperationalStatus.DOWN
|
pf_status = OperationalStatus.DOWN
|
||||||
|
|
||||||
if pf_status in [OperationalStatus.ACTIVE]:
|
if pf_status in [OperationalStatus.ACTIVE]:
|
||||||
if self.ofc.exists_ofc_packet_filter(packet_filter['id']):
|
if self.ofc.exists_ofc_packet_filter(packet_filter['id']):
|
||||||
LOG.debug("_activate_packet_filter_if_ready(): skip, "
|
LOG.debug(_("_activate_packet_filter_if_ready(): skip, "
|
||||||
"ofc_packet_filter already exists.")
|
"ofc_packet_filter already exists."))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
(self.ofc.
|
(self.ofc.
|
||||||
@ -411,8 +411,8 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
packet_filter['id'],
|
packet_filter['id'],
|
||||||
packet_filter))
|
packet_filter))
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = ("create_ofc_packet_filter() failed due to "
|
reason = _("create_ofc_packet_filter() failed due to "
|
||||||
"%s" % exc)
|
"%s") % exc
|
||||||
LOG.error(reason)
|
LOG.error(reason)
|
||||||
pf_status = OperationalStatus.ERROR
|
pf_status = OperationalStatus.ERROR
|
||||||
|
|
||||||
@ -424,16 +424,16 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
"""Deactivate packet_filter by deleting filter from OFC if exixts."""
|
"""Deactivate packet_filter by deleting filter from OFC if exixts."""
|
||||||
pf_status = OperationalStatus.DOWN
|
pf_status = OperationalStatus.DOWN
|
||||||
if not self.ofc.exists_ofc_packet_filter(packet_filter['id']):
|
if not self.ofc.exists_ofc_packet_filter(packet_filter['id']):
|
||||||
LOG.debug("_deactivate_packet_filter(): skip, "
|
LOG.debug(_("_deactivate_packet_filter(): skip, "
|
||||||
"ofc_packet_filter does not exist.")
|
"ofc_packet_filter does not exist."))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.ofc.delete_ofc_packet_filter(packet_filter['tenant_id'],
|
self.ofc.delete_ofc_packet_filter(packet_filter['tenant_id'],
|
||||||
packet_filter['network_id'],
|
packet_filter['network_id'],
|
||||||
packet_filter['id'])
|
packet_filter['id'])
|
||||||
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
|
||||||
reason = ("delete_ofc_packet_filter() failed due to "
|
reason = _("delete_ofc_packet_filter() failed due to "
|
||||||
"%s" % exc)
|
"%s") % exc
|
||||||
LOG.error(reason)
|
LOG.error(reason)
|
||||||
pf_status = OperationalStatus.ERROR
|
pf_status = OperationalStatus.ERROR
|
||||||
|
|
||||||
@ -443,8 +443,8 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
def create_packet_filter(self, context, packet_filter):
|
def create_packet_filter(self, context, packet_filter):
|
||||||
"""Create a new packet_filter entry on DB, then try to activate it."""
|
"""Create a new packet_filter entry on DB, then try to activate it."""
|
||||||
LOG.debug("NECPluginV2.create_packet_filter() called, "
|
LOG.debug(_("NECPluginV2.create_packet_filter() called, "
|
||||||
"packet_filter=%s ." % packet_filter)
|
"packet_filter=%s ."), packet_filter)
|
||||||
new_pf = super(NECPluginV2, self).create_packet_filter(context,
|
new_pf = super(NECPluginV2, self).create_packet_filter(context,
|
||||||
packet_filter)
|
packet_filter)
|
||||||
self._update_resource_status(context, "packet_filter", new_pf['id'],
|
self._update_resource_status(context, "packet_filter", new_pf['id'],
|
||||||
@ -459,8 +459,9 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
If any rule of the packet_filter was changed, recreate it on OFC.
|
If any rule of the packet_filter was changed, recreate it on OFC.
|
||||||
"""
|
"""
|
||||||
LOG.debug("NECPluginV2.update_packet_filter() called, "
|
LOG.debug(_("NECPluginV2.update_packet_filter() called, "
|
||||||
"id=%s packet_filter=%s ." % (id, packet_filter))
|
"id=%(id)s packet_filter=%(packet_filter)s ."),
|
||||||
|
locals())
|
||||||
old_pf = super(NECPluginV2, self).get_packet_filter(context, id)
|
old_pf = super(NECPluginV2, self).get_packet_filter(context, id)
|
||||||
new_pf = super(NECPluginV2, self).update_packet_filter(context, id,
|
new_pf = super(NECPluginV2, self).update_packet_filter(context, id,
|
||||||
packet_filter)
|
packet_filter)
|
||||||
@ -481,7 +482,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
|
|||||||
|
|
||||||
def delete_packet_filter(self, context, id):
|
def delete_packet_filter(self, context, id):
|
||||||
"""Deactivate and delete packet_filter."""
|
"""Deactivate and delete packet_filter."""
|
||||||
LOG.debug("NECPluginV2.delete_packet_filter() called, id=%s ." % id)
|
LOG.debug(_("NECPluginV2.delete_packet_filter() called, id=%s ."), id)
|
||||||
pf = super(NECPluginV2, self).get_packet_filter(context, id)
|
pf = super(NECPluginV2, self).get_packet_filter(context, id)
|
||||||
self._deactivate_packet_filter(context, pf)
|
self._deactivate_packet_filter(context, pf)
|
||||||
|
|
||||||
@ -514,8 +515,8 @@ class NECPluginV2RPCCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
|
|||||||
'port_added': [<new PortInfo>,...],
|
'port_added': [<new PortInfo>,...],
|
||||||
'port_removed': [<removed Port ID>,...]}
|
'port_removed': [<removed Port ID>,...]}
|
||||||
"""
|
"""
|
||||||
LOG.debug("NECPluginV2RPCCallbacks.update_ports() called, "
|
LOG.debug(_("NECPluginV2RPCCallbacks.update_ports() called, "
|
||||||
"kwargs=%s ." % kwargs)
|
"kwargs=%s ."), kwargs)
|
||||||
topic = kwargs['topic']
|
topic = kwargs['topic']
|
||||||
datapath_id = kwargs['datapath_id']
|
datapath_id = kwargs['datapath_id']
|
||||||
for p in kwargs.get('port_added', []):
|
for p in kwargs.get('port_added', []):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user