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
8595c190
authored
Apr 19, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add default name to save_as_template
parent
d3889c7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
circle/vm/operations.py
+11
-2
No files found.
circle/vm/operations.py
View file @
8595c190
from
__future__
import
absolute_import
,
unicode_literals
from
__future__
import
absolute_import
,
unicode_literals
from
logging
import
getLogger
from
logging
import
getLogger
from
re
import
match
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.utils
import
timezone
from
django.utils
import
timezone
...
@@ -206,7 +207,15 @@ class SaveAsTemplateOperation(InstanceOperation):
...
@@ -206,7 +207,15 @@ class SaveAsTemplateOperation(InstanceOperation):
"""
)
"""
)
icon
=
'save'
icon
=
'save'
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
def
_rename
(
self
,
name
):
m
=
match
(
"^(.*)( v(
\
d+))?$"
,
name
)
if
m
.
group
(
3
)
is
None
:
v
=
2
else
:
v
=
int
(
v
)
+
1
return
"
%
s v
%
d"
%
(
m
.
group
(
1
),
v
)
def
_operation
(
self
,
activity
,
user
,
system
,
timeout
=
300
,
with_shutdown
=
True
,
**
kwargs
):
with_shutdown
=
True
,
**
kwargs
):
if
with_shutdown
:
if
with_shutdown
:
ShutdownOperation
(
self
.
instance
)
.
call
(
parent_activity
=
activity
,
ShutdownOperation
(
self
.
instance
)
.
call
(
parent_activity
=
activity
,
...
@@ -219,7 +228,7 @@ class SaveAsTemplateOperation(InstanceOperation):
...
@@ -219,7 +228,7 @@ class SaveAsTemplateOperation(InstanceOperation):
'description'
:
self
.
instance
.
description
,
'description'
:
self
.
instance
.
description
,
'lease'
:
self
.
instance
.
lease
,
# Can be problem in new VM
'lease'
:
self
.
instance
.
lease
,
# Can be problem in new VM
'max_ram_size'
:
self
.
instance
.
max_ram_size
,
'max_ram_size'
:
self
.
instance
.
max_ram_size
,
'name'
:
name
,
'name'
:
self
.
_rename
(
self
.
instance
.
name
)
,
'num_cores'
:
self
.
instance
.
num_cores
,
'num_cores'
:
self
.
instance
.
num_cores
,
'owner'
:
user
,
'owner'
:
user
,
'parent'
:
self
.
instance
.
template
,
# Can be problem
'parent'
:
self
.
instance
.
template
,
# Can be problem
...
...
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