rafaelweingartner commented on a change in pull request #2709: only ask for the
root volume, removing extensive query
URL: https://github.com/apache/cloudstack/pull/2709#discussion_r195327387
##########
File path: server/src/com/cloud/network/element/ConfigDriveNetworkElement.java
##########
@@ -322,20 +321,9 @@ 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 (volumes != null && volumes.size() > 0) {
Review comment:
You can use (should?) CollectionUtils here though.
----------------------------------------------------------------
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