Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4f4bd0c6
authored
Jul 09, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add ACL to leases
parent
726c6897
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
circle/vm/models/common.py
+11
-1
No files found.
circle/vm/models/common.py
View file @
4f4bd0c6
...
@@ -24,6 +24,8 @@ from django.utils.timesince import timeuntil
...
@@ -24,6 +24,8 @@ from django.utils.timesince import timeuntil
from
model_utils.models
import
TimeStampedModel
from
model_utils.models
import
TimeStampedModel
from
acl.models
import
AclBase
ARCHITECTURES
=
((
'x86_64'
,
'x86-64 (64 bit)'
),
ARCHITECTURES
=
((
'x86_64'
,
'x86-64 (64 bit)'
),
(
'i686'
,
'x86 (32 bit)'
))
(
'i686'
,
'x86 (32 bit)'
))
...
@@ -66,13 +68,17 @@ class NamedBaseResourceConfig(BaseResourceConfigModel, TimeStampedModel):
...
@@ -66,13 +68,17 @@ class NamedBaseResourceConfig(BaseResourceConfigModel, TimeStampedModel):
return
self
.
name
return
self
.
name
class
Lease
(
Model
):
class
Lease
(
AclBase
):
"""Lease times for VM instances.
"""Lease times for VM instances.
Specifies a time duration until suspension and deletion of a VM
Specifies a time duration until suspension and deletion of a VM
instance.
instance.
"""
"""
ACL_LEVELS
=
(
(
'user'
,
_
(
'user'
)),
# use this lease
(
'owner'
,
_
(
'owner'
)),
# change this lease
)
name
=
CharField
(
max_length
=
100
,
unique
=
True
,
name
=
CharField
(
max_length
=
100
,
unique
=
True
,
verbose_name
=
_
(
'name'
))
verbose_name
=
_
(
'name'
))
suspend_interval_seconds
=
IntegerField
(
suspend_interval_seconds
=
IntegerField
(
...
@@ -88,6 +94,10 @@ class Lease(Model):
...
@@ -88,6 +94,10 @@ class Lease(Model):
app_label
=
'vm'
app_label
=
'vm'
db_table
=
'vm_lease'
db_table
=
'vm_lease'
ordering
=
[
'name'
,
]
ordering
=
[
'name'
,
]
permissions
=
(
(
'create_leases'
,
_
(
'Can create new leases.'
)),
(
'bypass_leases'
,
_
(
'Can set arbitrary expiration times.'
)),
)
@property
@property
def
suspend_interval
(
self
):
def
suspend_interval
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment