Fixed Coverity Issues

This commit is contained in:
Santhosh Edukulla 2014-08-01 16:15:30 +05:30
parent d28da9d986
commit 92c70f03e0
3 changed files with 25 additions and 25 deletions

View File

@ -105,6 +105,11 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
if (nicVO.getVmType() != VirtualMachine.Type.User) {
to.setPxeDisable(true);
}
List<String> secIps = null;
if (nicVO.getSecondaryIp()) {
secIps = _nicSecIpDao.getSecondaryIpAddressesForNic(nicVO.getId());
}
to.setNicSecIps(secIps);
} else {
s_logger.warn("Unabled to load NicVO for NicProfile " + profile.getId());
}
@ -112,11 +117,6 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
//check whether the this nic has secondary ip addresses set
//set nic secondary ip address in NicTO which are used for security group
// configuration. Use full when vm stop/start
List<String> secIps = null;
if (nicVO.getSecondaryIp()) {
secIps = _nicSecIpDao.getSecondaryIpAddressesForNic(nicVO.getId());
}
to.setNicSecIps(secIps);
return to;
}

View File

@ -1385,7 +1385,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, displayNetwork, isolatedPvlan);
}
if (_accountMgr.isRootAdmin(caller.getId()) && createVlan) {
if (_accountMgr.isRootAdmin(caller.getId()) && createVlan && network != null) {
// Create vlan ip range
_configMgr.createVlanAndPublicIpRange(pNtwk.getDataCenterId(), network.getId(), physicalNetworkId, false, null, startIP, endIP, gateway, netmask, vlanId,
null, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
@ -3996,23 +3996,21 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
+ " in zone " + _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
}
}
//add entry to private_ip_address table
PrivateIpVO privateIp = _privateIpDao.findByIpAndSourceNetworkIdAndVpcId(privateNetwork.getId(), startIp, vpcId);
if (privateIp != null) {
throw new InvalidParameterValueException("Private ip address " + startIp + " already used for private gateway" + " in zone "
+ _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
if (vpcId != null) {
//add entry to private_ip_address table
PrivateIpVO privateIp = _privateIpDao.findByIpAndSourceNetworkIdAndVpcId(privateNetwork.getId(), startIp, vpcId);
if (privateIp != null) {
throw new InvalidParameterValueException("Private ip address " + startIp + " already used for private gateway" + " in zone "
+ _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
}
Long mac = dc.getMacAddress();
Long nextMac = mac + 1;
dc.setMacAddress(nextMac);
privateIp = new PrivateIpVO(startIp, privateNetwork.getId(), nextMac, vpcId, sourceNat);
_privateIpDao.persist(privateIp);
_dcDao.update(dc.getId(), dc);
}
Long mac = dc.getMacAddress();
Long nextMac = mac + 1;
dc.setMacAddress(nextMac);
privateIp = new PrivateIpVO(startIp, privateNetwork.getId(), nextMac, vpcId, sourceNat);
_privateIpDao.persist(privateIp);
_dcDao.update(dc.getId(), dc);
s_logger.debug("Private network " + privateNetwork + " is created");
return privateNetwork;

View File

@ -2194,10 +2194,12 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
try {
// Cleanup inactive VPCs
List<VpcVO> inactiveVpcs = _vpcDao.listInactiveVpcs();
s_logger.info("Found " + inactiveVpcs.size() + " removed VPCs to cleanup");
for (VpcVO vpc : inactiveVpcs) {
s_logger.debug("Cleaning up " + vpc);
destroyVpc(vpc, _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM), User.UID_SYSTEM);
if (inactiveVpcs != null) {
s_logger.info("Found " + inactiveVpcs.size() + " removed VPCs to cleanup");
for (VpcVO vpc : inactiveVpcs) {
s_logger.debug("Cleaning up " + vpc);
destroyVpc(vpc, _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM), User.UID_SYSTEM);
}
}
} catch (Exception e) {
s_logger.error("Exception ", e);