Fixes #15310 - Ability to choose VLAN group span over multiple sites in VM

This commit is contained in:
kiwichrism 2025-04-04 14:06:51 +13:00 committed by kiwichrism
parent 8f5d273f08
commit fe3bf8ee5e

View File

@ -160,6 +160,11 @@ class VLANQuerySet(RestrictedQuerySet):
scope_type=ContentType.objects.get_by_natural_key('virtualization', 'clustergroup'), scope_type=ContentType.objects.get_by_natural_key('virtualization', 'clustergroup'),
scope_id=vm.cluster.group_id scope_id=vm.cluster.group_id
) )
if vm.cluster._site_group:
q |= Q(
scope_type=ContentType.objects.get_by_natural_key('dcim', 'sitegroup'),
scope_id__in=vm.cluster._site_group.get_ancestors(include_self=True)
)+ if vm.cluster._site_group:
if site: if site:
# Add VLANGroups scoped to the assigned site (or its group or region) # Add VLANGroups scoped to the assigned site (or its group or region)
q |= Q( q |= Q(