Source:
private void populateUnregisteredDisksListWithUnregisteredDisk(Guid storagePoolId, Guid storageDomainId, List<Disk> unregisteredDisks, Guid unregisteredDiskId) { StoragePoolDomainAndGroupIdBaseVDSCommandParameters getVolumesParameters = new StoragePoolDomainAndGroupIdBaseVDSCommandParameters( storagePoolId, storageDomainId, unregisteredDiskId); VDSReturnValue imageInfoReturn = null; VDSReturnValue volumesListReturn = null; try { volumesListReturn = runVdsCommand(VDSCommandType.GetVolumesList, getVolumesParameters); if (!volumesListReturn.getSucceeded()) { logUnregisterDiskFailure(unregisteredDiskId.toString(), volumesListReturn.getExceptionString()); return; } List<Guid> volumesList = (List<Guid>) volumesListReturn.getReturnValue(); if (volumesList.size() != 1) { log.info("Could not get populated disk since the disk contains snapshots."); return; } GetImageInfoVDSCommandParameters imageInfoParameters = new GetImageInfoVDSCommandParameters( storagePoolId, storageDomainId, unregisteredDiskId, volumesList.get(0)); imageInfoReturn = runVdsCommand(VDSCommandType.GetImageInfo, imageInfoParameters); } catch (VdcBLLException e) { logUnregisterDiskFailure(unregisteredDiskId.toString(), e.getMessage()); } if (!imageInfoReturn.getSucceeded()) { logUnregisterDiskFailure(unregisteredDiskId.toString(), volumesListReturn.getExceptionString()); return; } DiskImage newDiskImage = (DiskImage) imageInfoReturn.getReturnValue(); newDiskImage.setDiskInterface(DiskInterface.IDE); newDiskImage.setStoragePoolId(storagePoolId); unregisteredDisks.add(newDiskImage); }

Target:
private void populateUnregisteredDisksListWithUnregisteredDisk(Guid storagePoolId, Guid storageDomainId, List<Disk> unregisteredDisks, Guid unregisteredDiskId) { StoragePoolDomainAndGroupIdBaseVDSCommandParameters getVolumesParameters = new StoragePoolDomainAndGroupIdBaseVDSCommandParameters( storagePoolId, storageDomainId, unregisteredDiskId); VDSReturnValue imageInfoReturn = null; VDSReturnValue volumesListReturn = null; try { volumesListReturn = runVdsCommand(VDSCommandType.GetVolumesList, getVolumesParameters); if (!volumesListReturn.getSucceeded()) { logUnregisterDiskFailure(unregisteredDiskId.toString(), volumesListReturn.getExceptionString()); return; } List<Guid> volumesList = (List<Guid>) volumesListReturn.getReturnValue(); if (volumesList.size() != 1) { log.infoFormat("Could not get populated disk image id {1} since the disk contains snapshots.", unregisteredDiskId); return; } GetImageInfoVDSCommandParameters imageInfoParameters = new GetImageInfoVDSCommandParameters( storagePoolId, storageDomainId, unregisteredDiskId, volumesList.get(0)); imageInfoReturn = runVdsCommand(VDSCommandType.GetImageInfo, imageInfoParameters); } catch (VdcBLLException e) { logUnregisterDiskFailure(unregisteredDiskId.toString(), e.getMessage()); } if (imageInfoReturn == null || !imageInfoReturn.getSucceeded()) { logUnregisterDiskFailure(unregisteredDiskId.toString(), volumesListReturn.getExceptionString()); return; } DiskImage newDiskImage = (DiskImage) imageInfoReturn.getReturnValue(); newDiskImage.setDiskInterface(DiskInterface.IDE); newDiskImage.setStoragePoolId(storagePoolId); unregisteredDisks.add(newDiskImage); }