Skip to content

Commit 1c4bbcb

Browse files
authored
CSTACKEX-299: validates the inputs for capacity bytes in update storage pool to be positive. (#101)
…r now validates inputs for positive number ### Description validates the inputs for capacity bytes in update storage pool to be positive. This PR... <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [X] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> #### How did you try to break this feature and the system with this change? <!-- see how your change affects other areas of the code, etc. --> <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
1 parent 594558f commit 1c4bbcb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@
1919
import java.util.List;
2020
import java.util.Map;
2121

22-
import org.apache.cloudstack.api.ApiCommandResourceType;
23-
2422
import org.apache.cloudstack.api.APICommand;
23+
import org.apache.cloudstack.api.ApiArgValidator;
24+
import org.apache.cloudstack.api.ApiCommandResourceType;
2525
import org.apache.cloudstack.api.ApiConstants;
2626
import org.apache.cloudstack.api.ApiErrorCode;
2727
import org.apache.cloudstack.api.BaseCmd;
2828
import org.apache.cloudstack.api.Parameter;
2929
import org.apache.cloudstack.api.ServerApiException;
3030
import org.apache.cloudstack.api.response.StoragePoolResponse;
31+
import org.apache.commons.collections.MapUtils;
32+
import org.apache.commons.lang3.ObjectUtils;
3133

3234
import com.cloud.storage.StoragePool;
3335
import com.cloud.user.Account;
34-
import org.apache.commons.collections.MapUtils;
35-
import org.apache.commons.lang3.ObjectUtils;
3636

3737
@SuppressWarnings("rawtypes")
3838
@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0",
@@ -56,7 +56,7 @@ public class UpdateStoragePoolCmd extends BaseCmd {
5656
@Parameter(name = ApiConstants.CAPACITY_IOPS, type = CommandType.LONG, required = false, description = "IOPS CloudStack can provision from this storage pool")
5757
private Long capacityIops;
5858

59-
@Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false, description = "Bytes CloudStack can provision from this storage pool")
59+
@Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false, description = "Bytes CloudStack can provision from this storage pool",validations={ApiArgValidator.PositiveNumber})
6060
private Long capacityBytes;
6161

6262
@Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = false, description = "False to disable the pool for allocation of new volumes, true to" +

0 commit comments

Comments
 (0)