Skip to content

Commit 8eafdbd

Browse files
committed
CLOUDSTACK-6181 Specify GB for the value of rootdisksize parameter. Add some Bytes/GB for log or exception messages. Fix Gb->GB.
1 parent 803b946 commit 8eafdbd

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
121121

122122
@Parameter(name = ApiConstants.ROOT_DISK_SIZE,
123123
type = CommandType.LONG,
124-
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",
124+
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",
125125
since = "4.4")
126126
private Long rootdisksize;
127127

engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ public String getVmNameOnVolume(Volume volume) {
587587
@Override
588588
public boolean validateVolumeSizeRange(long size) {
589589
if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) {
590-
throw new InvalidParameterValueException("Please specify a size of at least 1 Gb.");
590+
throw new InvalidParameterValueException("Please specify a size of at least 1 GB.");
591591
} else if (size > (MaxVolumeSize.value() * 1024 * 1024 * 1024)) {
592-
throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " Gb.");
592+
throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " GB.");
593593
}
594594

595595
return true;
@@ -662,10 +662,10 @@ public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering
662662
if (rootDisksize != null ) {
663663
rootDisksize = rootDisksize * 1024 * 1024 * 1024;
664664
if (rootDisksize > size) {
665-
s_logger.debug("Using root disk size of " + rootDisksize + " for volume " + name);
665+
s_logger.debug("Using root disk size of " + rootDisksize + " Bytes for volume " + name);
666666
size = rootDisksize;
667667
} else {
668-
s_logger.debug("Using root disk size of " + size + " for volume " + name + "since specified root disk size of " + rootDisksize + " is smaller than template");
668+
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");
669669
}
670670
}
671671

server/src/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3072,7 +3072,9 @@ public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCap
30723072
}
30733073

30743074
if ((rootDiskSize << 30) < templateVO.getSize()) {
3075-
throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize());
3075+
Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024;
3076+
throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize()
3077+
+ "B (" + templateVOSizeGB + "GB)");
30763078
} else {
30773079
s_logger.debug("rootdisksize of " + (rootDiskSize << 30) + " was larger than template size of " + templateVO.getSize());
30783080
}

0 commit comments

Comments
 (0)