cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From santhosheduku...@apache.org
Subject git commit: updated refs/heads/master to 92c70f0
Date Fri, 01 Aug 2014 10:46:54 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master d28da9d98 -> 92c70f03e


Fixed Coverity Issues


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92c70f03
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92c70f03
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92c70f03

Branch: refs/heads/master
Commit: 92c70f03e0b0da53c6ebd53e6d1491b999e2cc18
Parents: d28da9d
Author: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Authored: Fri Aug 1 16:15:30 2014 +0530
Committer: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Committed: Fri Aug 1 16:16:12 2014 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/HypervisorGuruBase.java    | 10 +++----
 .../com/cloud/network/NetworkServiceImpl.java   | 30 +++++++++-----------
 .../com/cloud/network/vpc/VpcManagerImpl.java   | 10 ++++---
 3 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92c70f03/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index 3d3b6d4..8ffd6ea 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -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;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92c70f03/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 9d1fc66..130d051 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -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;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92c70f03/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index d58c0a4..a45edea 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -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);


Mime
View raw message