mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #14402: Avoid nullifying disk value when editing a VM with disk(s) attached
This commit is contained in:
@ -200,7 +200,9 @@ class VirtualMachine(ContactsMixin, RenderConfigMixin, ConfigContextModel, Prima
|
||||
# Validate aggregate disk size
|
||||
if self.pk:
|
||||
total_disk = self.virtualdisks.aggregate(Sum('size', default=0))['size__sum']
|
||||
if total_disk and self.disk != total_disk:
|
||||
if total_disk and self.disk is None:
|
||||
self.disk = total_disk
|
||||
elif total_disk and self.disk != total_disk:
|
||||
raise ValidationError({
|
||||
'disk': _(
|
||||
"The specified disk size ({size}) must match the aggregate size of assigned virtual disks "
|
||||
|
Reference in New Issue
Block a user