1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 08:56:07 +00:00

fix(instances): a VM name of any length libvirt takes is kept

libvirt names a VM by its <name>.xml file, so a name can have up to 251
bytes. The panel's VM, removed-VM and log records held 120 characters:
on PostgreSQL one longer name made the host's sync fail and the VM list
answer with an error. They now hold 255.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-09 21:21:05 +03:00
parent e83bdcbd44
commit 373760f2c5
8 changed files with 68 additions and 8 deletions

View file

@ -29,7 +29,8 @@ class InstanceManager(models.Manager):
class Instance(models.Model):
compute = models.ForeignKey(Compute, on_delete=models.CASCADE)
name = models.CharField(_("name"), max_length=120, db_index=True)
# libvirt takes any name its <name>.xml file can have: up to 251 bytes
name = models.CharField(_("name"), max_length=255, db_index=True)
uuid = models.CharField(_("uuid"), max_length=36, db_index=True)
is_template = models.BooleanField(_("is template"), default=False)
created = models.DateTimeField(_("created"), auto_now_add=True)
@ -409,7 +410,7 @@ class InstanceTombstone(models.Model):
"""
uuid = models.CharField(max_length=36, db_index=True)
name = models.CharField(max_length=120)
name = models.CharField(max_length=255)
host = models.CharField(max_length=64, blank=True) # the compute's name: the compute may be deleted
is_template = models.BooleanField(default=False)
owners = models.JSONField(default=list) # [{"user": id, "is_change": .., "is_delete": .., "is_vnc": ..}]