Skip to content

Commit af84391

Browse files
DaanHooglandshwstppr
authored andcommitted
round up root disk size to the nearest accptable size for import
1 parent 31ff6ed commit af84391

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,8 @@ private UserVm importVirtualMachineInternal(final UnmanagedInstanceTO unmanagedI
11131113
}
11141114
allDetails.put(VmDetailConstants.ROOT_DISK_CONTROLLER, rootDisk.getController());
11151115
if (cluster.getHypervisorType() == Hypervisor.HypervisorType.KVM && isImportUnmanagedFromSameHypervisor) {
1116-
allDetails.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(rootDisk.getCapacity() / Resource.ResourceType.bytesToGiB));
1116+
long size = Double.valueOf(Math.ceil((double)rootDisk.getCapacity() / Resource.ResourceType.bytesToGiB)).longValue();
1117+
allDetails.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(size));
11171118
}
11181119

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

0 commit comments

Comments
 (0)