Skip to content

Commit 625825d

Browse files
committed
Fixes #14402: Avoid nullifying disk value when editing a VM with disk(s) attached
1 parent c0512e2 commit 625825d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

netbox/virtualization/models/virtualmachines.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def clean(self):
200200
# Validate aggregate disk size
201201
if self.pk:
202202
total_disk = self.virtualdisks.aggregate(Sum('size', default=0))['size__sum']
203-
if total_disk and self.disk != total_disk:
203+
if total_disk and self.disk is None:
204+
self.disk = total_disk
205+
elif total_disk and self.disk != total_disk:
204206
raise ValidationError({
205207
'disk': _(
206208
"The specified disk size ({size}) must match the aggregate size of assigned virtual disks "

0 commit comments

Comments
 (0)