1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00
webvirtcloud/computes/migrations/0009_host_uuid.py
catborise 29ec20682b fix(computes): a libvirt host is one compute, and a compute's VMs stay on their host
One host could be added twice, under another name, as TCP and SSH, or by
another address: its VMs were listed once per record, each with its own
owners, and counted twice in the capacity totals. A compute with VMs could
also be pointed at another host: the owners of a VM then reached the
VM with the same UUID there, a restored or copied one.

A compute now keeps its libvirt host UUID. Adding a compute or changing
its connection, on the web or the API, connects and reads it: a host that
is already a compute is refused, and a compute with VMs moves only to an
address of the same host, which must answer. Computes added before are
read when another one is checked.
2026-11-12 09:19:03 +03:00

22 lines
667 B
Python

# Generated by Django 5.2.18 on 2026-11-12 05:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('computes', '0008_migration_address_help'),
]
operations = [
migrations.AddField(
model_name='compute',
name='host_uuid',
field=models.CharField(blank=True, default='', editable=False, max_length=36),
),
migrations.AddConstraint(
model_name='compute',
constraint=models.UniqueConstraint(condition=models.Q(('host_uuid', ''), _negated=True), fields=('host_uuid',), name='one_compute_per_host'),
),
]