Commit cf6e76c1 by Karsa Zoltán István

style, disk

parent e837067b
......@@ -2,6 +2,9 @@
{% load sizefieldtags %}
<i class="fa fa-file"></i>
{% if d.ci_disk %} <i class="fa fa-cloud-upload"></i>
{% endif %}
{{ d.name }} (#{{ d.id }}) - {{ d.size|filesize }}
......
# Generated by Django 3.2.3 on 2022-07-21 14:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('storage', '0003_auto_20200424_2000'),
]
operations = [
migrations.AddField(
model_name='disk',
name='ci_disk',
field=models.BooleanField(default=False),
),
]
......@@ -144,7 +144,7 @@ class Disk(TimeStampedModel):
dev_num = CharField(default='a', max_length=1,
verbose_name=_("device number"))
destroyed = DateTimeField(blank=True, default=None, null=True)
ci_disk = BooleanField(default=False)
is_ready = BooleanField(default=False)
class Meta:
......
......@@ -436,7 +436,13 @@ class DeployOperation(InstanceOperation):
else:
self.instance.allocate_node()
if self.instance.cloud_init:
init_disk = None
try:
init_disk = self.instance.disks.get(ci_disk=True)
except:
logger.debug('create init-disk')
if self.instance.cloud_init and init_disk == None:
self.instance._create_ci_image(parent_activity=activity)
# Deploy virtual images
......@@ -491,7 +497,6 @@ class DeployOperation(InstanceOperation):
id = "_create_ci_image"
name = _("create cloud-init image")
description = _("create cloud init iso from user and meta-data")
acl_level = "owner"
def _operation(self, user, activity, name=None):
logger.info('create ci image')
......@@ -500,7 +505,6 @@ class DeployOperation(InstanceOperation):
disk.full_clean()
disk.save()
self.instance.disks.add(disk)
# self.instance._attach_disk(disk=disk, parent_activity=activity)
@register_operation
class DeployDisksOperation(SubOperationMixin, InstanceOperation):
......
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