mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
fix(reconciliation): implement UUID-based domain reconciliation and connection safety
This commit is contained in:
parent
dbef70131b
commit
3f8eeb04bd
3 changed files with 198 additions and 25 deletions
|
|
@ -166,18 +166,9 @@ def migrate_instance(
|
|||
|
||||
|
||||
def refr(compute):
|
||||
if compute.status is True:
|
||||
domains = compute.proxy.wvm.listAllDomains()
|
||||
domain_names = [d.name() for d in domains]
|
||||
domain_uuids = [d.UUIDString() for d in domains]
|
||||
# Delete instances that're not on host
|
||||
Instance.objects.filter(compute=compute).exclude(name__in=domain_names).delete()
|
||||
Instance.objects.filter(compute=compute).exclude(uuid__in=domain_uuids).delete()
|
||||
# Create instances that're not in DB
|
||||
names = Instance.objects.filter(compute=compute).values_list("name", flat=True)
|
||||
for domain in domains:
|
||||
if domain.name() not in names:
|
||||
Instance(compute=compute, name=domain.name(), uuid=domain.UUIDString()).save()
|
||||
from computes.utils import refresh_instance_database
|
||||
|
||||
refresh_instance_database(compute)
|
||||
|
||||
|
||||
def get_dhcp_mac_address(vname):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue