Merge remote-tracking branch 'ahmed/migrate-one-to-regular-vm'

This commit is contained in:
Nico Schottelius 2020-03-05 11:34:15 +01:00
commit 14a4fa8cc1
11 changed files with 370 additions and 8 deletions

View file

@ -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)