DaanHoogland commented on code in PR #6357:
URL: https://github.com/apache/cloudstack/pull/6357#discussion_r873451924
##########
api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java:
##########
@@ -97,7 +97,10 @@ public String getCommandName() {
public void execute() {
Pair<List<? extends UserVm>, List<String>> vmServiceMap =
_lbService.listLoadBalancerInstances(this);
List<? extends UserVm> result = vmServiceMap.first();
+ s_logger.debug(String.format("A total of [%s] user VMs were obtained
when listing the load balancer instances: [%s].", result.size(),
result.toString()));
Review Comment:
```suggestion
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("A total of [%s] user VMs were
obtained when listing the load balancer instances: [%s].", result.size(),
result.toString()));
}
```
##########
api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java:
##########
@@ -97,7 +97,10 @@ public String getCommandName() {
public void execute() {
Pair<List<? extends UserVm>, List<String>> vmServiceMap =
_lbService.listLoadBalancerInstances(this);
List<? extends UserVm> result = vmServiceMap.first();
+ s_logger.debug(String.format("A total of [%s] user VMs were obtained
when listing the load balancer instances: [%s].", result.size(),
result.toString()));
+
List<String> serviceStates = vmServiceMap.second();
+ s_logger.debug(String.format("A total of [%s] service states were
obtained when listing the load balancer instances: [%s].",
serviceStates.size(), serviceStates.toString()));
Review Comment:
```suggestion
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("A total of [%s] service states
were obtained when listing the load balancer instances: [%s].",
serviceStates.size(), serviceStates.toString()));
}
```
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2231,11 +2234,21 @@ public Pair<List<? extends UserVm>, List<String>>
listLoadBalancerInstances(List
continue;
}
+ String userVmAsString = userVm.toString();
+
boolean isApplied = appliedInstanceIdList.contains(userVm.getId());
- if ((isApplied && applied) || (!isApplied && !applied)) {
- loadBalancerInstances.add(userVm);
- serviceStates.add(vmServiceState.get(userVm.getId()));
+ String isAppliedMsg = isApplied ? "is applied" : "is not applied";
+ s_logger.debug(String.format("The user VM [%s] %s to a rule of the
load balancer [%s].", userVmAsString, isAppliedMsg, loadBalancerAsString));
Review Comment:
```suggestion
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("The user VM [%s] %s to a rule
of the load balancer [%s].", userVmAsString, isAppliedMsg,
loadBalancerAsString));
}
```
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2189,13 +2189,16 @@ public Pair<List<? extends UserVm>, List<String>>
listLoadBalancerInstances(List
Boolean applied = cmd.isApplied();
if (applied == null) {
+ s_logger.debug(String.format("The [%s] parameter was not passed.
Using the default value [%s].", ApiConstants.APPLIED, Boolean.TRUE));
Review Comment:
```suggestion
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("The [%s] parameter was not
passed. Using the default value [%s].", ApiConstants.APPLIED, Boolean.TRUE));
}
```
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2231,11 +2234,21 @@ public Pair<List<? extends UserVm>, List<String>>
listLoadBalancerInstances(List
continue;
}
+ String userVmAsString = userVm.toString();
+
boolean isApplied = appliedInstanceIdList.contains(userVm.getId());
- if ((isApplied && applied) || (!isApplied && !applied)) {
- loadBalancerInstances.add(userVm);
- serviceStates.add(vmServiceState.get(userVm.getId()));
+ String isAppliedMsg = isApplied ? "is applied" : "is not applied";
+ s_logger.debug(String.format("The user VM [%s] %s to a rule of the
load balancer [%s].", userVmAsString, isAppliedMsg, loadBalancerAsString));
+
+ if (isApplied != applied) {
+ s_logger.debug(String.format("Skipping add service state from
the user VM [%s] to the service state list. This happens because the VM %s to
the load "
+ + "balancer rule and the [%s] parameter was passed as
[%s].", userVmAsString, isAppliedMsg, ApiConstants.APPLIED, applied));
+ continue;
}
+ loadBalancerInstances.add(userVm);
+ String serviceState = vmServiceState.get(userVm.getId());
+ s_logger.debug(String.format("Add the service state [%s] from the
user VM [%s] to the service state list.", serviceState, userVmAsString));
Review Comment:
```suggestion
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("Add the service state [%s]
from the user VM [%s] to the service state list.", serviceState,
userVmAsString));
}
```
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2231,11 +2234,21 @@ public Pair<List<? extends UserVm>, List<String>>
listLoadBalancerInstances(List
continue;
}
+ String userVmAsString = userVm.toString();
+
boolean isApplied = appliedInstanceIdList.contains(userVm.getId());
- if ((isApplied && applied) || (!isApplied && !applied)) {
- loadBalancerInstances.add(userVm);
- serviceStates.add(vmServiceState.get(userVm.getId()));
+ String isAppliedMsg = isApplied ? "is applied" : "is not applied";
+ s_logger.debug(String.format("The user VM [%s] %s to a rule of the
load balancer [%s].", userVmAsString, isAppliedMsg, loadBalancerAsString));
+
+ if (isApplied != applied) {
+ s_logger.debug(String.format("Skipping add service state from
the user VM [%s] to the service state list. This happens because the VM %s to
the load "
+ + "balancer rule and the [%s] parameter was passed as
[%s].", userVmAsString, isAppliedMsg, ApiConstants.APPLIED, applied));
Review Comment:
```suggestion
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("Skipping add service state
from the user VM [%s] to the service state list. This happens because the VM %s
to the load "
+ "balancer rule and the [%s] parameter was passed
as [%s].", userVmAsString, isAppliedMsg, ApiConstants.APPLIED, applied));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]