init commit

This commit is contained in:
ahmadbilalkhalid 2020-03-03 23:46:39 +05:00
commit fea0568bb9
10 changed files with 318 additions and 6 deletions

View file

@ -39,6 +39,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(
@ -74,7 +80,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=(
@ -127,7 +134,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)