diff --git a/uncloud/uncloud_vm/models.py b/uncloud/uncloud_vm/models.py index 9733841..e59d5d2 100644 --- a/uncloud/uncloud_vm/models.py +++ b/uncloud/uncloud_vm/models.py @@ -19,6 +19,18 @@ STATUS_CHOICES = ( STATUS_DEFAULT = 'pending' +from uncloud_pay.models import Product + +STATUS_CHOICES = ( + ('pending', 'Pending'), # Initial state + ('creating', 'Creating'), # Creating VM/image/etc. + ('active', 'Active'), # Is usable / active + ('disabled', 'Disabled'), # Is usable, but cannot be used for new things + ('unusable', 'Unusable'), # Has some kind of error + ('deleted', 'Deleted'), # Does not exist anymore, only DB entry as a log +) + +STATUS_DEFAULT='pending' class VMHost(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) @@ -39,9 +51,11 @@ class VMHost(models.Model): class VMProduct(Product): - vmhost = models.ForeignKey( - VMHost, on_delete=models.CASCADE, editable=False, blank=True, null=True - ) + vmhost = models.ForeignKey(VMHost, + on_delete=models.CASCADE, + editable=False, + blank=True, + null=True) cores = models.IntegerField() ram_in_gb = models.FloatField() @@ -59,8 +73,12 @@ class VMDiskImageProduct(models.Model): """ - uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE, editable=False) + uuid = models.UUIDField( + primary_key=True, default=uuid.uuid4, editable=False + ) + owner = models.ForeignKey( + get_user_model(), on_delete=models.CASCADE, editable=False + ) name = models.CharField(max_length=256) is_os_image = models.BooleanField(default=False)