Skip to content

Commit

Permalink
CA-380218: It was not possible to create VMs with VDIs smaller than t…
Browse files Browse the repository at this point in the history
…he max disk size when the summed size exceeded the latter limit.

The limitation of 2TB for non-GFS2 SRs is on the size of individual VDIs, not the total.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Jul 25, 2023
1 parent c439f3d commit 049b85f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions XenModel/XenAPI-Extensions/SR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,8 @@ public virtual bool CanFitDisks(out string cannotFitReason, VDI[] vdis)
var sm = GetSM();

var vdiSizeUnlimited = sm != null && Array.IndexOf(sm.capabilities, "LARGE_VDI") != -1;
var vdiSize = vdis.Sum(vdi => vdi.virtual_size);

if (!vdiSizeUnlimited && vdiSize > DISK_MAX_SIZE)
if (!vdiSizeUnlimited && vdis.Any(vdi => vdi.virtual_size > DISK_MAX_SIZE))
{
cannotFitReason = string.Format(Messages.SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE,
Util.DiskSizeString(DISK_MAX_SIZE, 0));
Expand All @@ -516,6 +515,7 @@ public virtual bool CanFitDisks(out string cannotFitReason, VDI[] vdis)

var isThinlyProvisioned = sm != null && Array.IndexOf(sm.capabilities, "THIN_PROVISIONING") != -1;
var vdiPhysicalUtilization = vdis.Sum(vdi => vdi.physical_utilisation);
var vdiSize = vdis.Sum(vdi => vdi.virtual_size);
var sizeToConsider = isThinlyProvisioned ? vdiPhysicalUtilization : vdiSize;

if (sizeToConsider > physical_size)
Expand Down

0 comments on commit 049b85f

Please sign in to comment.