diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index ecd28e87e43..d0d03153c10 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3923,6 +3923,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); @@ -3952,6 +3954,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; @@ -3971,6 +3981,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);