Skip to content

Commit ed2e8a6

Browse files
committed
Change conditional
1 parent f32807a commit ed2e8a6

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,19 +1245,22 @@ protected Integer getVirtualMachineMaxNicsValueFromCluster(VirtualMachine virtua
12451245
protected Integer getVirtualMachineMaxNicsValueFromCluster(ClusterVO cluster) {
12461246
HypervisorType clusterHypervisor = cluster.getHypervisorType();
12471247

1248-
switch (clusterHypervisor) {
1249-
case KVM:
1250-
logger.debug("The cluster {} where the VM is deployed uses the {} hypervisor. Therefore, the {} setting value [{}] will be used.", cluster.getName(), clusterHypervisor, VirtualMachineMaxNicsKvm, VirtualMachineMaxNicsKvm.valueIn(cluster.getId()));
1251-
return VirtualMachineMaxNicsKvm.valueIn(cluster.getId());
1252-
case VMware:
1253-
logger.debug("The cluster {} where the VM is deployed uses the {} hypervisor. Therefore, the {} setting value [{}] will be used.", cluster.getName(), clusterHypervisor, VirtualMachineMaxNicsKvm, VirtualMachineMaxNicsVmware.valueIn(cluster.getId()));
1254-
return VirtualMachineMaxNicsVmware.valueIn(cluster.getId());
1255-
case XenServer:
1256-
logger.debug("The cluster {} where the VM is deployed uses the {} hypervisor. Therefore, the {} setting value [{}] will be used.", cluster.getName(), clusterHypervisor, VirtualMachineMaxNicsXenserver, VirtualMachineMaxNicsXenserver.valueIn(cluster.getId()));
1257-
return VirtualMachineMaxNicsXenserver.valueIn(cluster.getId());
1258-
default:
1259-
return null;
1248+
if (clusterHypervisor.equals(HypervisorType.KVM)) {
1249+
logger.debug("The cluster {} where the VM is deployed uses the {} hypervisor. Therefore, the {} setting value [{}] will be used.", cluster.getName(), clusterHypervisor, VirtualMachineMaxNicsKvm, VirtualMachineMaxNicsKvm.valueIn(cluster.getId()));
1250+
return VirtualMachineMaxNicsKvm.valueIn(cluster.getId());
1251+
}
1252+
1253+
if (clusterHypervisor.equals(HypervisorType.VMware)) {
1254+
logger.debug("The cluster {} where the VM is deployed uses the {} hypervisor. Therefore, the {} setting value [{}] will be used.", cluster.getName(), clusterHypervisor, VirtualMachineMaxNicsKvm, VirtualMachineMaxNicsVmware.valueIn(cluster.getId()));
1255+
return VirtualMachineMaxNicsVmware.valueIn(cluster.getId());
12601256
}
1257+
1258+
if (clusterHypervisor.equals(HypervisorType.XenServer)) {
1259+
logger.debug("The cluster {} where the VM is deployed uses the {} hypervisor. Therefore, the {} setting value [{}] will be used.", cluster.getName(), clusterHypervisor, VirtualMachineMaxNicsXenserver, VirtualMachineMaxNicsXenserver.valueIn(cluster.getId()));
1260+
return VirtualMachineMaxNicsXenserver.valueIn(cluster.getId());
1261+
}
1262+
1263+
return null;
12611264
}
12621265

12631266
/**
@@ -1269,20 +1272,23 @@ protected Integer getVirtualMachineMaxNicsValueFromCluster(ClusterVO cluster) {
12691272
protected Integer getVirtualMachineMaxNicsValueFromVmHypervisorType(VirtualMachine virtualMachine) {
12701273
HypervisorType virtualMachineHypervisorType = virtualMachine.getHypervisorType();
12711274

1272-
switch (virtualMachineHypervisorType) {
1273-
case KVM:
1274-
logger.debug("Using the {} setting global value {} as the VM {} has the {} hypervisor type and is not deployed on either a host or a cluster.", VirtualMachineMaxNicsKvm, VirtualMachineMaxNicsKvm.value(), virtualMachine.getUuid(), virtualMachineHypervisorType);
1275-
return VirtualMachineMaxNicsKvm.value();
1276-
case VMware:
1277-
logger.debug("Using the {} setting global value {} as the VM {} has the {} hypervisor type and is not deployed on either a host or a cluster.", VirtualMachineMaxNicsVmware, VirtualMachineMaxNicsVmware.value(), virtualMachine.getUuid(), virtualMachineHypervisorType);
1278-
return VirtualMachineMaxNicsVmware.value();
1279-
case XenServer:
1280-
logger.debug("Using the {} setting global value {} as the VM {} has the {} hypervisor type and is not deployed on either a host or a cluster.", VirtualMachineMaxNicsXenserver, VirtualMachineMaxNicsXenserver.value(), virtualMachine.getUuid(), virtualMachineHypervisorType);
1281-
return VirtualMachineMaxNicsXenserver.value();
1282-
default:
1283-
logger.debug("Not considering the hypervisor maximum limits as we were unable to find a compatible hypervisor on the VM and VM cluster for virtual machine maximum NICs configurations.");
1284-
return null;
1275+
if (virtualMachineHypervisorType.equals(HypervisorType.KVM)) {
1276+
logger.debug("Using the {} setting global value {} as the VM {} has the {} hypervisor type and is not deployed on either a host or a cluster.", VirtualMachineMaxNicsKvm, VirtualMachineMaxNicsKvm.value(), virtualMachine.getUuid(), virtualMachineHypervisorType);
1277+
return VirtualMachineMaxNicsKvm.value();
1278+
}
1279+
1280+
if (virtualMachineHypervisorType.equals(HypervisorType.VMware)) {
1281+
logger.debug("Using the {} setting global value {} as the VM {} has the {} hypervisor type and is not deployed on either a host or a cluster.", VirtualMachineMaxNicsVmware, VirtualMachineMaxNicsVmware.value(), virtualMachine.getUuid(), virtualMachineHypervisorType);
1282+
return VirtualMachineMaxNicsVmware.value();
12851283
}
1284+
1285+
if (virtualMachineHypervisorType.equals(HypervisorType.XenServer)) {
1286+
logger.debug("Using the {} setting global value {} as the VM {} has the {} hypervisor type and is not deployed on either a host or a cluster.", VirtualMachineMaxNicsXenserver, VirtualMachineMaxNicsXenserver.value(), virtualMachine.getUuid(), virtualMachineHypervisorType);
1287+
return VirtualMachineMaxNicsXenserver.value();
1288+
}
1289+
1290+
logger.debug("Not considering the hypervisor maximum limits as we were unable to find a compatible hypervisor on the VM and VM cluster for virtual machine maximum NICs configurations.");
1291+
return null;
12861292
}
12871293

12881294
private void setMtuDetailsInVRNic(final Pair<NetworkVO, VpcVO> networks, Network network, NicVO vo) {

server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@
3939

4040
import com.cloud.event.UsageEventUtils;
4141
import com.cloud.api.query.dao.DomainRouterJoinDao;
42-
import com.cloud.api.query.vo.DomainRouterJoinVO;
43-
import com.cloud.dc.ClusterVO;
44-
import com.cloud.dc.dao.ClusterDao;
4542

4643
import javax.annotation.PostConstruct;
4744
import javax.inject.Inject;
4845
import javax.naming.ConfigurationException;
4946

50-
import com.cloud.api.query.dao.DomainRouterJoinDao;
5147
import com.cloud.configuration.ConfigurationManager;
5248
import com.cloud.configuration.ConfigurationManagerImpl;
5349
import com.cloud.bgp.BGPService;

0 commit comments

Comments
 (0)