mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
fix uuid and name changes and update them on db correctly. (#404)
This commit is contained in:
parent
0a8beacf29
commit
596d55d481
2 changed files with 4 additions and 4 deletions
|
@ -4,8 +4,10 @@ from instances.models import Instance
|
|||
def refresh_instance_database(compute):
|
||||
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 from DB
|
||||
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 on host but not in DB
|
||||
names = Instance.objects.filter(compute=compute).values_list('name', flat=True)
|
||||
for domain in domains:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue