mirror of https://github.com/apache/cloudstack.git
bug 7021: data disk wasn't being created for custom sizes. Also, we were having max size checks in GB, whereas disk offerings are in MB. Made the change there as well.The storage allocators were commented out in master, uncommented them.
Status 7021: resolved fixed
This commit is contained in:
parent
efc5af0585
commit
968dc0616f
|
|
@ -123,8 +123,8 @@
|
|||
</adapters>
|
||||
<adapters key="com.cloud.storage.allocator.StoragePoolAllocator">
|
||||
<adapter name="LocalStorage" class="com.cloud.storage.allocator.LocalStoragePoolAllocator"/>
|
||||
<!-- adapter name="Storage" class="com.cloud.storage.allocator.FirstFitStoragePoolAllocator"/ -->
|
||||
<!--adapter name="Storage" class="com.cloud.storage.allocator.RandomStoragePoolAllocator"/-->
|
||||
< adapter name="Storage" class="com.cloud.storage.allocator.FirstFitStoragePoolAllocator"/ >
|
||||
<adapter name="Storage" class="com.cloud.storage.allocator.RandomStoragePoolAllocator"/>
|
||||
<adapter name="GarbageCollecting" class="com.cloud.storage.allocator.GarbageCollectingStoragePoolAllocator"/>
|
||||
</adapters>
|
||||
<adapters key="com.cloud.agent.manager.allocator.PodAllocator">
|
||||
|
|
|
|||
|
|
@ -4692,7 +4692,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
vdir.type = Types.VdiType.USER;
|
||||
|
||||
if(cmd.getSize()!=0)
|
||||
vdir.virtualSize = cmd.getSize();
|
||||
vdir.virtualSize = (cmd.getSize()*1024*1024*1L);
|
||||
else
|
||||
vdir.virtualSize = dskch.getSize();
|
||||
vdi = VDI.create(conn, vdir);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public enum Config {
|
|||
|
||||
StorageOverprovisioningFactor("Storage", StoragePoolAllocator.class, String.class, "storage.overprovisioning.factor", "2", "Used for storage overprovisioning calculation; available storage will be (actualStorageSize * storage.overprovisioning.factor)", null),
|
||||
StorageStatsInterval("Storage", ManagementServer.class, String.class, "storage.stats.interval", "60000", "The interval in milliseconds when storage stats (per host) are retrieved from agents.", null),
|
||||
MaxVolumeSize("Storage", ManagementServer.class, Integer.class, "max.volume.size.gb", "2000", "The maximum size for a volume in gigabytes.", null),
|
||||
MaxVolumeSize("Storage", ManagementServer.class, Integer.class, "max.volume.size.mb", "1024000", "The maximum size for a volume in megabytes.", null),
|
||||
TotalRetries("Storage", AgentManager.class, Integer.class, "total.retries", "4", "The number of times each command sent to a host should be retried in case of failure.", null),
|
||||
|
||||
// Network
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
private final int _routerRamSize;
|
||||
private final int _proxyRamSize;
|
||||
private final int _ssRamSize;
|
||||
private int _maxVolumeSizeInGb;
|
||||
private int _maxVolumeSizeInMb;
|
||||
|
||||
private final Map<String, Boolean> _availableIdsMap;
|
||||
|
||||
|
|
@ -512,9 +512,9 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
_networkGroupsEnabled = true;
|
||||
}
|
||||
|
||||
String maxVolumeSizeInGbString = _configDao.getValue("max.volume.size.gb");
|
||||
int maxVolumeSizeGb = NumbersUtil.parseInt(maxVolumeSizeInGbString, 2000);
|
||||
_maxVolumeSizeInGb = maxVolumeSizeGb;
|
||||
String maxVolumeSizeInMbString = _configDao.getValue("max.volume.size.gb");
|
||||
int maxVolumeSizeMb = NumbersUtil.parseInt(maxVolumeSizeInMbString, (2000*1024));//2000 gb
|
||||
_maxVolumeSizeInMb = maxVolumeSizeMb;
|
||||
}
|
||||
|
||||
protected Map<String, String> getConfigs() {
|
||||
|
|
@ -1216,8 +1216,8 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
throw new InvalidParameterValueException("Please specify a valid disk size for VM creation; custom disk offering has no size set");
|
||||
}
|
||||
|
||||
if(diskOffering != null && diskOffering.isCustomized() && size > _maxVolumeSizeInGb){
|
||||
throw new InvalidParameterValueException("Please specify a valid disk size for VM creation; custom disk offering max size is:"+_maxVolumeSizeInGb);
|
||||
if(diskOffering != null && diskOffering.isCustomized() && size > _maxVolumeSizeInMb){
|
||||
throw new InvalidParameterValueException("Please specify a valid disk size for VM creation; custom disk offering max size is:"+_maxVolumeSizeInMb);
|
||||
}
|
||||
|
||||
// validate that the template is usable by the account
|
||||
|
|
|
|||
|
|
@ -716,6 +716,9 @@ public class StorageManagerImpl implements StorageManager {
|
|||
StoragePoolVO pool = null;
|
||||
final HashSet<StoragePool> avoidPools = new HashSet<StoragePool>(avoids);
|
||||
|
||||
if(diskOffering != null && diskOffering.isCustomized()){
|
||||
diskOffering.setDiskSize(size);
|
||||
}
|
||||
DiskProfile dskCh = null;
|
||||
if (volume.getVolumeType() == VolumeType.ROOT && Storage.ImageFormat.ISO != template.getFormat()) {
|
||||
dskCh = createDiskCharacteristics(volume, template, dc, offering);
|
||||
|
|
@ -842,7 +845,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||
rootVol.setDeviceId(0l);
|
||||
rootVol = _volsDao.persist(rootVol);
|
||||
|
||||
if (diskOffering != null && diskOffering.getDiskSizeInBytes() > 0) {
|
||||
if ((diskOffering != null && diskOffering.getDiskSizeInBytes() > 0)) {
|
||||
dataVol = new VolumeVO(VolumeType.DATADISK, vm.getId(), vm.getInstanceName() + "-DATA", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), (size>0)? size : diskOffering.getDiskSizeInBytes());
|
||||
|
||||
createStartedEvent(account, dataVol);
|
||||
|
|
|
|||
Loading…
Reference in New Issue