~ubuntu-branches/ubuntu/vivid/neutron/vivid-updates

« back to all changes in this revision

Viewing changes to neutron/db/api.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-03-30 11:17:19 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150330111719-h0gx7233p4jkkgfh
Tags: 1:2015.1~b3-0ubuntu1
* New upstream milestone release:
  - d/control: Align version requirements with upstream.
  - d/control: Add new dependency on oslo-log.
  - d/p/*: Rebase.
  - d/control,d/neutron-plugin-hyperv*: Dropped, decomposed into
    separate project upstream.
  - d/control,d/neutron-plugin-openflow*: Dropped, decomposed into
    separate project upstream.
  - d/neutron-common.install: Add neutron-rootwrap-daemon and 
    neutron-keepalived-state-change binaries.
  - d/rules: Ignore neutron-hyperv-agent when installing; only for Windows.
  - d/neutron-plugin-cisco.install: Drop neutron-cisco-cfg-agent as
    decomposed into separate project upstream.
  - d/neutron-plugin-vmware.install: Drop neutron-check-nsx-config and
    neutron-nsx-manage as decomposed into separate project upstream.
  - d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent.
* d/pydist-overrides: Add overrides for oslo packages.
* d/control: Fixup type in package description (LP: #1263539).
* d/p/fixup-driver-test-execution.patch: Cherry pick fix from upstream VCS
  to support unit test exection in out-of-tree vendor drivers.
* d/neutron-common.postinst: Allow general access to /etc/neutron but limit
  access to root/neutron to /etc/neutron/neutron.conf to support execution
  of unit tests in decomposed vendor drivers.
* d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#    License for the specific language governing permissions and limitations
14
14
#    under the License.
15
15
 
16
 
from oslo.config import cfg
17
 
from oslo.db.sqlalchemy import session
 
16
import contextlib
 
17
 
 
18
from oslo_config import cfg
 
19
from oslo_db.sqlalchemy import session
 
20
from sqlalchemy import exc
 
21
 
18
22
 
19
23
_FACADE = None
20
24
 
 
25
MAX_RETRIES = 10
 
26
 
21
27
 
22
28
def _create_facade_lazily():
23
29
    global _FACADE
39
45
    facade = _create_facade_lazily()
40
46
    return facade.get_session(autocommit=autocommit,
41
47
                              expire_on_commit=expire_on_commit)
 
48
 
 
49
 
 
50
@contextlib.contextmanager
 
51
def autonested_transaction(sess):
 
52
    """This is a convenience method to not bother with 'nested' parameter."""
 
53
    try:
 
54
        session_context = sess.begin_nested()
 
55
    except exc.InvalidRequestError:
 
56
        session_context = sess.begin(subtransactions=True)
 
57
    finally:
 
58
        with session_context as tx:
 
59
            yield tx