~allenap/maas/neighbours-service-live

« back to all changes in this revision

Viewing changes to src/maasserver/locks.py

  • Committer: Gavin Panella
  • Date: 2015-10-14 19:48:39 UTC
  • mfrom: (3852.1.524 maas)
  • Revision ID: gavin.panella@canonical.com-20151014194839-xgjmom6qzxyj71pn
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2014 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2014-2015 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Region-wide locks."""
18
18
    "startup",
19
19
]
20
20
 
21
 
from maasserver.utils.dblocks import DatabaseXactLock
 
21
from maasserver.utils.dblocks import (
 
22
    DatabaseLock,
 
23
    DatabaseXactLock,
 
24
)
22
25
 
23
26
# Lock around starting-up a MAAS region.
24
 
startup = DatabaseXactLock(1)
 
27
startup = DatabaseLock(1)
25
28
 
26
29
# Lock around performing critical security-related operations, like
27
30
# generating or signing certificates.
28
 
security = DatabaseXactLock(2)
 
31
security = DatabaseLock(2)
29
32
 
30
33
# Lock used when starting up the event-loop.
31
 
eventloop = DatabaseXactLock(3)
32
 
 
33
 
# Lock used to only allow one instance of importing boot images to occur
34
 
# at a time.
35
 
import_images = DatabaseXactLock(4)
36
 
 
37
 
# Lock used to only allow one instance of caching boot source
38
 
# image information.
39
 
cache_sources = DatabaseXactLock(5)
 
34
eventloop = DatabaseLock(3)
 
35
 
 
36
# Lock around importing boot images, used exclusively.
 
37
import_images = DatabaseLock(4)
40
38
 
41
39
# Lock to prevent concurrent changes to DNS configuration.
42
 
dns = DatabaseXactLock(6)
 
40
dns = DatabaseLock(6)
43
41
 
44
42
# Lock to prevent concurrent acquisition of nodes.
45
43
node_acquire = DatabaseXactLock(7)