mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #10559: Permit the pinning of a VM to a particular device within a cluster which has no site assignment
This commit is contained in:
parent
fec8d1bc2f
commit
03946f2ca8
@ -23,6 +23,7 @@
|
|||||||
* [#10491](https://github.com/netbox-community/netbox/issues/10491) - Clarify representation of blocking contact assignments during contact deletion
|
* [#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
|
* [#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
|
* [#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
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Group</th>
|
<th scope="row">Group</th>
|
||||||
<td>{{ object.group|linkify }}</td>
|
<td>{{ object.group|linkify|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Tenant</th>
|
<th scope="row">Tenant</th>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Site</th>
|
<th scope="row">Site</th>
|
||||||
<td>{{ object.site|linkify }}</td>
|
<td>{{ object.site|linkify|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Virtual Machines</th>
|
<th scope="row">Virtual Machines</th>
|
||||||
|
@ -349,14 +349,10 @@ class VirtualMachine(NetBoxModel, ConfigContextModel):
|
|||||||
# Validate site for cluster & device
|
# Validate site for cluster & device
|
||||||
if self.cluster and self.site and self.cluster.site != self.site:
|
if self.cluster and self.site and self.cluster.site != self.site:
|
||||||
raise ValidationError({
|
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:
|
elif self.cluster:
|
||||||
self.site = self.cluster.site
|
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
|
# Validate assigned cluster device
|
||||||
if self.device and not self.cluster:
|
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():
|
if self.device and self.device not in self.cluster.devices.all():
|
||||||
raise ValidationError({
|
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
|
# Validate primary IP addresses
|
||||||
|
Loading…
Reference in New Issue
Block a user