cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GabrielBrascher <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-6928: fix issue disk I/O throt...
Date Thu, 12 May 2016 20:04:24 GMT
Github user GabrielBrascher commented on the pull request:

    https://github.com/apache/cloudstack/pull/1410#issuecomment-218869697
  
    I don't see anything wrong with this PR. However, the point made by @rodrigo93 is interesting.
    
    At the class "VolumeOrchestrator" (lines 1068-1081 and 1364-1377) and "VolumeApiServiceImpl"
(lines 2487-2500) there is duplicated code that could be extracted to a method. Both classes
extend the "ManagerBase" class.
    
    In order to replace those duplicated codes, a method could be implemented at the "ManagerBase"
with the following code:
    ```
    private DiskTO setupDisk(DataTO volTO, VirtualMachineProfile vm, VolumeVO vol) {
    	DiskTO disk = null;
    	if (volTO != null && volTO instanceof VolumeObjectTO) {
    		VolumeObjectTO volumeTO = (VolumeObjectTO) volTO;
    		ServiceOffering offering = _entityMgr.findById(ServiceOffering.class, vm.getServiceOfferingId());
    		DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, vol.getDiskOfferingId());
    		if (vol.getVolumeType() == Type.ROOT) {
    			storageMgr.setVolumeObjectTOThrottling(volumeTO, offering, diskOffering);
    		} else {
    			storageMgr.setVolumeObjectTOThrottling(volumeTO, null, diskOffering);
    		}
    		disk = new DiskTO(volumeTO, vol.getDeviceId(), vol.getPath(), vol.getVolumeType());
    	} else {
    		disk = new DiskTO(volTO, vol.getDeviceId(), vol.getPath(), vol.getVolumeType());
    	}
    	return disk;
    }
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message