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
c62edb89
authored
Jun 04, 2020
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mass create options added.
edit template mod. atomatic migrate temporaliry switched off
parent
2c87b1df
Pipeline
#1154
passed with stage
in 0 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
circle/dashboard/templates/dashboard/template-edit.html
+1
-1
circle/manager/mancelery.py
+5
-5
circle/vm/management/commands/mass_create_vms.py
+2
-1
circle/vm/models/instance.py
+3
-1
No files found.
circle/dashboard/templates/dashboard/template-edit.html
View file @
c62edb89
...
@@ -155,7 +155,7 @@
...
@@ -155,7 +155,7 @@
{% for d in disks %}
{% for d in disks %}
<li>
<li>
<i
class=
"fa fa-file"
></i>
<i
class=
"fa fa-file"
></i>
{{ d.name }} (#{{ d.id }})
{{ d.
file
name }} (#{{ d.id }})
<a
href=
"{% url "
dashboard
.
views
.
disk-remove
"
pk=
d.pk
%}?
next=
{{
request
.
path
}}"
<a
href=
"{% url "
dashboard
.
views
.
disk-remove
"
pk=
d.pk
%}?
next=
{{
request
.
path
}}"
data-disk-pk=
"{{ d.pk }}"
class=
"btn btn-xs btn-danger pull-right disk-remove"
data-disk-pk=
"{{ d.pk }}"
class=
"btn btn-xs btn-danger pull-right disk-remove"
{%
if
not
long_remove
%}
title=
"{% trans "
Remove
"
%}"{%
endif
%}
>
{%
if
not
long_remove
%}
title=
"{% trans "
Remove
"
%}"{%
endif
%}
>
...
...
circle/manager/mancelery.py
View file @
c62edb89
...
@@ -70,11 +70,11 @@ celery.conf.update(
...
@@ -70,11 +70,11 @@ celery.conf.update(
'schedule'
:
crontab
(
minute
=
10
,
hour
=
1
),
'schedule'
:
crontab
(
minute
=
10
,
hour
=
1
),
'options'
:
{
'queue'
:
'localhost.man'
}
'options'
:
{
'queue'
:
'localhost.man'
}
},
},
'vm.local_periodic_tasks'
:
{
#
'vm.local_periodic_tasks': {
'task'
:
'vm.tasks.local_periodic_tasks.auto_migrate'
,
#
'task': 'vm.tasks.local_periodic_tasks.auto_migrate',
'schedule'
:
crontab
(
**
crontab_parser
(
AUTO_MIGRATION_CRONTAB
)),
#
'schedule': crontab(**crontab_parser(AUTO_MIGRATION_CRONTAB)),
'options'
:
{
'queue'
:
'localhost.man.slow'
},
#
'options': {'queue': 'localhost.man.slow'},
},
#
},
}
}
)
)
...
...
circle/vm/management/commands/mass_create_vms.py
View file @
c62edb89
...
@@ -24,6 +24,7 @@ class Command(BaseCommand):
...
@@ -24,6 +24,7 @@ class Command(BaseCommand):
parser
.
add_argument
(
'-t'
,
'--template'
,
type
=
int
,
required
=
True
)
parser
.
add_argument
(
'-t'
,
'--template'
,
type
=
int
,
required
=
True
)
parser
.
add_argument
(
'-u'
,
'--users'
,
required
=
True
)
parser
.
add_argument
(
'-u'
,
'--users'
,
required
=
True
)
parser
.
add_argument
(
'-a'
,
'--admin'
)
parser
.
add_argument
(
'-a'
,
'--admin'
)
parser
.
add_argument
(
'-o'
,
'--operator'
)
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
template
=
InstanceTemplate
.
objects
.
get
(
id
=
options
[
'template'
])
template
=
InstanceTemplate
.
objects
.
get
(
id
=
options
[
'template'
])
...
@@ -32,7 +33,7 @@ class Command(BaseCommand):
...
@@ -32,7 +33,7 @@ class Command(BaseCommand):
users
=
f
.
read
()
.
splitlines
()
users
=
f
.
read
()
.
splitlines
()
missing_users
=
Instance
.
mass_create_for_users
(
missing_users
=
Instance
.
mass_create_for_users
(
template
,
users
,
options
[
'admin'
]
template
,
users
,
options
[
'admin'
]
,
options
[
'operator'
]
)
)
if
len
(
missing_users
)
>
0
:
if
len
(
missing_users
)
>
0
:
...
...
circle/vm/models/instance.py
View file @
c62edb89
...
@@ -440,7 +440,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -440,7 +440,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
for
cps
in
customized_params
]
for
cps
in
customized_params
]
@classmethod
@classmethod
def
mass_create_for_users
(
cls
,
template
,
users
,
admin
=
None
,
**
kwargs
):
def
mass_create_for_users
(
cls
,
template
,
users
,
admin
=
None
,
operator
=
None
,
**
kwargs
):
"""
"""
Create and deploy an instance of a template for each user
Create and deploy an instance of a template for each user
in a list of users. Returns the user IDs of missing users.
in a list of users. Returns the user IDs of missing users.
...
@@ -457,6 +457,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -457,6 +457,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
instance
=
cls
.
create_from_template
(
template
,
user
,
**
kwargs
)
instance
=
cls
.
create_from_template
(
template
,
user
,
**
kwargs
)
if
admin
:
if
admin
:
instance
.
set_level
(
User
.
objects
.
get
(
username
=
admin
),
'owner'
)
instance
.
set_level
(
User
.
objects
.
get
(
username
=
admin
),
'owner'
)
if
operator
:
instance
.
set_level
(
User
.
objects
.
get
(
username
=
operator
),
'operator'
)
instance
.
deploy
(
user
=
user
)
instance
.
deploy
(
user
=
user
)
return
missing_users
return
missing_users
...
...
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