From 03946f2ca868dc21d8819f4db29107822b2a2c74 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 4 Oct 2022 15:46:55 -0400 Subject: [PATCH] Fixes #10559: Permit the pinning of a VM to a particular device within a cluster which has no site assignment --- docs/release-notes/version-3.3.md | 1 + netbox/templates/virtualization/cluster.html | 4 ++-- netbox/virtualization/models.py | 8 ++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/release-notes/version-3.3.md b/docs/release-notes/version-3.3.md index 92d93f5c8..d4dcc83d6 100644 --- a/docs/release-notes/version-3.3.md +++ b/docs/release-notes/version-3.3.md @@ -23,6 +23,7 @@ * [#10491](https://github.com/netbox-community/netbox/issues/10491) - Clarify representation of blocking contact assignments during contact deletion * [#10513](https://github.com/netbox-community/netbox/issues/10513) - Disable the reassignment of a module to a new device * [#10517](https://github.com/netbox-community/netbox/issues/10517) - Automatically inherit site assignment from cluster when creating a virtual machine +* [#10559](https://github.com/netbox-community/netbox/issues/10559) - Permit the pinning of a VM to a particular device within a cluster which has no site assignment --- diff --git a/netbox/templates/virtualization/cluster.html b/netbox/templates/virtualization/cluster.html index 8acbb61f4..bf7c8a69a 100644 --- a/netbox/templates/virtualization/cluster.html +++ b/netbox/templates/virtualization/cluster.html @@ -21,7 +21,7 @@ Group - {{ object.group|linkify }} + {{ object.group|linkify|placeholder }} Tenant @@ -34,7 +34,7 @@ Site - {{ object.site|linkify }} + {{ object.site|linkify|placeholder }} Virtual Machines diff --git a/netbox/virtualization/models.py b/netbox/virtualization/models.py index 69376d9c5..b07e51790 100644 --- a/netbox/virtualization/models.py +++ b/netbox/virtualization/models.py @@ -349,14 +349,10 @@ class VirtualMachine(NetBoxModel, ConfigContextModel): # Validate site for cluster & device if self.cluster and self.site and self.cluster.site != self.site: raise ValidationError({ - 'cluster': f'The selected cluster ({self.cluster} is not assigned to this site ({self.site}).' + 'cluster': f'The selected cluster ({self.cluster}) is not assigned to this site ({self.site}).' }) elif self.cluster: self.site = self.cluster.site - if self.device and self.device.site != self.site: - raise ValidationError({ - 'device': f'The selected device ({self.device} is not assigned to this site ({self.site}).' - }) # Validate assigned cluster device if self.device and not self.cluster: @@ -365,7 +361,7 @@ class VirtualMachine(NetBoxModel, ConfigContextModel): }) if self.device and self.device not in self.cluster.devices.all(): raise ValidationError({ - 'device': f'The selected device ({self.device} is not assigned to this cluster ({self.cluster}).' + 'device': f'The selected device ({self.device}) is not assigned to this cluster ({self.cluster}).' }) # Validate primary IP addresses