Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
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
Show 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):
...
@@ -629,12 +629,12 @@ class Instance(models.Model):
self
.
_change_state
(
"POWEROFF"
)
self
.
_change_state
(
"POWEROFF"
)
def
restart
(
self
):
def
restart
(
self
):
self
.
_change_state
(
"RESET"
)
self
.
_change_state
(
"RESET"
)
def
renew
(
self
,
which
):
def
renew
(
self
,
which
=
'both'
):
if
which
==
'suspend'
:
if
which
in
[
'suspend'
,
'both'
]
:
self
.
time_of_suspend
=
self
.
share
.
get_type
()[
'suspendx'
]
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'
]
self
.
time_of_delete
=
self
.
share
.
get_type
()[
'deletex'
]
else
:
if
not
(
which
in
[
'suspend'
,
'delete'
,
'both'
])
:
raise
ValueError
(
'No such expiration type.'
)
raise
ValueError
(
'No such expiration type.'
)
self
.
save
()
self
.
save
()
def
save_as
(
self
):
def
save_as
(
self
):
...
...
one/views.py
View file @
b4274949
...
@@ -515,7 +515,7 @@ def vm_resume(request, iid, *args, **kwargs):
...
@@ -515,7 +515,7 @@ def vm_resume(request, iid, *args, **kwargs):
@require_POST
@require_POST
def
vm_renew
(
request
,
which
,
iid
,
*
args
,
**
kwargs
):
def
vm_renew
(
request
,
which
,
iid
,
*
args
,
**
kwargs
):
try
:
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.'
))
messages
.
success
(
request
,
_
(
'Virtual machine is successfully renewed.'
))
except
:
except
:
messages
.
error
(
request
,
_
(
'Failed to renew virtual machine.'
))
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