mirror of https://github.com/apache/cloudstack.git
bug 7121: made the disk offering id optional, and added a check to ensure we never have both disk offering and snapshot ids to be null
status 7121: resolved fixed
This commit is contained in:
parent
2289725ed1
commit
7262b854a5
|
|
@ -52,7 +52,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
|||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the disk volume. Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISK_OFFERING_ID,required = true, type=CommandType.LONG, description="the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.")
|
||||
@Parameter(name=ApiConstants.DISK_OFFERING_ID,required = false, type=CommandType.LONG, description="the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.")
|
||||
private Long diskOfferingId;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.")
|
||||
|
|
|
|||
|
|
@ -1669,11 +1669,16 @@ public class StorageManagerImpl implements StorageManager {
|
|||
rae.setResourceType("volume");
|
||||
throw rae;
|
||||
}
|
||||
|
||||
|
||||
Long zoneId = null;
|
||||
Long diskOfferingId = null;
|
||||
Long size = null;
|
||||
|
||||
// validate input parameters before creating the volume
|
||||
if(cmd.getSnapshotId() == null && cmd.getDiskOfferingId() == null){
|
||||
throw new InvalidParameterValueException("Either disk Offering Id or snapshot Id must be passed whilst creating volume");
|
||||
}
|
||||
|
||||
if (cmd.getSnapshotId() == null) {
|
||||
zoneId = cmd.getZoneId();
|
||||
if ((zoneId == null)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue