Skip to content

Commit df6f40f

Browse files
committed
Revert "findbugs: remove compatible objects from collection"
This reverts commit 390325c.
1 parent 390325c commit df6f40f

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

‎server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import javax.inject.Inject;
3131
import javax.naming.ConfigurationException;
3232

33-
import org.apache.log4j.Logger;
34-
3533
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
3634
import org.apache.cloudstack.affinity.AffinityGroupService;
3735
import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
@@ -50,16 +48,8 @@
5048
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
5149
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
5250
import org.apache.cloudstack.utils.identity.ManagementServerNode;
51+
import org.apache.log4j.Logger;
5352

54-
import com.cloud.agent.AgentManager;
55-
import com.cloud.agent.Listener;
56-
import com.cloud.agent.api.AgentControlAnswer;
57-
import com.cloud.agent.api.AgentControlCommand;
58-
import com.cloud.agent.api.Answer;
59-
import com.cloud.agent.api.Command;
60-
import com.cloud.agent.api.StartupCommand;
61-
import com.cloud.agent.api.StartupRoutingCommand;
62-
import com.cloud.agent.manager.allocator.HostAllocator;
6353
import com.cloud.capacity.CapacityManager;
6454
import com.cloud.capacity.dao.CapacityDao;
6555
import com.cloud.configuration.Config;
@@ -80,6 +70,7 @@
8070
import com.cloud.exception.AffinityConflictException;
8171
import com.cloud.exception.ConnectionException;
8272
import com.cloud.exception.InsufficientServerCapacityException;
73+
import com.cloud.exception.PermissionDeniedException;
8374
import com.cloud.host.Host;
8475
import com.cloud.host.HostVO;
8576
import com.cloud.host.Status;
@@ -111,6 +102,7 @@
111102
import com.cloud.utils.db.SearchCriteria;
112103
import com.cloud.utils.db.Transaction;
113104
import com.cloud.utils.db.TransactionCallback;
105+
import com.cloud.utils.db.TransactionCallbackNoReturn;
114106
import com.cloud.utils.db.TransactionStatus;
115107
import com.cloud.utils.exception.CloudRuntimeException;
116108
import com.cloud.utils.fsm.StateListener;
@@ -119,10 +111,19 @@
119111
import com.cloud.vm.VMInstanceVO;
120112
import com.cloud.vm.VirtualMachine;
121113
import com.cloud.vm.VirtualMachine.Event;
122-
import com.cloud.vm.VirtualMachine.State;
123114
import com.cloud.vm.VirtualMachineProfile;
115+
import com.cloud.vm.VirtualMachine.State;
124116
import com.cloud.vm.dao.UserVmDao;
125117
import com.cloud.vm.dao.VMInstanceDao;
118+
import com.cloud.agent.AgentManager;
119+
import com.cloud.agent.Listener;
120+
import com.cloud.agent.api.AgentControlAnswer;
121+
import com.cloud.agent.api.AgentControlCommand;
122+
import com.cloud.agent.api.Answer;
123+
import com.cloud.agent.api.Command;
124+
import com.cloud.agent.api.StartupCommand;
125+
import com.cloud.agent.api.StartupRoutingCommand;
126+
import com.cloud.agent.manager.allocator.HostAllocator;
126127

127128

128129
@Local(value = { DeploymentPlanningManager.class })
@@ -206,7 +207,7 @@ public List<AffinityGroupProcessor> getAffinityGroupProcessors() {
206207
return _affinityProcessors;
207208
}
208209
public void setAffinityGroupProcessors(List<AffinityGroupProcessor> affinityProcessors) {
209-
_affinityProcessors = affinityProcessors;
210+
this._affinityProcessors = affinityProcessors;
210211
}
211212

212213
@Override
@@ -950,7 +951,7 @@ private boolean canAvoidCluster(Cluster clusterVO, ExcludeList avoids, ExcludeLi
950951
}
951952

952953
// Cluster can be put in avoid set in following scenarios:
953-
// 1. If storage allocators haven't put any pools in avoid set means either no pools in cluster
954+
// 1. If storage allocators haven't put any pools in avoid set means either no pools in cluster
954955
// or pools not suitable for the allocators to handle or there is no
955956
// linkage of any suitable host to any of the pools in cluster
956957
// 2. If all 'shared' or 'local' pools are in avoid set
@@ -1151,9 +1152,9 @@ protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsFo
11511152
List<StoragePool> suitablePools = new ArrayList<StoragePool>();
11521153
StoragePool pool = null;
11531154
if (toBeCreated.getPoolId() != null) {
1154-
pool = (StoragePool) dataStoreMgr.getPrimaryDataStore(toBeCreated.getPoolId());
1155+
pool = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(toBeCreated.getPoolId());
11551156
} else {
1156-
pool = (StoragePool) dataStoreMgr.getPrimaryDataStore(plan.getPoolId());
1157+
pool = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(plan.getPoolId());
11571158
}
11581159

11591160
if (!pool.isInMaintenance()) {
@@ -1166,7 +1167,7 @@ protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsFo
11661167
&& plan.getClusterId() == exstPoolClusterId) {
11671168
canReusePool = true;
11681169
} else if (plan.getDataCenterId() == exstPoolDcId) {
1169-
DataStore dataStore = dataStoreMgr.getPrimaryDataStore(pool.getId());
1170+
DataStore dataStore = this.dataStoreMgr.getPrimaryDataStore(pool.getId());
11701171
if (dataStore != null && dataStore.getScope() != null
11711172
&& dataStore.getScope().getScopeType() == ScopeType.ZONE) {
11721173
canReusePool = true;
@@ -1267,7 +1268,7 @@ protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsFo
12671268
}
12681269
}
12691270
if (suitableVolumeStoragePools.values() != null) {
1270-
poolsToAvoidOutput.removeAll(suitableVolumeStoragePools.keySet());
1271+
poolsToAvoidOutput.removeAll(suitableVolumeStoragePools.values());
12711272
}
12721273
if (avoid.getPoolsToAvoid() != null) {
12731274
avoid.getPoolsToAvoid().addAll(poolsToAvoidOutput);

0 commit comments

Comments
 (0)