Commit 1b3e04f2 by Chif Gergő

Little changes in Flavor model

parent 28d4e195
# Generated by Django 3.0.4 on 2020-03-26 12:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instance', '0002_instance_template'),
]
operations = [
migrations.AlterField(
model_name='flavor',
name='initial_disk',
field=models.PositiveIntegerField(default=0),
),
migrations.AlterField(
model_name='flavor',
name='name',
field=models.CharField(max_length=100),
),
migrations.AlterField(
model_name='flavor',
name='priority',
field=models.PositiveIntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='flavor',
name='ram',
field=models.PositiveIntegerField(default=0),
),
migrations.AlterField(
model_name='flavor',
name='vcpu',
field=models.PositiveIntegerField(default=0),
),
migrations.AlterField(
model_name='lease',
name='delete_interval_in_sec',
field=models.IntegerField(default=7200),
),
migrations.AlterField(
model_name='lease',
name='name',
field=models.CharField(max_length=100),
),
migrations.AlterField(
model_name='lease',
name='suspend_interval_in_sec',
field=models.IntegerField(default=3600),
),
]
......@@ -32,25 +32,25 @@ class Lease(models.Model):
After suspend interval the vm suspends and after delete it will be
destroyed
"""
name = models.CharField(blank=True, max_length=100)
name = models.CharField(max_length=100)
description = models.CharField(blank=True, max_length=100)
suspend_interval_in_sec = models.IntegerField(blank=True, null=True)
delete_interval_in_sec = models.IntegerField(blank=True, null=True)
suspend_interval_in_sec = models.IntegerField(default=3600)
delete_interval_in_sec = models.IntegerField(default=7200)
class Flavor(models.Model):
""" Flavors are reasource packages, contains all information about
resources accociated with the virtual machine
"""
name = models.CharField(blank=True, max_length=100)
name = models.CharField(blank=False, max_length=100)
description = models.CharField(blank=True, max_length=200)
remote_id = models.CharField(
max_length=100, help_text="ID of the instance on the backend"
)
ram = models.IntegerField(blank=True, null=True)
vcpu = models.IntegerField(blank=True, null=True)
initial_disk = models.IntegerField(blank=True, null=True)
priority = models.IntegerField(blank=True, null=True)
ram = models.PositiveIntegerField(default=0)
vcpu = models.PositiveIntegerField(default=0)
initial_disk = models.PositiveIntegerField(default=0)
priority = models.PositiveIntegerField(blank=True, null=True)
@classmethod
def create(cls, name, description, ram=0, vcpu=0,
......@@ -68,7 +68,6 @@ class Flavor(models.Model):
raise ValueError("Can't create Flavor in remote cloud.")
def delete(self):
interface = OSVirtualMachineManager(settings.CONNECTION)
try:
interface.delete_flavor(self.remote_id)
super(Flavor, self).delete()
......
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