CLOUDSTACK-6278 Baremetal Advanced Networking support from commit id
e06fa18ed2ee2ee6a417e089cf5ac6bde11d0079 by Frank Zhang
Conflicts:
server/src/com/cloud/network/router/NetworkHelperImpl.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fb558516
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fb558516
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fb558516
Branch: refs/heads/vpc-refactor
Commit: fb5585161425f0fd0eac4a5b283b9e8568cae886
Parents: 53703c9
Author: wrodrigues <[email protected]>
Authored: Thu Sep 11 22:17:02 2014 +0200
Committer: Wilder Rodrigues <[email protected]>
Committed: Fri Oct 3 06:21:29 2014 +0200
----------------------------------------------------------------------
.../cloud/network/router/NetworkHelperImpl.java | 35 +++++++-------------
1 file changed, 12 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fb558516/server/src/com/cloud/network/router/NetworkHelperImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/NetworkHelperImpl.java
b/server/src/com/cloud/network/router/NetworkHelperImpl.java
index f589394..5acad2c 100644
--- a/server/src/com/cloud/network/router/NetworkHelperImpl.java
+++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java
@@ -30,7 +30,6 @@ import javax.inject.Inject;
import
org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.log4j.Logger;
import org.cloud.network.router.deployment.RouterDeploymentDefinition;
@@ -41,7 +40,6 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.manager.Commands;
import com.cloud.alert.AlertManager;
-import com.cloud.configuration.Config;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
@@ -148,8 +146,6 @@ public class NetworkHelperImpl implements NetworkHelper {
@Inject
private RouterControlHelper _routerControlHelper;
@Inject
- private ConfigurationDao _configDao;
- @Inject
protected NetworkOrchestrationService _networkMgr;
protected final Map<HypervisorType, ConfigKey<String>> hypervisorsMap =
new HashMap<>();
@@ -481,30 +477,23 @@ public class NetworkHelperImpl implements NetworkHelper {
return result;
}
- protected String retrieveTemplateName(HypervisorType hType, final long
datacenterId) {
+ protected String retrieveTemplateName(final HypervisorType hType, final
long datacenterId) {
+ String templateName = null;
+
if (hType == HypervisorType.BareMetal) {
- String peerHvType =
_configDao.getValue(Config.BaremetalPeerHypervisorType.key());
- if (peerHvType == null) {
- throw new CloudRuntimeException(String.format("To use
baremetal in advanced networking, you must set %s to type of hypervisor(e.g
XenServer)"
- + " that exists in the same zone with baremetal host.
That hyperivsor is used to spring up virtual router for baremetal instance",
- Config.BaremetalPeerHypervisorType.key()));
- }
+ ConfigKey<String> hypervisorConfigKey =
hypervisorsMap.get(HypervisorType.VMware);
+ templateName = hypervisorConfigKey.valueIn(datacenterId);
+ } else {
+ // Returning NULL is fine because the simulator will need it when
+ // being used instead of a real hypervisor.
+ // The hypervisorsMap contains only real hypervisors.
+ ConfigKey<String> hypervisorConfigKey = hypervisorsMap.get(hType);
- hType = HypervisorType.getType(peerHvType);
- if (HypervisorType.XenServer != hType && HypervisorType.KVM !=
hType && HypervisorType.VMware != hType) {
- throw new CloudRuntimeException(String.format("Baremetal only
supports peer hypervisor(XenServer/KVM/VMWare) right now, you specified %s",
peerHvType));
+ if (hypervisorConfigKey != null) {
+ templateName = hypervisorConfigKey.valueIn(datacenterId);
}
}
- // Returning NULL is fine because the simulator will need it when being
- // used instead of a real hypervisor.
- // The hypervisorsMap contains only real hypervisors.
- String templateName = null;
- ConfigKey<String> hypervisorConfigKey = hypervisorsMap.get(hType);
-
- if (hypervisorConfigKey != null) {
- templateName = hypervisorConfigKey.valueIn(datacenterId);
- }
return templateName;
}