The check for the config is incorrect. The check should be whether the network in the input parameter has the isolation method 'GRE'. You can see the canHandle method on how to check for this. Although, I don't see why this check should even be necessary. The network will be associated with the guru at design time.
On 6/10/13 7:17 AM, "Nguyen Anh Tu" <ng.t...@gmail.com> wrote: >Hi forks, > >I'm trying OVS tunnel with XCP 1.6 and get error NullPointerException when >executing deployVM. > >I found this error starting from the below code. > >*NetworkManagerImpl.java* > >*NicProfile profile = guru.allocate(network, requested, vm); (1)* > if (isDefaultNic != null) { > profile.setDefaultNic( >isDefaultNic); > } > >*ExtenalGuestNetworkGuru.java* > > @Override > * public NicProfile allocate(Network config, NicProfile nic, >VirtualMachineProfile<? extends VirtualMachine> vm) throws >InsufficientVirtualNetworkCapcityException, > InsufficientAddressCapacityException* { > > if >(_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCent >erId(), >config.getId()) && nic != null && nic.getRequestedIpv4() != null) { > throw new CloudRuntimeException("Does not support custom ip >allocation at this time: " + nic); > } > > NicProfile profile = super.allocate(config, nic, vm); > > *boolean _isEnabled = >Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())); >(2) > if (_isEnabled) { > return null; > }* > > if >(_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCent >erId(), >config.getId())) { > profile.setStrategy(ReservationStrategy.Start); > /* We won't clear IP address, because router may set gateway >as >it IP, and it would be updated properly later */ > //profile.setIp4Address(null); > profile.setGateway(null); > profile.setNetmask(null); > } > > return profile; > }* > >* >The return from (1) is NULL, because at (2) *sdn.ovs.controller* set to >true. So profile = NULL and then we get NullPointerException error in the >next step. > >This error prevents me to deployVM using GRE isolation method. If I set * >sdn.ovs.controller* = false, no error anymore but can't using GRE. > >How can I fix this? Thanks for any help. > >-- > >N.g.U.y.e.N.A.n.H.t.U