mike-tutkowski commented on issue #2761: Add managed storage pool constraints 
to MigrateWithVolume API method
URL: https://github.com/apache/cloudstack/pull/2761#issuecomment-409757636
 
 
   This method doesn't work (example: assume volumeToStoragePoolObjectMap comes 
in empty):
   
       private List<Volume> 
findVolumesThatWereNotMappedByTheUser(VirtualMachineProfile profile, 
Map<Volume, StoragePool> volumeToStoragePoolObjectMap) {
           List<VolumeVO> allVolumes = 
_volsDao.findUsableVolumesForInstance(profile.getId());
           List<Volume> volumesNotMapped = new ArrayList<>();
           for (Volume volume : volumeToStoragePoolObjectMap.keySet()) {
               if (!allVolumes.contains(volume)) {
                   volumesNotMapped.add(volume);
               }
           }
           return volumesNotMapped;
       }
   
   I changed it to this:
   
       private List<Volume> 
findVolumesThatWereNotMappedByTheUser(VirtualMachineProfile profile, 
Map<Volume, StoragePool> volumeToStoragePoolObjectMap) {
           List<VolumeVO> allVolumes = 
_volsDao.findUsableVolumesForInstance(profile.getId());
           List<Volume> volumesNotMapped = new ArrayList<>();
           for (Volume volume : allVolumes) {
               if (!volumeToStoragePoolObjectMap.containsKey(volume)) {
                   volumesNotMapped.add(volume);
               }
           }
           return volumesNotMapped;
       }
   
   I'm still testing.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to