Просмотр исходного кода

Fixes #10559: Permit the pinning of a VM to a particular device within a cluster which has no site assignment

jeremystretch 3 лет назад
Родитель
Сommit
03946f2ca8

+ 1 - 0
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
 
 ---
 

+ 2 - 2
netbox/templates/virtualization/cluster.html

@@ -21,7 +21,7 @@
                 </tr>
                 <tr>
                     <th scope="row">Group</th>
-                    <td>{{ object.group|linkify }}</td>
+                    <td>{{ object.group|linkify|placeholder }}</td>
                 </tr>
                 <tr>
                     <th scope="row">Tenant</th>
@@ -34,7 +34,7 @@
                 </tr>
                 <tr>
                     <th scope="row">Site</th>
-                    <td>{{ object.site|linkify }}</td>
+                    <td>{{ object.site|linkify|placeholder }}</td>
                 </tr>
                 <tr>
                     <th scope="row">Virtual Machines</th>

+ 2 - 6
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