Github user HrWiggles commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1953#discussion_r102187534 --- Diff: server/src/com/cloud/storage/VolumeApiServiceImpl.java --- @@ -2639,22 +2639,23 @@ private int getMaxDataVolumesSupported(UserVmVO vm) { return maxDataVolumesSupported.intValue(); } - private Long getDeviceId(long vmId, Long deviceId) { + private Long getDeviceId(UserVmVO vm, Long deviceId) { --- End diff -- How about adding unit tests for the method `getDeviceId(UserVmVO vm, Long deviceId)`? Things I can currently think of to test: - `RuntimeException` if param `deviceId` is specified as a negative value - `RuntimeException` if param `deviceId` is specified as `0L` - `RuntimeException` if param `deviceId` is specified as a value greater than the "max-device-id" - `RuntimeException` if param `deviceId` is specified as reserved id `3L` - `RuntimeException` if param `deviceId` is specified as an id that is already in use - `RuntimeException` if param `deviceId` is specified as `null` and all device ids are in use - returns id specified in param `deviceId` when not `null` and the id is not in use - returns lowest available id when param `deviceId` is specified as `null` (all of the above are from my understanding of how the method should behave)
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---