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 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/53703c98 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53703c98 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53703c98 Branch: refs/heads/vpc-refactor Commit: 53703c98fea54a835f794aa358745794591b420e Parents: 9379d1a Author: wrodrigues <wrodrig...@schubergphilis.com> Authored: Thu Sep 11 20:41:23 2014 +0200 Committer: Wilder Rodrigues <wrodrig...@schubergphilis.com> Committed: Fri Oct 3 06:21:29 2014 +0200 ---------------------------------------------------------------------- .../cloud/network/router/NetworkHelperImpl.java | 28 +++++++------------- 1 file changed, 10 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53703c98/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 357802f..f589394 100644 --- a/server/src/com/cloud/network/router/NetworkHelperImpl.java +++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java @@ -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