Source:
<code>private List<EngineMessage> validateLunDisk(LunDisk lunDisk) { DiskValidator diskValidator = getDiskValidator(lunDisk); LUNs lun = lunDisk.getLun(); <START> StorageType storageType = StorageType.FCP; <END> if (lun.getLunConnections() != null && !lun.getLunConnections().isEmpty()) { storageType = lun.getLunConnections().get(0).getStorageType(); } if (storageType == StorageType.ISCSI) { ValidationResult connectionsInLunResult = diskValidator.validateConnectionsInLun(storageType); if (!connectionsInLunResult.isValid()) { return connectionsInLunResult.getMessages(); } } ValidationResult lunAlreadyInUseResult = diskValidator.validateLunAlreadyInUse(); if (!lunAlreadyInUseResult.isValid()) { return lunAlreadyInUseResult.getMessages(); } DiskVmElementValidator diskVmElementValidator = new DiskVmElementValidator(lunDisk, lunDisk.getDiskVmElementForVm(getVmId())); ValidationResult virtIoScsiResult = isVirtIoScsiValid(getVm(), diskVmElementValidator); if (!virtIoScsiResult.isValid()) { return virtIoScsiResult.getMessages(); } ValidationResult diskInterfaceResult = diskVmElementValidator.isDiskInterfaceSupported(getVm()); if (!diskInterfaceResult.isValid()) { return diskInterfaceResult.getMessages(); } Guid vdsId = vdsCommandsHelper.getHostForExecution(getStoragePoolId()); GetDeviceListVDSCommandParameters parameters = new GetDeviceListVDSCommandParameters(vdsId, storageType, false, Collections.singleton(lun.getLUNId())); if (validateLunExistsAndInitDeviceData(lun, parameters)) { return Arrays.asList(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_INVALID); } ValidationResult usingScsiReservationResult = diskValidator.isUsingScsiReservationValid(getVm(), lunDisk.getDiskVmElementForVm(getVmId()), lunDisk); if (!usingScsiReservationResult.isValid()) { return usingScsiReservationResult.getMessages(); } return Collections.emptyList(); }</code><technical_language>please move 'else' part. confusing :/</technical_language>

Target:
private List<EngineMessage> validateLunDisk(LunDisk lunDisk) { DiskValidator diskValidator = getDiskValidator(lunDisk); LUNs lun = lunDisk.getLun(); StorageType storageType; if (lun.getLunConnections() != null && !lun.getLunConnections().isEmpty()) { storageType = lun.getLunConnections().get(0).getStorageType(); } else { storageType = StorageType.FCP; } if (storageType == StorageType.ISCSI) { ValidationResult connectionsInLunResult = diskValidator.validateConnectionsInLun(storageType); if (!connectionsInLunResult.isValid()) { return connectionsInLunResult.getMessages(); } } ValidationResult lunAlreadyInUseResult = diskValidator.validateLunAlreadyInUse(); if (!lunAlreadyInUseResult.isValid()) { return lunAlreadyInUseResult.getMessages(); } DiskVmElementValidator diskVmElementValidator = new DiskVmElementValidator(lunDisk, lunDisk.getDiskVmElementForVm(getVmId())); ValidationResult virtIoScsiResult = isVirtIoScsiValid(getVm(), diskVmElementValidator); if (!virtIoScsiResult.isValid()) { return virtIoScsiResult.getMessages(); } ValidationResult diskInterfaceResult = diskVmElementValidator.isDiskInterfaceSupported(getVm()); if (!diskInterfaceResult.isValid()) { return diskInterfaceResult.getMessages(); } Guid vdsId = vdsCommandsHelper.getHostForExecution(getStoragePoolId()); GetDeviceListVDSCommandParameters parameters = new GetDeviceListVDSCommandParameters(vdsId, storageType, false, Collections.singleton(lun.getLUNId())); if (validateLunExistsAndInitDeviceData(lun, parameters)) { return Arrays.asList(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_INVALID); } ValidationResult usingScsiReservationResult = diskValidator.isUsingScsiReservationValid(getVm(), lunDisk.getDiskVmElementForVm(getVmId()), lunDisk); if (!usingScsiReservationResult.isValid()) { return usingScsiReservationResult.getMessages(); } return Collections.emptyList(); }