Commit Graph

21 Commits

Author SHA1 Message Date
Brian Haley 55b16d7b7c Fix some pylint indentation warnings
Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
the ones in neutron/db.

Trivialfix

Change-Id: I9311cfe5efc51552008072d84aa238e5d0c9de60
2022-11-03 19:50:54 -04:00
Nate Johnston 2dc61dfbcc Utilize bulk port creation ops in ml2 plugin
Rather than iterating through all ports and leveraging the heavyweight
ml2 method, use a set of optimized functions that attempts to make bulk
port operations as speedy as possible.

The test test_bulk_ports_before_and_after_events_outside_of_txn is
deleted because with the change to using port OVO, the session will
not be closed, and it is not correct to check for it.

Change-Id: Ieea0e6074cd31a2d09ae92f1f3c8d375c6d8ecc2
Implements: blueprint speed-up-neutron-bulk-creation
2019-03-21 11:31:36 +00:00
Boden R 29f56478d1 remove the neutron.db._resource_extend module
The _resource_extend module is already rehomed into neutron-lib and is
shimmed in neutron. This patch removes the module as no active
consumers are using it.

NeutronLibImpact

Change-Id: I1550075fa5fa2aa2f1a88ee7189d311a1fe78391
2019-01-02 13:02:06 -07:00
Boden R e4aa5902f7 use context manager from neutron-lib
The neutron.db.api.context_manager already references neutron-lib's
context manager; so consumers of it are already using neutron-lib. This
patch switches neutron's references to the context_manager over to
use neutron-lib's directly rather than that in neutron.db.api.

NeutronLibImpact

Change-Id: I97120faeec73690592ed21a5ec3c6202f61e1429
2018-10-24 07:18:46 -06:00
Brian Haley 90cd939047 Fix W503 pep8 warnings
Fix W503 (line break before binary operator) pep8 warnings
and no longer ignore new failures.

Trivialfix

Change-Id: I7539f3b7187f2ad40681781f74b6e05a01bac474
2018-04-17 14:22:58 +00:00
Boden R 62576cabf7 use core resource attribute constants from neutron-lib
neutron-lib now contains the API definitions for neutron's core
resources. This patch removes the constant core resource and collection
variables and uses them from lib. Subsequent patches will consume the
actual core resource attribute definitions.

NeutronLibImpact

Change-Id: Ia9afdf620cd538b2aa420593277d6403a45c996b
2017-06-30 06:25:36 -06:00
Boden R 933b9fa57e use extra_dhcp_opt api-def from neutron-lib
neutron-lib 1.6.0 is out and among other things contains the rehomed
extra_dhcp_opt API definition. This patch switches usage of such
references from neutron to neutron-lib.

NeutronLibImpact

Change-Id: I8a400bc92b5958e5eab557bd7a2b27330754dcbf
2017-05-31 15:06:35 +00:00
Henry Gessau b3c0d5f239 Eliminate lookup of "resource extend" funcs by name
By registering functions directly we cut off the dependency of the
"resource extend" functions on the plugin. This is a step towards
the goal of removing the CommonDbMixin mixin class.

Also, we register all "resource extend" functions at plugin create
(in __new__) instead of in the class definition (which caused the
hooks to be registered on import). This ensures the "resource
extend" functions are only registered for the plugins/mixins that
are actually used.

Note that decorators are used to register "resource extend" methods,
similar to the callback receiver decorators.

Related-Blueprint: neutron-lib

Change-Id: I128cfda773d5f9597df9cd61261fdc05f2a174aa
2017-04-21 14:48:42 -04:00
Ann Kamyshnikova 8756cb7d99 New enginefacade for ports and sg groups
Use reader and writer for db operations.

Partially-Implements blueprint: enginefacade-switch

Depends-On: Iba3520ac6cfb6b82b2013df9b8e1aee64b10a11c

Change-Id: I50be115ea69f805b48b02aebe4259ec2c839830e
2017-04-10 07:40:43 +00:00
Henry Gessau e7cd868c20 Decouple hook and func registration from CommonDbMixin
Move the model query hook registration and resource extend funcs
registration methods out of the CommonDbMixin class and make them
regular utility functions.

This is a step in refactoring the CommonDbMixin class.

Change-Id: Iec1bb7f7098c83640ae695fd7cf2f4736f414ad2
2017-03-11 18:04:11 -05:00
Martin Hickey 7ed3cb2ca1 Integrate the Extra Dhcp Opt VersionedObject in Neutron
This patch is dependent on commit I45b54b80d994f7e7f06128f73256b94675db97b2
which introduces the Extra Dhcp Opt OVO.
This patch integrates the VersionedObject with the existing code.

Change-Id: I0e01831b2b869fbd1ef90bd72a5b63173f554e66
Partial-Bug: #1541928
2016-04-07 16:44:33 +01:00
Carl Baldwin bf2f1f1f87 Remove references to model_base through models_v2
I saw a patch set [1] that was running in to circular imports and
removing these.  I thought it'd be better to remove them all in one
shot.

[1] https://review.openstack.org/#/c/261222/1/neutron/db/agents_db.py

