Skip to content

Commit e93d356

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 e63f2bd commit e93d356

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎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
@@ -561,9 +561,9 @@ public String getVmNameOnVolume(Volume volume) {
561561
@Override
562562
public boolean validateVolumeSizeRange(long size) {
563563
if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) {
564-
throw new InvalidParameterValueException("Please specify a size of at least 1 Gb.");
564+
throw new InvalidParameterValueException("Please specify a size of at least 1 GB.");
565565
} else if (size > (MaxVolumeSize.value() * 1024 * 1024 * 1024)) {
566-
throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " Gb.");
566+
throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " GB.");
567567
}
568568

569569
return true;
@@ -626,10 +626,10 @@ public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering
626626
if (rootDisksize != null ) {
627627
rootDisksize = rootDisksize * 1024 * 1024 * 1024;
628628
if (rootDisksize > size) {
629-
s_logger.debug("Using root disk size of " + rootDisksize + " for volume " + name);
629+
s_logger.debug("Using root disk size of " + rootDisksize + " Bytes for volume " + name);
630630
size = rootDisksize;
631631
} else {
632-
s_logger.debug("Using root disk size of " + size + " for volume " + name + "since specified root disk size of " + rootDisksize + " is smaller than template");
632+
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");
633633
}
634634
}
635635

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

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

29702970
if ((rootDiskSize << 30) < templateVO.getSize()) {
2971-
throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize());
2971+
Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024;
2972+
throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize()
2973+
+ "B (" + templateVOSizeGB + "GB)");
29722974
} else {
29732975
s_logger.debug("rootdisksize of " + (rootDiskSize << 30) + " was larger than template size of " + templateVO.getSize());
29742976
}

0 commit comments

Comments
 (0)