From 301ea330ce11cb415cef66401e9dc46a9b6c1471 Mon Sep 17 00:00:00 2001 From: Kshitij Kansal Date: Wed, 28 Oct 2015 11:49:10 +0530 Subject: [PATCH] CLOUDSTACk-9002: VM deployment is successful even when dhcp entry command fails - Fixed --- .../engine/orchestration/NetworkOrchestrator.java | 10 +++++++--- .../network/topology/BasicNetworkTopology.java | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) 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 2a87bf5eb72..e60e3464a36 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -744,7 +744,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra Pair vmNicPair = allocateNic(requested, config, isDefaultNic, deviceId, vm); NicProfile vmNic = null; - if(vmNicPair != null) { + if (vmNicPair != null) { vmNic = vmNicPair.first(); if (vmNic == null) { continue; @@ -1244,12 +1244,16 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra return false; } } - sp.addDhcpEntry(network, profile, vmProfile, dest, context); + if(!sp.addDhcpEntry(network, profile, vmProfile, dest, context)) { + return false; + } } if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.UserData) && _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.UserData, element.getProvider()) && element instanceof UserDataServiceProvider) { UserDataServiceProvider sp = (UserDataServiceProvider)element; - sp.addPasswordAndUserdata(network, profile, vmProfile, dest, context); + if(!sp.addPasswordAndUserdata(network, profile, vmProfile, dest, context)){ + return false; + } } } return true; diff --git a/server/src/org/apache/cloudstack/network/topology/BasicNetworkTopology.java b/server/src/org/apache/cloudstack/network/topology/BasicNetworkTopology.java index 1f488e1a679..83b47a0b975 100644 --- a/server/src/org/apache/cloudstack/network/topology/BasicNetworkTopology.java +++ b/server/src/org/apache/cloudstack/network/topology/BasicNetworkTopology.java @@ -384,8 +384,7 @@ public class BasicNetworkTopology implements NetworkTopology { } try { - ruleApplier.accept(getVisitor(), router); - + result = ruleApplier.accept(getVisitor(), router); connectedRouters.add(router); } catch (final AgentUnavailableException e) { s_logger.warn(msg + router.getInstanceName(), e);