Commit cf6e76c1 by Karsa Zoltán István

style, disk

parent e837067b
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
{% load sizefieldtags %} {% load sizefieldtags %}
<i class="fa fa-file"></i> <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 }} {{ 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): ...@@ -144,7 +144,7 @@ class Disk(TimeStampedModel):
dev_num = CharField(default='a', max_length=1, dev_num = CharField(default='a', max_length=1,
verbose_name=_("device number")) verbose_name=_("device number"))
destroyed = DateTimeField(blank=True, default=None, null=True) destroyed = DateTimeField(blank=True, default=None, null=True)
ci_disk = BooleanField(default=False)
is_ready = BooleanField(default=False) is_ready = BooleanField(default=False)
class Meta: class Meta:
......
...@@ -436,7 +436,13 @@ class DeployOperation(InstanceOperation): ...@@ -436,7 +436,13 @@ class DeployOperation(InstanceOperation):
else: else:
self.instance.allocate_node() 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) self.instance._create_ci_image(parent_activity=activity)
# Deploy virtual images # Deploy virtual images
...@@ -491,7 +497,6 @@ class DeployOperation(InstanceOperation): ...@@ -491,7 +497,6 @@ class DeployOperation(InstanceOperation):
id = "_create_ci_image" id = "_create_ci_image"
name = _("create cloud-init image") name = _("create cloud-init image")
description = _("create cloud init iso from user and meta-data") description = _("create cloud init iso from user and meta-data")
acl_level = "owner"
def _operation(self, user, activity, name=None): def _operation(self, user, activity, name=None):
logger.info('create ci image') logger.info('create ci image')
...@@ -500,7 +505,6 @@ class DeployOperation(InstanceOperation): ...@@ -500,7 +505,6 @@ class DeployOperation(InstanceOperation):
disk.full_clean() disk.full_clean()
disk.save() disk.save()
self.instance.disks.add(disk) self.instance.disks.add(disk)
# self.instance._attach_disk(disk=disk, parent_activity=activity)
@register_operation @register_operation
class DeployDisksOperation(SubOperationMixin, InstanceOperation): 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