Skip to content

Commit

Permalink
round up root disk size to the nearest accptable size for import
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanHoogland authored and shwstppr committed Jan 12, 2024
1 parent 31ff6ed commit af84391
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -1113,7 +1113,8 @@ private UserVm importVirtualMachineInternal(final UnmanagedInstanceTO unmanagedI
}
allDetails.put(VmDetailConstants.ROOT_DISK_CONTROLLER, rootDisk.getController());
if (cluster.getHypervisorType() == Hypervisor.HypervisorType.KVM && isImportUnmanagedFromSameHypervisor) {
allDetails.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(rootDisk.getCapacity() / Resource.ResourceType.bytesToGiB));
long size = Double.valueOf(Math.ceil((double)rootDisk.getCapacity() / Resource.ResourceType.bytesToGiB)).longValue();
allDetails.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(size));

Check warning on line 1117 in server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java#L1116-L1117

Added lines #L1116 - L1117 were not covered by tests
}

try {
Expand Down Expand Up @@ -1172,8 +1173,7 @@ private UserVm importVirtualMachineInternal(final UnmanagedInstanceTO unmanagedI
}
DiskOfferingVO diskOffering = diskOfferingDao.findById(serviceOffering.getDiskOfferingId());
diskProfileStoragePoolList.add(importDisk(rootDisk, userVm, cluster, diskOffering, Volume.Type.ROOT, String.format("ROOT-%d", userVm.getId()),
rootDisk.getCapacity(), minIops, maxIops,
template, owner, null));
rootDisk.getCapacity(), minIops, maxIops, template, owner, null));
long deviceId = 1L;
for (UnmanagedInstanceTO.Disk disk : dataDisks) {
if (disk.getCapacity() == null || disk.getCapacity() == 0) {
Expand Down

0 comments on commit af84391

Please sign in to comment.