Commit c62edb89 by Szeberényi Imre

Mass create options added.

edit template mod.
atomatic migrate temporaliry switched off
parent 2c87b1df
Pipeline #1154 passed with stage
in 0 seconds
......@@ -155,7 +155,7 @@
{% for d in disks %}
<li>
<i class="fa fa-file"></i>
{{ d.name }} (#{{ d.id }})
{{ d.filename }} (#{{ d.id }})
<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"
{% if not long_remove %}title="{% trans "Remove" %}"{% endif %}>
......
......@@ -70,11 +70,11 @@ celery.conf.update(
'schedule': crontab(minute=10, hour=1),
'options': {'queue': 'localhost.man'}
},
'vm.local_periodic_tasks': {
'task': 'vm.tasks.local_periodic_tasks.auto_migrate',
'schedule': crontab(**crontab_parser(AUTO_MIGRATION_CRONTAB)),
'options': {'queue': 'localhost.man.slow'},
},
# 'vm.local_periodic_tasks': {
# 'task': 'vm.tasks.local_periodic_tasks.auto_migrate',
# 'schedule': crontab(**crontab_parser(AUTO_MIGRATION_CRONTAB)),
# 'options': {'queue': 'localhost.man.slow'},
# },
}
)
......
......@@ -24,6 +24,7 @@ class Command(BaseCommand):
parser.add_argument('-t', '--template', type=int, required=True)
parser.add_argument('-u', '--users', required=True)
parser.add_argument('-a', '--admin')
parser.add_argument('-o', '--operator')
def handle(self, *args, **options):
template = InstanceTemplate.objects.get(id=options['template'])
......@@ -32,7 +33,7 @@ class Command(BaseCommand):
users = f.read().splitlines()
missing_users = Instance.mass_create_for_users(
template, users, options['admin']
template, users, options['admin'], options['operator']
)
if len(missing_users) > 0:
......
......@@ -440,7 +440,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
for cps in customized_params]
@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
in a list of users. Returns the user IDs of missing users.
......@@ -457,6 +457,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
instance = cls.create_from_template(template, user, **kwargs)
if admin:
instance.set_level(User.objects.get(username=admin), 'owner')
if operator:
instance.set_level(User.objects.get(username=operator), 'operator')
instance.deploy(user=user)
return missing_users
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment