mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6181 Specify GB for the value of rootdisksize parameter. Add some Bytes/GB for log or exception messages. Fix Gb->GB.
This commit is contained in:
parent
d7854791b2
commit
87d4086a64
@ -121,7 +121,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
|
|||||||
|
|
||||||
@Parameter(name = ApiConstants.ROOT_DISK_SIZE,
|
@Parameter(name = ApiConstants.ROOT_DISK_SIZE,
|
||||||
type = CommandType.LONG,
|
type = CommandType.LONG,
|
||||||
description = "Optional field to resize root disk on deploy. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided",
|
description = "Optional field to resize root disk on deploy. Value is in GB. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided",
|
||||||
since = "4.4")
|
since = "4.4")
|
||||||
private Long rootdisksize;
|
private Long rootdisksize;
|
||||||
|
|
||||||
|
|||||||
@ -599,9 +599,9 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||||||
@Override
|
@Override
|
||||||
public boolean validateVolumeSizeRange(long size) {
|
public boolean validateVolumeSizeRange(long size) {
|
||||||
if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) {
|
if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) {
|
||||||
throw new InvalidParameterValueException("Please specify a size of at least 1 Gb.");
|
throw new InvalidParameterValueException("Please specify a size of at least 1 GB.");
|
||||||
} else if (size > (MaxVolumeSize.value() * 1024 * 1024 * 1024)) {
|
} else if (size > (MaxVolumeSize.value() * 1024 * 1024 * 1024)) {
|
||||||
throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " Gb.");
|
throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " GB.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -674,10 +674,10 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||||||
if (rootDisksize != null ) {
|
if (rootDisksize != null ) {
|
||||||
rootDisksize = rootDisksize * 1024 * 1024 * 1024;
|
rootDisksize = rootDisksize * 1024 * 1024 * 1024;
|
||||||
if (rootDisksize > size) {
|
if (rootDisksize > size) {
|
||||||
s_logger.debug("Using root disk size of " + rootDisksize + " for volume " + name);
|
s_logger.debug("Using root disk size of " + rootDisksize + " Bytes for volume " + name);
|
||||||
size = rootDisksize;
|
size = rootDisksize;
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("Using root disk size of " + size + " for volume " + name + "since specified root disk size of " + rootDisksize + " is smaller than template");
|
s_logger.debug("Using root disk size of " + size + " Bytes for volume " + name + "since specified root disk size of " + rootDisksize + " Bytes is smaller than template");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3095,7 +3095,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rootDiskSize << 30) < templateVO.getSize()) {
|
if ((rootDiskSize << 30) < templateVO.getSize()) {
|
||||||
throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize());
|
Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024;
|
||||||
|
throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize()
|
||||||
|
+ "B (" + templateVOSizeGB + "GB)");
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("rootdisksize of " + (rootDiskSize << 30) + " was larger than template size of " + templateVO.getSize());
|
s_logger.debug("rootdisksize of " + (rootDiskSize << 30) + " was larger than template size of " + templateVO.getSize());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user