mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 07:35:22 +00:00
apply recommendation of code-review-doctor
This commit is contained in:
parent
6d3550bb24
commit
2910a3229a
3 changed files with 19 additions and 26 deletions
|
@ -210,16 +210,16 @@ class Instance(models.Model):
|
|||
|
||||
|
||||
class MigrateInstance(models.Model):
|
||||
instance = models.ForeignKey(Instance, on_delete=models.DO_NOTHING)
|
||||
target_compute = models.ForeignKey(Compute, related_name='target', on_delete=models.DO_NOTHING)
|
||||
instance = models.ForeignKey(Instance, related_name='source_host', on_delete=models.DO_NOTHING)
|
||||
target_compute = models.ForeignKey(Compute, related_name='target_host', on_delete=models.DO_NOTHING)
|
||||
|
||||
live = models.BooleanField(_('Live'), blank=False)
|
||||
xml_del = models.BooleanField(_('Undefine XML'), blank=False, default=True)
|
||||
offline = models.BooleanField(_('Offline'), blank=False)
|
||||
autoconverge = models.BooleanField(_('Auto Converge'), blank=False, default=True)
|
||||
compress = models.BooleanField(_('Compress'), blank=False, default=False)
|
||||
postcopy = models.BooleanField(_('Post Copy'), blank=False, default=False)
|
||||
unsafe = models.BooleanField(_('Unsafe'), blank=False, default=False)
|
||||
live = models.BooleanField(_('Live'))
|
||||
xml_del = models.BooleanField(_('Undefine XML'), default=True)
|
||||
offline = models.BooleanField(_('Offline'))
|
||||
autoconverge = models.BooleanField(_('Auto Converge'), default=True)
|
||||
compress = models.BooleanField(_('Compress'), default=False)
|
||||
postcopy = models.BooleanField(_('Post Copy'), default=False)
|
||||
unsafe = models.BooleanField(_('Unsafe'), default=False)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
|
|
|
@ -10,10 +10,3 @@ class NetworksSerializer(serializers.ModelSerializer):
|
|||
fields = ['name', 'status', 'device', 'forward']
|
||||
|
||||
|
||||
|
||||
# class VolumeSerializer(serializers.ModelSerializer):
|
||||
# allocation = serializers.ReadOnlyField()
|
||||
# meta_prealloc = serializers.BooleanField(write_only=True)
|
||||
# class Meta:
|
||||
# model = Volume
|
||||
# fields = ['name', 'type', 'allocation', 'size', 'meta_prealloc']
|
||||
|
|
|
@ -9,12 +9,12 @@ class Storages(models.Model):
|
|||
size = models.IntegerField(_('size'))
|
||||
volumes = models.IntegerField(_('volumes'))
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}'
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}'
|
||||
|
||||
|
||||
class Volume(models.Model):
|
||||
name = models.CharField(_('name'), max_length=128)
|
||||
|
@ -22,13 +22,13 @@ class Volume(models.Model):
|
|||
allocation = models.IntegerField(_('allocation'))
|
||||
size = models.IntegerField(_('size'))
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}'
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
verbose_name_plural = "Volumes"
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}'
|
||||
|
||||
|
||||
class Storage(models.Model):
|
||||
state = models.IntegerField(_('state'))
|
||||
|
@ -38,10 +38,10 @@ class Storage(models.Model):
|
|||
path = models.CharField(_('path'), max_length=128)
|
||||
type = models.CharField(_('type'), max_length=128)
|
||||
autostart = models.BooleanField(_('autostart'))
|
||||
volumes = models.ForeignKey(Volume, on_delete=models.DO_NOTHING)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.path}'
|
||||
volumes = models.ForeignKey(Volume, related_name="storage_volumes", on_delete=models.DO_NOTHING)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.path}'
|
||||
|
|
Loading…
Reference in a new issue