Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
822167c7
authored
Oct 07, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: move renew function
parent
7a61fb2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
circle/vm/models.py
+11
-10
No files found.
circle/vm/models.py
View file @
822167c7
...
...
@@ -491,6 +491,17 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
'raw_data'
:
""
if
not
self
.
raw_data
else
self
.
raw_data
}
def
renew
(
self
,
which
=
'both'
):
"""Renew virtual machine instance leases.
"""
if
which
not
in
[
'suspend'
,
'delete'
,
'both'
]:
raise
ValueError
(
'No such expiration type.'
)
if
which
in
[
'suspend'
,
'both'
]:
self
.
time_of_suspend
=
timezone
.
now
()
+
self
.
lease
.
suspend_interval
if
which
in
[
'delete'
,
'both'
]:
self
.
time_of_delete
=
timezone
.
now
()
+
self
.
lease
.
delete_interval
self
.
save
()
def
deploy
(
self
,
user
=
None
,
task_uuid
=
None
):
""" Deploy new virtual machine with network
1. Schedule
...
...
@@ -657,16 +668,6 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
local_tasks
.
reboot
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
renew
(
self
,
which
=
'both'
):
"""Renew virtual machine instance leases.
"""
if
which
not
in
[
'suspend'
,
'delete'
,
'both'
]:
raise
ValueError
(
'No such expiration type.'
)
if
which
in
[
'suspend'
,
'both'
]:
self
.
time_of_suspend
=
timezone
.
now
()
+
self
.
lease
.
suspend_interval
if
which
in
[
'delete'
,
'both'
]:
self
.
time_of_delete
=
timezone
.
now
()
+
self
.
lease
.
delete_interval
self
.
save
()
class
InstanceActivity
(
TimeStampedModel
):
...
...
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