mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
findbugs: nullpointer guards and wrappertype comparisons(cherry picked
from commit 791b7f8f7fe8f7d342e46fbb61a3f421e87fca59)
This commit is contained in:
parent
9edeb24f3f
commit
5d8e8fd3a2
@ -877,7 +877,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
|
||||
}
|
||||
_resourceCountDao.setResourceCount(accountId, ResourceOwnerType.Account, type, (newCount == null) ? 0 : newCount.longValue());
|
||||
|
||||
if (oldCount != newCount) {
|
||||
if (!Long.valueOf(oldCount).equals(newCount)) {
|
||||
s_logger.info("Discrepency in the resource count " + "(original count=" + oldCount + " correct count = " + newCount + ") for type " + type +
|
||||
" for account ID " + accountId + " is fixed during resource count recalculation.");
|
||||
}
|
||||
|
||||
@ -449,8 +449,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
volume.setPoolId(null);
|
||||
volume.setDataCenterId(zoneId);
|
||||
volume.setPodId(null);
|
||||
volume.setAccountId(owner.getAccountId());
|
||||
volume.setDomainId(owner.getDomainId());
|
||||
volume.setAccountId((owner == null) ? null : owner.getAccountId());
|
||||
volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId());
|
||||
long diskOfferingId = _diskOfferingDao.findByUniqueName("Cloud.com-Custom").getId();
|
||||
volume.setDiskOfferingId(diskOfferingId);
|
||||
// volume.setSize(size);
|
||||
|
||||
@ -34,6 +34,9 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
@ -79,8 +82,6 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -458,7 +459,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
protected boolean _dailyOrHourly = false;
|
||||
private int capacityReleaseInterval;
|
||||
|
||||
protected String _name;
|
||||
protected String _instance;
|
||||
protected String _zone;
|
||||
protected boolean _instanceNameFlag;
|
||||
@ -4004,13 +4004,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
|
||||
//if hosts are dedicated to different account/domains, raise an alert
|
||||
if (srcExplDedicated && destExplDedicated) {
|
||||
if ((accountOfDedicatedHost(srcHost) != null) && (accountOfDedicatedHost(srcHost) != accountOfDedicatedHost(destHost))) {
|
||||
if (!((accountOfDedicatedHost(srcHost) == null) || (accountOfDedicatedHost(srcHost).equals(accountOfDedicatedHost(destHost))))) {
|
||||
String msg = "VM is being migrated from host " + srcHost.getName() + " explicitly dedicated to account " + accountOfDedicatedHost(srcHost) + " to host "
|
||||
+ destHost.getName() + " explicitly dedicated to account " + accountOfDedicatedHost(destHost);
|
||||
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_USERVM, vm.getDataCenterId(), vm.getPodIdToDeployIn(), msg, msg);
|
||||
s_logger.warn(msg);
|
||||
}
|
||||
if ((domainOfDedicatedHost(srcHost) != null) && (domainOfDedicatedHost(srcHost) != domainOfDedicatedHost(destHost))) {
|
||||
if (!((domainOfDedicatedHost(srcHost) == null) || (domainOfDedicatedHost(srcHost).equals(domainOfDedicatedHost(destHost))))) {
|
||||
String msg = "VM is being migrated from host " + srcHost.getName() + " explicitly dedicated to domain " + domainOfDedicatedHost(srcHost) + " to host "
|
||||
+ destHost.getName() + " explicitly dedicated to domain " + domainOfDedicatedHost(destHost);
|
||||
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_USERVM, vm.getDataCenterId(), vm.getPodIdToDeployIn(), msg, msg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user