DaanHoogland commented on a change in pull request #2709: check volumes for state when retrieving pool for configDrive creation URL: https://github.com/apache/cloudstack/pull/2709#discussion_r199911529
########## File path: server/src/com/cloud/network/element/ConfigDriveNetworkElement.java ########## @@ -322,27 +322,52 @@ public void commitMigration(NicProfile nic, Network network, VirtualMachineProfi private DataStore findDataStore(VirtualMachineProfile profile, DeployDestination dest) { DataStore dataStore = null; if (VirtualMachineManager.VmConfigDriveOnPrimaryPool.value()) { - if (dest.getStorageForDisks() != null) { - for (final Volume volume : dest.getStorageForDisks().keySet()) { - if (volume.getVolumeType() == Volume.Type.ROOT) { - final StoragePool primaryPool = dest.getStorageForDisks().get(volume); - dataStore = _dataStoreMgr.getDataStore(primaryPool.getId(), DataStoreRole.Primary); - break; - } - } - } - if (dataStore == null) { - final List<VolumeVO> volumes = _volumeDao.findByInstanceAndType(profile.getVirtualMachine().getId(), Volume.Type.ROOT); - if (volumes != null && volumes.size() > 0) { - dataStore = _dataStoreMgr.getDataStore(volumes.get(0).getPoolId(), DataStoreRole.Primary); - } + final List<VolumeVO> volumes = _volumeDao.findByInstanceAndType(profile.getVirtualMachine().getId(), Volume.Type.ROOT); + if (CollectionUtils.isNotEmpty(volumes)) { + dataStore = pickDataStoreFromVolumes(volumes); Review comment: @rhtyd I agree. I am really wondering if this is a red herring or a needed fix. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services