forked from uncloud/uncloud
Merge remote-tracking branch 'ahmed/migrate-one-to-regular-vm'
This commit is contained in:
commit
14a4fa8cc1
11 changed files with 370 additions and 8 deletions
23
uncloud/uncloud_vm/migrations/0009_auto_20200303_0927.py
Normal file
23
uncloud/uncloud_vm/migrations/0009_auto_20200303_0927.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.3 on 2020-03-03 09:27
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_vm', '0008_auto_20200229_1611'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='vmhost',
|
||||
name='vms',
|
||||
field=models.TextField(default=''),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='vmdiskproduct',
|
||||
name='size_in_gb',
|
||||
field=models.FloatField(blank=True),
|
||||
),
|
||||
]
|
||||
18
uncloud/uncloud_vm/migrations/0010_auto_20200303_1208.py
Normal file
18
uncloud/uncloud_vm/migrations/0010_auto_20200303_1208.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.3 on 2020-03-03 12:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_vm', '0009_auto_20200303_0927'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='vmnetworkcard',
|
||||
name='mac_address',
|
||||
field=models.BigIntegerField(),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.3 on 2020-03-03 18:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_vm', '0010_auto_20200303_1208'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='vmdiskimageproduct',
|
||||
name='source_type',
|
||||
field=models.CharField(max_length=128, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.3 on 2020-03-03 18:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_vm', '0011_vmdiskimageproduct_source_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='vmdiskimageproduct',
|
||||
name='source',
|
||||
field=models.CharField(max_length=128, null=True),
|
||||
),
|
||||
]
|
||||
23
uncloud/uncloud_vm/migrations/0013_auto_20200303_1845.py
Normal file
23
uncloud/uncloud_vm/migrations/0013_auto_20200303_1845.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.3 on 2020-03-03 18:45
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_vm', '0012_vmdiskimageproduct_source'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='vmdiskimageproduct',
|
||||
old_name='source',
|
||||
new_name='image_source',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='vmdiskimageproduct',
|
||||
old_name='source_type',
|
||||
new_name='image_source_type',
|
||||
),
|
||||
]
|
||||
18
uncloud/uncloud_vm/migrations/0014_vmproduct_vmid.py
Normal file
18
uncloud/uncloud_vm/migrations/0014_vmproduct_vmid.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.3 on 2020-03-04 07:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_vm', '0013_auto_20200303_1845'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='vmproduct',
|
||||
name='vmid',
|
||||
field=models.IntegerField(null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -40,6 +40,12 @@ class VMHost(models.Model):
|
|||
max_length=32, choices=STATUS_CHOICES, default=STATUS_DEFAULT
|
||||
)
|
||||
|
||||
# List of VMs running on this host
|
||||
vms = models.TextField(default='')
|
||||
|
||||
def get_vms(self):
|
||||
return self.vms.split(',')
|
||||
|
||||
|
||||
class VMProduct(Product):
|
||||
vmhost = models.ForeignKey(
|
||||
|
|
@ -51,6 +57,7 @@ class VMProduct(Product):
|
|||
name = models.CharField(max_length=32)
|
||||
cores = models.IntegerField()
|
||||
ram_in_gb = models.FloatField()
|
||||
vmid = models.IntegerField(null=True)
|
||||
|
||||
def recurring_price(self, recurring_period=RecurringPeriod.PER_MONTH):
|
||||
# TODO: move magic numbers in variables
|
||||
|
|
@ -97,7 +104,8 @@ class VMDiskImageProduct(models.Model):
|
|||
|
||||
size_in_gb = models.FloatField(null=True, blank=True)
|
||||
import_url = models.URLField(null=True, blank=True)
|
||||
|
||||
image_source = models.CharField(max_length=128, null=True)
|
||||
image_source_type = models.CharField(max_length=128, null=True)
|
||||
storage_class = models.CharField(
|
||||
max_length=32,
|
||||
choices=(
|
||||
|
|
@ -150,7 +158,7 @@ class VMDiskProduct(models.Model):
|
|||
class VMNetworkCard(models.Model):
|
||||
vm = models.ForeignKey(VMProduct, on_delete=models.CASCADE)
|
||||
|
||||
mac_address = models.IntegerField()
|
||||
mac_address = models.BigIntegerField()
|
||||
|
||||
ip_address = models.GenericIPAddressField(blank=True,
|
||||
null=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue