CLOUDSTACK-6278 Baremetal Advanced Networking support from commit id e06fa18ed2 by Frank Zhang

Conflicts:
	server/src/com/cloud/network/router/NetworkHelperImpl.java
This commit is contained in:
wrodrigues 2014-09-11 22:17:02 +02:00 committed by wilderrodrigues
parent 4e21948f5c
commit 3ac2e222e8
1 changed files with 13 additions and 24 deletions

View File

@ -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) {
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()));
}
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));
}
}
// Returning NULL is fine because the simulator will need it when being
// used instead of a real hypervisor.
// The hypervisorsMap contains only real hypervisors.
protected String retrieveTemplateName(final HypervisorType hType, final long datacenterId) {
String templateName = null;
ConfigKey<String> hypervisorConfigKey = hypervisorsMap.get(hType);
if (hypervisorConfigKey != null) {
if (hType == HypervisorType.BareMetal) {
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);
if (hypervisorConfigKey != null) {
templateName = hypervisorConfigKey.valueIn(datacenterId);
}
}
return templateName;
}