mirror of https://github.com/apache/cloudstack.git
Findbugs: different issues solved
This commit is contained in:
parent
866a539b06
commit
0b13f8e59d
|
|
@ -36,6 +36,7 @@ import com.cloud.storage.Storage.StoragePoolType;
|
|||
import com.cloud.storage.Volume;
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
|
||||
|
|
@ -48,10 +49,10 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private long id;
|
||||
|
||||
@Column(name="name", updatable=false, nullable=false, length=255)
|
||||
private String name = null;
|
||||
private final String name = null;
|
||||
|
||||
@Column(name="display_name", updatable=false, nullable=false, length=255)
|
||||
private String displayName = null;
|
||||
private final String displayName = null;
|
||||
|
||||
@Column(name="account_id")
|
||||
private long accountId;
|
||||
|
|
@ -60,7 +61,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private String accountUuid;
|
||||
|
||||
@Column(name="account_name")
|
||||
private String accountName = null;
|
||||
private final String accountName = null;
|
||||
|
||||
@Column(name="account_type")
|
||||
private short accountType;
|
||||
|
|
@ -72,10 +73,10 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private String domainUuid;
|
||||
|
||||
@Column(name="domain_name")
|
||||
private String domainName = null;
|
||||
private final String domainName = null;
|
||||
|
||||
@Column(name="domain_path")
|
||||
private String domainPath = null;
|
||||
private final String domainPath = null;
|
||||
|
||||
@Column(name="instance_group_id")
|
||||
private long instanceGroupId;
|
||||
|
|
@ -97,7 +98,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
*/
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@Column(name="state", updatable=true, nullable=false, length=32)
|
||||
private State state = null;
|
||||
private final State state = null;
|
||||
|
||||
@Column(name=GenericDao.CREATED_COLUMN)
|
||||
private Date created;
|
||||
|
|
@ -154,7 +155,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private String dataCenterUuid;
|
||||
|
||||
@Column(name="data_center_name")
|
||||
private String dataCenterName = null;
|
||||
private final String dataCenterName = null;
|
||||
|
||||
@Column(name="security_group_enabled")
|
||||
private boolean securityGroupEnabled;
|
||||
|
|
@ -230,7 +231,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private String volume_uuid;
|
||||
|
||||
@Column(name = "volume_device_id")
|
||||
private Long volumeDeviceId = null;
|
||||
private final Long volumeDeviceId = null;
|
||||
|
||||
@Column(name = "volume_type")
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
|
@ -735,9 +736,11 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
}
|
||||
|
||||
public String getDetail(String name) {
|
||||
assert (details != null) : "Did you forget to load the details?";
|
||||
if (details == null) {
|
||||
throw new CloudRuntimeException("No details to get. Did you forget to load the details?");
|
||||
}
|
||||
|
||||
return details != null ? details.get(name) : null;
|
||||
return details.get(name);
|
||||
}
|
||||
|
||||
public String getUserData() {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ import java.util.Random;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
import com.cloud.agent.api.Answer;
|
||||
|
|
@ -44,14 +49,10 @@ import com.cloud.server.ManagementServer;
|
|||
import com.cloud.servlet.ConsoleProxyPasswordBasedEncryptor;
|
||||
import com.cloud.servlet.ConsoleProxyServlet;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
/**
|
||||
* Utility class to manage interactions with agent-based console access
|
||||
* Extracted from ConsoleProxyManagerImpl so that other console proxy managers
|
||||
|
|
@ -72,12 +73,12 @@ public abstract class AgentHookBase implements AgentHook {
|
|||
|
||||
public AgentHookBase(VMInstanceDao instanceDao, HostDao hostDao, ConfigurationDao cfgDao, KeystoreManager ksMgr,
|
||||
AgentManager agentMgr, ManagementServer ms) {
|
||||
this._instanceDao = instanceDao;
|
||||
this._hostDao = hostDao;
|
||||
this._agentMgr = agentMgr;
|
||||
this._configDao = cfgDao;
|
||||
this._ksMgr = ksMgr;
|
||||
this._ms = ms;
|
||||
_instanceDao = instanceDao;
|
||||
_hostDao = hostDao;
|
||||
_agentMgr = agentMgr;
|
||||
_configDao = cfgDao;
|
||||
_ksMgr = ksMgr;
|
||||
_ms = ms;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -204,7 +205,9 @@ public abstract class AgentHookBase implements AgentHook {
|
|||
|
||||
assert (ksBits != null);
|
||||
if (ksBits == null) {
|
||||
s_logger.error("Could not find and construct a valid SSL certificate");
|
||||
String msg = "Could not find and construct a valid SSL certificate";
|
||||
s_logger.error(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
cmd = new StartConsoleProxyAgentHttpHandlerCommand(ksBits, storePassword);
|
||||
cmd.setEncryptorPassword(getEncryptorPassword());
|
||||
|
|
|
|||
|
|
@ -971,11 +971,7 @@ VirtualMachineGuru, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
|
|||
}
|
||||
} else {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (template == null) {
|
||||
s_logger.debug("Zone host is ready, but console proxy template is null");
|
||||
} else {
|
||||
s_logger.debug("Zone host is ready, but console proxy template: " + template.getId() + " is not ready on secondary storage.");
|
||||
}
|
||||
s_logger.debug("Zone host is ready, but console proxy template: " + template.getId() + " is not ready on secondary storage.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import java.util.UUID;
|
|||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
|
|
@ -31,6 +30,11 @@ import javax.persistence.Table;
|
|||
@Table(name="dedicated_resources")
|
||||
public class DedicatedResourceVO implements DedicatedResources{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6659510127145101917L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
|
|
@ -61,7 +65,7 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
private long affinityGroupId;
|
||||
|
||||
public DedicatedResourceVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public DedicatedResourceVO(Long dataCenterId, Long podId, Long clusterId, Long hostId, Long domainId,
|
||||
|
|
@ -72,14 +76,16 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
this.hostId = hostId;
|
||||
this.domainId = domainId;
|
||||
this.accountId = accountId;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
this.affinityGroupId = affinityGroupId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getDataCenterId() {
|
||||
return dataCenterId;
|
||||
}
|
||||
|
|
@ -88,6 +94,7 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
this.dataCenterId = dataCenterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
|
@ -96,6 +103,7 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
this.podId = podId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getClusterId() {
|
||||
return clusterId;
|
||||
}
|
||||
|
|
@ -104,6 +112,7 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
|
@ -113,9 +122,10 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
}
|
||||
|
||||
public DedicatedResourceVO(long dedicatedResourceId) {
|
||||
this.id = dedicatedResourceId;
|
||||
id = dedicatedResourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
|
@ -124,6 +134,7 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
|
@ -132,14 +143,16 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return this.uuid;
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAffinityGroupId() {
|
||||
return affinityGroupId;
|
||||
}
|
||||
|
|
@ -147,7 +160,7 @@ public class DedicatedResourceVO implements DedicatedResources{
|
|||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof DedicatedResourceVO) {
|
||||
return ((DedicatedResourceVO) obj).getId() == this.getId();
|
||||
return ((DedicatedResourceVO) obj).getId() == getId();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package com.cloud.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
|
@ -29,6 +30,7 @@ import java.util.UUID;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
|
@ -138,14 +140,14 @@ import com.cloud.utils.db.DB;
|
|||
import com.cloud.utils.db.EntityManager;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GlobalLock;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionCallbackNoReturn;
|
||||
import com.cloud.utils.db.TransactionCallbackWithException;
|
||||
import com.cloud.utils.db.JoinBuilder.JoinType;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionCallbackNoReturn;
|
||||
import com.cloud.utils.db.TransactionCallbackWithException;
|
||||
import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
|
@ -578,8 +580,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
|
||||
IPAddressVO ip = markIpAsUnavailable(addrId);
|
||||
|
||||
assert (ip != null) : "Unable to mark the ip address id=" + addrId + " as unavailable.";
|
||||
if (ip == null) {
|
||||
String msg = "Unable to mark the ip address id=" + addrId + " as unavailable.";
|
||||
s_logger.error(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -692,10 +695,10 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
if (dedicatedVlanDbIds != null && !dedicatedVlanDbIds.isEmpty()) {
|
||||
fetchFromDedicatedRange = true;
|
||||
sc.setParameters("vlanId", dedicatedVlanDbIds.toArray());
|
||||
errorMessage.append(", vlanId id=" + dedicatedVlanDbIds.toArray());
|
||||
errorMessage.append(", vlanId id=" + Arrays.toString(dedicatedVlanDbIds.toArray()));
|
||||
} else if (nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
|
||||
sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
|
||||
errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());
|
||||
errorMessage.append(", vlanId id=" + Arrays.toString(nonDedicatedVlanDbIds.toArray()));
|
||||
} else {
|
||||
if (podId != null) {
|
||||
InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", Pod.class, podId);
|
||||
|
|
@ -735,7 +738,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
if (useSystemIps && nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
|
||||
fetchFromDedicatedRange = false;
|
||||
sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
|
||||
errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());
|
||||
errorMessage.append(", vlanId id=" + Arrays.toString(nonDedicatedVlanDbIds.toArray()));
|
||||
addrs = _ipAddressDao.lockRows(sc, filter, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -868,6 +871,11 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
public PublicIp assignDedicateIpAddress(Account owner, final Long guestNtwkId, final Long vpcId, final long dcId, final boolean isSourceNat) throws ConcurrentOperationException,
|
||||
InsufficientAddressCapacityException {
|
||||
|
||||
if (owner == null) {
|
||||
s_logger.error("No account to assign an ip to.");
|
||||
return null;
|
||||
}
|
||||
|
||||
final long ownerId = owner.getId();
|
||||
|
||||
PublicIp ip = null;
|
||||
|
|
@ -899,13 +907,11 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
|
||||
return ip;
|
||||
} finally {
|
||||
if (owner != null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Releasing lock account " + ownerId);
|
||||
}
|
||||
|
||||
_accountDao.releaseFromLockTable(ownerId);
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Releasing lock account " + ownerId);
|
||||
}
|
||||
_accountDao.releaseFromLockTable(ownerId);
|
||||
|
||||
if (ip == null) {
|
||||
s_logger.error("Unable to get source nat ip address for account " + ownerId);
|
||||
}
|
||||
|
|
@ -1253,7 +1259,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
|
||||
s_logger.debug("Associating ip " + ipToAssoc + " to network " + network);
|
||||
|
||||
IPAddressVO ip = _ipAddressDao.findById(ipId);
|
||||
IPAddressVO ip = ipToAssoc; //_ipAddressDao.findById(ipId);
|
||||
//update ip address with networkId
|
||||
ip.setAssociatedWithNetworkId(networkId);
|
||||
ip.setSourceNat(isSourceNat);
|
||||
|
|
@ -1270,18 +1276,16 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
return ip;
|
||||
} finally {
|
||||
if (!success && releaseOnFailure) {
|
||||
if (ip != null) {
|
||||
try {
|
||||
s_logger.warn("Failed to associate ip address, so releasing ip from the database " + ip);
|
||||
_ipAddressDao.markAsUnavailable(ip.getId());
|
||||
if (!applyIpAssociations(network, true)) {
|
||||
// if fail to apply ip assciations again, unassign ip address without updating resource
|
||||
// count and generating usage event as there is no need to keep it in the db
|
||||
_ipAddressDao.unassignIpAddress(ip.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Unable to disassociate ip address for recovery", e);
|
||||
try {
|
||||
s_logger.warn("Failed to associate ip address, so releasing ip from the database " + ip);
|
||||
_ipAddressDao.markAsUnavailable(ip.getId());
|
||||
if (!applyIpAssociations(network, true)) {
|
||||
// if fail to apply ip assciations again, unassign ip address without updating resource
|
||||
// count and generating usage event as there is no need to keep it in the db
|
||||
_ipAddressDao.unassignIpAddress(ip.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Unable to disassociate ip address for recovery", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1362,7 +1366,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
PublicIp publicIp = PublicIp.createFromAddrAndVlan(ipToAssoc, _vlanDao.findById(ipToAssoc.getVlanId()));
|
||||
ipList.add(publicIp);
|
||||
Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true);
|
||||
if (ipToServices != null & !ipToServices.isEmpty()) {
|
||||
if (ipToServices != null && !ipToServices.isEmpty()) {
|
||||
Set<Service> services = ipToServices.get(publicIp);
|
||||
if (services != null && !services.isEmpty()) {
|
||||
throw new InvalidParameterValueException("IP " + ipToAssoc + " has services and rules associated in the network " + networkId);
|
||||
|
|
@ -1403,7 +1407,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId()));
|
||||
ipList.add(publicIp);
|
||||
Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true);
|
||||
if (ipToServices != null & !ipToServices.isEmpty()) {
|
||||
if (ipToServices != null && !ipToServices.isEmpty()) {
|
||||
Set<Service> ipServices = ipToServices.get(publicIp);
|
||||
if (ipServices != null && !ipServices.isEmpty()) {
|
||||
return false;
|
||||
|
|
@ -1732,14 +1736,14 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
|
||||
@Override
|
||||
public boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException {
|
||||
Network network = _networksDao.findById(staticNats.get(0).getNetworkId());
|
||||
boolean success = true;
|
||||
|
||||
if (staticNats == null || staticNats.size() == 0) {
|
||||
s_logger.debug("There are no static nat rules for the network elements");
|
||||
return true;
|
||||
}
|
||||
|
||||
Network network = _networksDao.findById(staticNats.get(0).getNetworkId());
|
||||
boolean success = true;
|
||||
|
||||
// get the list of public ip's owned by the network
|
||||
List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), null);
|
||||
List<PublicIp> publicIps = new ArrayList<PublicIp>();
|
||||
|
|
|
|||
|
|
@ -1024,14 +1024,14 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
List<NetworkOfferingServiceMapVO> map = _ntwkOfferingSrvcDao.listByNetworkOfferingId(networkOfferingId);
|
||||
|
||||
for (NetworkOfferingServiceMapVO instance : map) {
|
||||
String service = instance.getService();
|
||||
Service service = Network.Service.getService(instance.getService());
|
||||
Set<Provider> providers;
|
||||
providers = serviceProviderMap.get(service);
|
||||
if (providers == null) {
|
||||
providers = new HashSet<Provider>();
|
||||
}
|
||||
providers.add(Provider.getProvider(instance.getProvider()));
|
||||
serviceProviderMap.put(Service.getService(service), providers);
|
||||
serviceProviderMap.put(service, providers);
|
||||
}
|
||||
|
||||
return serviceProviderMap;
|
||||
|
|
@ -1526,12 +1526,15 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
|
||||
@Override
|
||||
public void checkNetworkPermissions(Account owner, Network network) {
|
||||
if (network == null) {
|
||||
throw new CloudRuntimeException("no network to check permissions for.");
|
||||
}
|
||||
// Perform account permission check
|
||||
if (network.getGuestType() != Network.GuestType.Shared
|
||||
|| (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
|
||||
AccountVO networkOwner = _accountDao.findById(network.getAccountId());
|
||||
if(networkOwner == null)
|
||||
throw new PermissionDeniedException("Unable to use network with id= " + ((network != null)? ((NetworkVO)network).getUuid() : "") + ", network does not have an owner");
|
||||
throw new PermissionDeniedException("Unable to use network with id= " + ((NetworkVO)network).getUuid() + ", network does not have an owner");
|
||||
if(owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT){
|
||||
if(!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(), network.getAccountId())){
|
||||
throw new PermissionDeniedException("Unable to use network with id= " + ((network != null)? ((NetworkVO)network).getUuid() : "") + ", permission denied");
|
||||
|
|
@ -1545,7 +1548,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
|
||||
} else {
|
||||
if (!isNetworkAvailableInDomain(network.getId(), owner.getDomainId())) {
|
||||
throw new PermissionDeniedException("Shared network id=" + ((network != null)? ((NetworkVO)network).getUuid() : "") + " is not available in domain id=" + owner.getDomainId());
|
||||
throw new PermissionDeniedException("Shared network id=" + ((NetworkVO)network).getUuid() + " is not available in domain id=" + owner.getDomainId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
|||
assert nic.getTrafficType() == TrafficType.Control;
|
||||
|
||||
// we have to get management/private ip for the control nic for vmware/hyperv due ssh issues.
|
||||
HypervisorType hType = dest.getHost().getHypervisorType();
|
||||
HypervisorType hType = dest.getHost().getHypervisorType();
|
||||
if ( ( (hType == HypervisorType.VMware) || (hType == HypervisorType.Hyperv) )&& isRouterVm(vm)) {
|
||||
if(dest.getDataCenter().getNetworkType() != NetworkType.Basic) {
|
||||
super.reserve(nic, config, vm, dest, context);
|
||||
|
|
@ -168,7 +168,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
|||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
assert nic.getTrafficType() == TrafficType.Control;
|
||||
HypervisorType hType = vm.getHypervisorType();
|
||||
HypervisorType hType = vm.getHypervisorType();
|
||||
if ( ( (hType == HypervisorType.VMware) || (hType == HypervisorType.Hyperv) )&& isRouterVm(vm)) {
|
||||
long dcId = vm.getVirtualMachine().getDataCenterId();
|
||||
DataCenterVO dcVo = _dcDao.findById(dcId);
|
||||
|
|
@ -218,12 +218,12 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
|||
|
||||
Map<String, String> dbParams = _configDao.getConfiguration(params);
|
||||
|
||||
_cidr = dbParams.get(Config.ControlCidr);
|
||||
_cidr = dbParams.get(Config.ControlCidr.toString());
|
||||
if (_cidr == null) {
|
||||
_cidr = "169.254.0.0/16";
|
||||
}
|
||||
|
||||
_gateway = dbParams.get(Config.ControlGateway);
|
||||
_gateway = dbParams.get(Config.ControlGateway.toString());
|
||||
if (_gateway == null) {
|
||||
_gateway = NetUtils.getLinkLocalGateway();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -432,14 +432,14 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
List<VpcOfferingServiceMapVO> map = _vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
|
||||
|
||||
for (VpcOfferingServiceMapVO instance : map) {
|
||||
String service = instance.getService();
|
||||
Service service = Service.getService(instance.getService());
|
||||
Set<Provider> providers;
|
||||
providers = serviceProviderMap.get(service);
|
||||
if (providers == null) {
|
||||
providers = new HashSet<Provider>();
|
||||
}
|
||||
providers.add(Provider.getProvider(instance.getProvider()));
|
||||
serviceProviderMap.put(Service.getService(service), providers);
|
||||
serviceProviderMap.put(service, providers);
|
||||
}
|
||||
|
||||
return serviceProviderMap;
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
if (isISO) {
|
||||
desc = Upload.Type.ISO.toString();
|
||||
}
|
||||
eventId = eventId == null ? 0 : eventId;
|
||||
eventId = (eventId == null ? 0 : eventId);
|
||||
|
||||
if (!_accountMgr.isRootAdmin(caller.getType()) && _disableExtraction) {
|
||||
throw new PermissionDeniedException("Extraction has been disabled by admin");
|
||||
|
|
@ -1801,7 +1801,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
}
|
||||
|
||||
// Don't allow to modify system template
|
||||
if (id == Long.valueOf(1)) {
|
||||
if (Long.valueOf(1).equals(id)) {
|
||||
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id");
|
||||
ex.addProxyObject(String.valueOf(id), "templateId");
|
||||
throw ex;
|
||||
|
|
|
|||
Loading…
Reference in New Issue