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
b4274949
authored
Mar 10, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: renew renews both deadlines
parent
7774d21c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
one/models.py
+4
-4
one/views.py
+1
-1
No files found.
one/models.py
View file @
b4274949
...
...
@@ -629,12 +629,12 @@ class Instance(models.Model):
self
.
_change_state
(
"POWEROFF"
)
def
restart
(
self
):
self
.
_change_state
(
"RESET"
)
def
renew
(
self
,
which
):
if
which
==
'suspend'
:
def
renew
(
self
,
which
=
'both'
):
if
which
in
[
'suspend'
,
'both'
]
:
self
.
time_of_suspend
=
self
.
share
.
get_type
()[
'suspendx'
]
elif
which
==
'delete'
:
if
which
in
[
'delete'
,
'both'
]
:
self
.
time_of_delete
=
self
.
share
.
get_type
()[
'deletex'
]
else
:
if
not
(
which
in
[
'suspend'
,
'delete'
,
'both'
])
:
raise
ValueError
(
'No such expiration type.'
)
self
.
save
()
def
save_as
(
self
):
...
...
one/views.py
View file @
b4274949
...
...
@@ -515,7 +515,7 @@ def vm_resume(request, iid, *args, **kwargs):
@require_POST
def
vm_renew
(
request
,
which
,
iid
,
*
args
,
**
kwargs
):
try
:
get_object_or_404
(
Instance
,
id
=
iid
,
owner
=
request
.
user
)
.
renew
(
which
)
get_object_or_404
(
Instance
,
id
=
iid
,
owner
=
request
.
user
)
.
renew
()
messages
.
success
(
request
,
_
(
'Virtual machine is successfully renewed.'
))
except
:
messages
.
error
(
request
,
_
(
'Failed to renew virtual machine.'
))
...
...
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