Github user GabrielBrascher commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1410#discussion_r53556330 --- Diff: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java --- @@ -1006,6 +1006,19 @@ protected synchronized String attachOrDetachDisk(final Connect conn, final boole } else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) { diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, DiskDef.DiskBus.VIRTIO); } + + if ((bytesReadRate != null) && (bytesReadRate > 0)) { + diskdef.setBytesReadRate(bytesReadRate); + } + if ((bytesWriteRate != null) && (bytesWriteRate > 0)) { + diskdef.setBytesWriteRate(bytesWriteRate); + } + if ((iopsReadRate != null) && (iopsReadRate > 0)) { + diskdef.setIopsReadRate(iopsReadRate); + } + if ((iopsWriteRate != null) && (iopsWriteRate > 0)) { --- End diff -- @ustcweizhou Those conditions coud be done by a method, where the I/O source (bytesReadRate , bytesWriteRate, iopsReadRate or iopsWriteRate) is passed as parameter. For example: `public boolean isIORateNotNullAndBiggerThanZero(Long io) {` `retun (io != null) && (io > 0);` `}` This sugestion could allow a test case, also it makes the code more readable (in my opinion). Thanks.
--- 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. ---