Fixing the NetworkHelperImpl class. It was throwing a NPE due to a hypervisor type SIMULATOR not being in the hashmap.

When the refactor took place, we should have changed first structure, then behaviour. By refactoring the deployRouter method
we changed how the templateName was retrieved.
Fixed and tested using the simulator and the following Marvin tests

test_privategateway_acl
test_routers
test_vpc_vpn
test_service_offerings
test_volumes
test_reset_vm_on_reboot
test_multipleips_per_nic

Conflicts:
	server/src/com/cloud/network/router/NetworkHelperImpl.java
This commit is contained in:
wrodrigues 2014-09-11 20:41:23 +02:00 committed by Wilder Rodrigues
parent 9379d1a104
commit 53703c98fe
1 changed files with 10 additions and 18 deletions

View File

@ -372,14 +372,6 @@ public class NetworkHelperImpl implements NetworkHelper {
return null;
}
// @Override
/*
* (non-Javadoc)
*
* @see
* com.cloud.network.router.NetworkHelper#startRouters(org.cloud.network
* .router.deployment.RouterDeploymentDefinition)
*/
@Override
public List<DomainRouterVO> startRouters(final RouterDeploymentDefinition routerDeploymentDefinition) throws StorageUnavailableException, InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
@ -407,15 +399,6 @@ public class NetworkHelperImpl implements NetworkHelper {
return runningRouters;
}
// @Override
/*
* (non-Javadoc)
*
* @see
* com.cloud.network.router.NetworkHelper#startVirtualRouter(com.cloud.vm
* .DomainRouterVO, com.cloud.user.User, com.cloud.user.Account,
* java.util.Map)
*/
@Override
public DomainRouterVO startVirtualRouter(final DomainRouterVO router, final User user, final Account caller, final Map<Param, Object> params)
throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
@ -513,7 +496,16 @@ public class NetworkHelperImpl implements NetworkHelper {
}
}
return hypervisorsMap.get(hType).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;
}
@Override