Change-Id: If1a9ba3091ac99f01f73b98a7459358c3efd4dd5
2016-01-06 16:12:29 -07:00
ChangBo Guo(gcb) 06174a41e4 Trival: Remove unused logging import
Change-Id: I13298e642f25c9f70dcff9b1e056b418edf0a461
2015-12-26 12:49:56 +08:00
David Edery 3837427189 Enable specific extra_dhcp_opt to be left blank
In some cases there is a need for a blank value of the "router" extra
dhcp option. This fix addresses this issue by introducing a simple
mechanism in the code that allows specific extra dhcp options to be left
blank by applying a different opt_value validation of the data received
from the REST call and different validation on the value that will be
written to the DB.

This fix also takes into consideration bug #1257467 which claims that
in case of a blank "server-ip-address" option a segmentation fault
occurs in dnsmasq. I did not check this claim with a newer dnsmasq
version since it seemed logical that the list of potentially blank
options should be limited to options that are known to work well when
blank and have functional justification for being blank (e.g. "router")

APIImpact
"router" and "classless-static-route" extra dhcp options can be blank
(e.g. opt-name="router", opt-value="")

DocImpact
During port creation/update, Specific extra-dhcp-options can be left
blank ("router" and/or "classless-static-route"). This causes dnsmasq
to have an empty option in the "opts" file related to the network to
which the port is related.
For example:
tag:tag0,option:classless-static-route,
tag:tag0,option:router,

Closes-Bug: #1437695
Related-Bug: #1257467

Change-Id: I0ac76e132c4bd86da39863674d4cf8a22dad7034
2015-10-15 14:16:17 +03:00
Ihar Hrachyshka 22328baf1f Migrate to oslo.log
It's mostly a matter of changing imports to a new location.

Non-obvious changes needed:
* pass overwrite= argument to oslo_context since oslo.log reads context
  from its thread local store and not local.store from incubator
* don't store context at local.store now that there is no code that
  would consume it
* LOG.deprecated() -> versionutils.report_deprecated_feature()
* dropped LOG.audit check from hacking rule since now the method does
  not exist
* WritableLogger is now located in oslo_log.loggers

Dropped log module from the tree. Also dropped local module that is now
of no use (and obsolete, as per oslo team).

Added versionutils back to openstack-common.conf since now we use the
module directly from neutron code and not just as a dependency of some
other oslo-incubator module.

Note: tempest tests are expected to be broken now, so instead of fixing
all the oslo.log related issues for the subtree in this patch, I only
added TODOs with directions for later fix.

Closes-Bug: #1425013
Change-Id: I310e059a815377579de6bb2aa204de168e72571e
2015-03-12 11:22:56 +01:00
Xu Han Peng a42928780c Support Extra DHCP Options for IPv4 and IPv6
Add API and DB change for Blueprint extra-dhcp-opts-ipv4-ipv6.
Add unit tests for this change.

The validation of input extra dhcp options is not included
in this commit. A follow-up commit will be added for
validation.

DocImpact
APIImpact

Change-Id: I346334568929e50e51dd577cde6a257f4bce8e77
Partially-implements: Blueprint extra-dhcp-opts-ipv4-ipv6
2015-01-29 18:07:09 +08:00
Gary Kotton 7edf58495e Remove @author(s) from copyright statements
We have git to track authorship, so let's not pad source files
with it as well.

A hacking check has been added for this. The value is N322.

Change-Id: Iab0b64d417e0bb41a6b455e2ac377deee64ec3ee
2014-09-15 21:40:09 +09:00
Darren Birkett 72e37ddcd0 Correctly inherit __table_args__ from parent class
Where unique constraints are added to certain tables by populating
__table_args__, we need to ensure we inherit the top level
__table_args__ that define the default storage engine to use when
creating tables.

Change-Id: Ib886b84922830b60282b4f882591e43f5041e713
Fixes: bug 1288358
2014-03-17 13:37:46 +00:00
dekehn 77aee9e715 Adds delete of a extra_dhcp_opt on a port
Add support for delete of extra_dhcp_opt(s) on a port. Where
[{'opt_name': 'opt_to_delete', 'opt_value': None}].

Closes-Bug: #1228008

Change-Id: I75baeff91575cac6546fe2cc6fcf7a0d8e92853f
2013-11-14 14:36:01 -07:00
Salvatore Orlando a07bbac1c4 Allow subclasses to modify dict_extend hooks
Partial-Bug 1219991

This change modifies the hook processing for dict_extend routines
to call the method on the instance if a hook is registered as a string.
Otherwise, the callable hook is directly invoked as an unbound method.

This patch fixes hook registration for all extensions except port_binding.
This is because some plugins are currently working around this limitation
by invoking both the global hook and another dict_extend function,
which might either be registered as another hook, or invoked explicitly
before returning the response.
Fixing this would go beyong the scope of this patch.

Change-Id: Ibe78433e6554aa7fdf5156fc75b8339254876e78
2013-09-02 17:37:22 -07:00
dekehn d91bc54749 bp: pxeboot-port, provide pxeboot on ports
Teach neutron how to manage PXE boot.

Allow pxe boot parameters to be specified when creating a network port.

Implements bp:pxeboot-ports

Change-Id: I45fe7a16bc6c5975a765dd6a065558b9ba702e5b
2013-08-31 10:40:56 -06:00