You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2014/02/20 20:17:10 UTC

[04/50] [abbrv] git commit: updated refs/heads/ui-restyle to c64bfa5

Findbugs : Fix several "of concern" findings.


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

Branch: refs/heads/ui-restyle
Commit: cc6938e3a8bfa29d4aeccc7ce4218633f17b125a
Parents: 091694c
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Mon Feb 10 21:10:24 2014 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Fri Feb 14 18:37:46 2014 +0100

----------------------------------------------------------------------
 .../PremiumSecondaryStorageManagerImpl.java     | 28 ++++++++++----------
 .../SecondaryStorageManagerImpl.java            |  2 --
 2 files changed, 14 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc6938e3/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java
index af96ed2..15d58be 100755
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java
@@ -64,8 +64,8 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
     HostDao _hostDao;
     @Inject
     ResourceManager _resourceMgr;
-    protected SearchBuilder<CommandExecLogVO> ActiveCommandSearch;
-    protected SearchBuilder<HostVO> HostSearch;
+    protected SearchBuilder<CommandExecLogVO> activeCommandSearch;
+    protected SearchBuilder<HostVO> hostSearch;
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
@@ -77,16 +77,16 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
         int nMaxExecutionMinutes = NumbersUtil.parseInt(_configDao.getValue(Config.SecStorageCmdExecutionTimeMax.key()), 30);
         _maxExecutionTimeMs = nMaxExecutionMinutes * 60 * 1000;
 
-        HostSearch = _hostDao.createSearchBuilder();
-        HostSearch.and("dc", HostSearch.entity().getDataCenterId(), Op.EQ);
-        HostSearch.and("status", HostSearch.entity().getStatus(), Op.EQ);
+        hostSearch = _hostDao.createSearchBuilder();
+        hostSearch.and("dc", hostSearch.entity().getDataCenterId(), Op.EQ);
+        hostSearch.and("status", hostSearch.entity().getStatus(), Op.EQ);
 
-        ActiveCommandSearch = _cmdExecLogDao.createSearchBuilder();
-        ActiveCommandSearch.and("created", ActiveCommandSearch.entity().getCreated(), Op.GTEQ);
-        ActiveCommandSearch.join("hostSearch", HostSearch, ActiveCommandSearch.entity().getInstanceId(), HostSearch.entity().getId(), JoinType.INNER);
+        activeCommandSearch = _cmdExecLogDao.createSearchBuilder();
+        activeCommandSearch.and("created", activeCommandSearch.entity().getCreated(), Op.GTEQ);
+        activeCommandSearch.join("hostSearch", hostSearch, activeCommandSearch.entity().getInstanceId(), hostSearch.entity().getId(), JoinType.INNER);
 
-        HostSearch.done();
-        ActiveCommandSearch.done();
+        hostSearch.done();
+        activeCommandSearch.done();
         return true;
     }
 
@@ -112,12 +112,12 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
         }
 
         List<SecondaryStorageVmVO> alreadyRunning =
-            _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Running, State.Migrating, State.Starting);
+                _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Running, State.Migrating, State.Starting);
         if (alreadyRunning.size() == 0) {
             s_logger.info("No running secondary storage vms found in datacenter id=" + dataCenterId + ", starting one");
 
             List<SecondaryStorageVmVO> stopped =
-                _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Stopped, State.Stopping);
+                    _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Stopped, State.Stopping);
             if (stopped.size() == 0 || !suspendAutoLoading) {
                 List<SecondaryStorageVmVO> stopping = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, State.Stopping);
                 if (stopping.size() > 0) {
@@ -141,7 +141,7 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
             List<CommandExecLogVO> activeCmds = listActiveCommands(dataCenterId, cutTime);
             if (alreadyRunning.size() * _capacityPerSSVM - activeCmds.size() < _standbyCapacity) {
                 s_logger.info("secondary storage command execution standby capactiy low (running VMs: " + alreadyRunning.size() + ", active cmds: " + activeCmds.size() +
-                    "), starting a new one");
+                        "), starting a new one");
                 return new Pair<AfterScanAction, Object>(AfterScanAction.expand, SecondaryStorageVm.Role.commandExecutor);
             }
         }
@@ -166,7 +166,7 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
     }
 
     private List<CommandExecLogVO> listActiveCommands(long dcId, Date cutTime) {
-        SearchCriteria<CommandExecLogVO> sc = ActiveCommandSearch.create();
+        SearchCriteria<CommandExecLogVO> sc = activeCommandSearch.create();
 
         sc.setParameters("created", cutTime);
         sc.setJoinParameters("hostSearch", "dc", dcId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc6938e3/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index 4a59d8f..6fc7eef 100755
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -123,7 +123,6 @@ import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.events.SubscriptionMgr;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
-import com.cloud.vm.Nic;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.SecondaryStorageVm;
@@ -371,7 +370,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
                     allowedCidrs.add(cidr);
                 }
             }
-            List<? extends Nic> nics = _networkModel.getNicsForTraffic(secStorageVm.getId(), TrafficType.Management);
             setupCmd.setAllowedInternalSites(allowedCidrs.toArray(new String[allowedCidrs.size()]));
         }
         String copyPasswd = _configDao.getValue("secstorage.copy.password");