cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [06/11] git commit: updated refs/heads/4.3 to d6bbfbb
Date Wed, 29 Jan 2014 20:59:37 GMT
Findbugs issues in ApiResponseHelper fixes

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

Branch: refs/heads/4.3
Commit: c3a63b6b5ae5bad3e753d7bd348612f53ca8ebac
Parents: 9776e1a
Author: Daan Hoogland <daan@onecht.net>
Authored: Sun Jan 26 12:25:18 2014 +0100
Committer: Daan Hoogland <dhoogland@schubergphilis.com>
Committed: Wed Jan 29 21:31:54 2014 +0100

----------------------------------------------------------------------
 .../com/cloud/network/rules/FirewallRule.java   |  3 ++-
 api/src/com/cloud/network/vpc/StaticRoute.java  |  3 ++-
 server/src/com/cloud/api/ApiResponseHelper.java | 21 +++++++++-----------
 3 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3a63b6b/api/src/com/cloud/network/rules/FirewallRule.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/FirewallRule.java b/api/src/com/cloud/network/rules/FirewallRule.java
index 042665c..0c74d02 100644
--- a/api/src/com/cloud/network/rules/FirewallRule.java
+++ b/api/src/com/cloud/network/rules/FirewallRule.java
@@ -41,7 +41,8 @@ public interface FirewallRule extends ControlledEntity, Identity, InternalIdenti
         Staged, // Rule been created but has never got through network rule conflict detection.
 Rules in this state can not be sent to network elements.
         Add,    // Add means the rule has been created and has gone through network rule
conflict detection.
         Active, // Rule has been sent to the network elements and reported to be active.
-        Revoke  // Revoke means this rule has been revoked. If this rule has been sent to
the network elements, the rule will be deleted from database.
+        Revoke,  // Revoke means this rule has been revoked. If this rule has been sent to
the network elements, the rule will be deleted from database.
+        Deleting // rule has been revoked and is scheduled for deletion
     }
 
     enum TrafficType {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3a63b6b/api/src/com/cloud/network/vpc/StaticRoute.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/StaticRoute.java b/api/src/com/cloud/network/vpc/StaticRoute.java
index ccdbec8..5707ca1 100644
--- a/api/src/com/cloud/network/vpc/StaticRoute.java
+++ b/api/src/com/cloud/network/vpc/StaticRoute.java
@@ -25,7 +25,8 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
         Staged, // route been created but has never got through network rule conflict detection.
 Routes in this state can not be sent to VPC virtual router.
         Add,    // Add means the route has been created and has gone through network rule
conflict detection.
         Active, // Route has been sent to the VPC router and reported to be active.
-        Revoke  // Revoke means this route has been revoked. If this route has been sent
to the VPC router, the route will be deleted from database.
+        Revoke,  // Revoke means this route has been revoked. If this route has been sent
to the VPC router, the route will be deleted from database.
+        Deleting // rule has been revoked and is scheduled for deletion
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3a63b6b/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index ceb4ad6..5bd8241 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -31,6 +31,8 @@ import java.util.TimeZone;
 
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.affinity.AffinityGroup;
@@ -146,7 +148,6 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.usage.Usage;
 import org.apache.cloudstack.usage.UsageService;
 import org.apache.cloudstack.usage.UsageTypes;
-import org.apache.log4j.Logger;
 
 import com.cloud.api.query.ViewResponseHelper;
 import com.cloud.api.query.vo.AccountJoinVO;
@@ -285,7 +286,6 @@ import com.cloud.uservm.UserVm;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.db.EntityManager;
-import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.ConsoleProxyVO;
@@ -387,7 +387,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
         resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().getOrdinal()).toString());
         if((limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage)
&& limit.getMax() >= 0) {
-            resourceLimitResponse.setMax((long)Math.ceil((limit.getMax() / ResourceType.bytesToGiB)));
+            resourceLimitResponse.setMax((long)Math.ceil((double)limit.getMax() / ResourceType.bytesToGiB));
         } else {
             resourceLimitResponse.setMax(limit.getMax());
         }
@@ -1951,8 +1951,6 @@ public class ApiResponseHelper implements ResponseGenerator {
     public SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<?
extends SecurityRule> securityRules) {
         SecurityGroupResponse response = new SecurityGroupResponse();
         Map<Long, Account> securiytGroupAccounts = new HashMap<Long, Account>();
-        Map<Long, SecurityGroup> allowedSecurityGroups = new HashMap<Long, SecurityGroup>();
-        Map<Long, Account> allowedSecuriytGroupAccounts = new HashMap<Long, Account>();
 
         if ((securityRules != null) && !securityRules.isEmpty()) {
             SecurityGroupJoinVO securityGroup = ApiDBUtils.findSecurityGroupViewById(securityRules.get(0).getSecurityGroupId()).get(0);
@@ -3137,11 +3135,10 @@ public class ApiResponseHelper implements ResponseGenerator {
         response.setCidr(result.getCidr());
 
         StaticRoute.State state = result.getState();
-        String stateToSet = state.toString();
-        if (state.equals(FirewallRule.State.Revoke)) {
-            stateToSet = "Deleting";
+        if (state.equals(StaticRoute.State.Revoke)) {
+            state = StaticRoute.State.Deleting;
         }
-        response.setState(stateToSet);
+        response.setState(state.toString());
         populateAccount(response, result.getAccountId());
         populateDomain(response, result.getDomainId());
 
@@ -3629,11 +3626,11 @@ public class ApiResponseHelper implements ResponseGenerator {
         ApplicationLoadBalancerRuleResponse ruleResponse = new ApplicationLoadBalancerRuleResponse();
         ruleResponse.setInstancePort(lb.getDefaultPortStart());
         ruleResponse.setSourcePort(lb.getSourcePortStart());
-        String stateToSet = lb.getState().toString();
+        FirewallRule.State stateToSet = lb.getState();
         if (stateToSet.equals(FirewallRule.State.Revoke)) {
-            stateToSet = "Deleting";
+            stateToSet = FirewallRule.State.Deleting;
         }
-        ruleResponse.setState(stateToSet);
+        ruleResponse.setState(stateToSet.toString());
         ruleResponse.setObjectName("loadbalancerrule");
         ruleResponses.add(ruleResponse);
         lbResponse.setLbRules(ruleResponses);


Mime
View raw message