Updated Branches: refs/heads/master 884c03f90 -> 6523c0686
NetworkManager Exception Fix Due to call to getDhcpServiceProvider() Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6523c068 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6523c068 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6523c068 Branch: refs/heads/master Commit: 6523c068695d0431070060667c222eb40d54b14d Parents: 884c03f Author: Soheil Eizadi <seiz...@infoblox.com> Authored: Wed Feb 5 17:14:05 2014 +0100 Committer: Daan Hoogland <d...@onecht.net> Committed: Wed Feb 5 17:14:05 2014 +0100 ---------------------------------------------------------------------- .../orchestration/NetworkOrchestrator.java | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6523c068/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 85fa530..ce40762 100755 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -1539,7 +1539,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra } // remove the dhcpservice ip if this is the last nic in subnet. - if (vm.getType() == Type.User && isDhcpAccrossMultipleSubnetsSupported(network) && isLastNicInSubnet(nic) && network.getTrafficType() == TrafficType.Guest + DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network); + if (dhcpServiceProvider != null + && vm.getType() == Type.User + && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider) + && isLastNicInSubnet(nic) + && network.getTrafficType() == TrafficType.Guest && network.getGuestType() == GuestType.Shared) { removeDhcpServiceInSubnet(nic); } @@ -1553,12 +1558,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra } } - public boolean isDhcpAccrossMultipleSubnetsSupported(Network network) { - if (!_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)) { - return false; - } + public boolean isDhcpAccrossMultipleSubnetsSupported(DhcpServiceProvider dhcpServiceProvider) { - DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network); Map<Network.Capability, String> capabilities = dhcpServiceProvider.getCapabilities().get(Network.Service.Dhcp); String supportsMultipleSubnets = capabilities.get(Network.Capability.DhcpAccrossMultipleSubnets); if (supportsMultipleSubnets != null && Boolean.valueOf(supportsMultipleSubnets)) { @@ -2429,8 +2430,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra return null; } - return (DhcpServiceProvider)_networkModel.getElementImplementingProvider(DhcpProvider); - + NetworkElement element = _networkModel.getElementImplementingProvider(DhcpProvider); + if ( element instanceof DhcpServiceProvider ) { + return (DhcpServiceProvider)_networkModel.getElementImplementingProvider(DhcpProvider); + } else { + return null; + } } protected boolean isSharedNetworkWithServices(Network network) {