diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index b18e1541723..5c97af77fdf 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3808,6 +3808,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati Map> providerCombinationToVerify = new HashMap>(); Map> svcPrv = cmd.getServiceProviders(); Provider firewallProvider = null; + Provider dhcpProvider = null; + Boolean IsVrUserdataProvider = false; if (svcPrv != null) { for (String serviceStr : svcPrv.keySet()) { Network.Service service = Network.Service.getService(serviceStr); @@ -3837,6 +3839,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati firewallProvider = Provider.VirtualRouter; } + if (service == Service.Dhcp) { + dhcpProvider = provider; + } + + if (service == Service.UserData && provider == Provider.VirtualRouter) { + IsVrUserdataProvider = true; + } + providers.add(provider); Set serviceSet = null; @@ -3856,6 +3866,12 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } + // dhcp provider and userdata provider should be same because vm will be contacting dhcp server for user data. + if (dhcpProvider == null && IsVrUserdataProvider) { + s_logger.debug("User data provider VR can't be selected without VR as dhcp provider. In this case VM fails to contact the DHCP server for userdata"); + throw new InvalidParameterValueException("Without VR as dhcp provider, User data can't selected for VR. Please select VR as DHCP provider "); + } + // validate providers combination here _networkModel.canProviderSupportServices(providerCombinationToVerify);