You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2015/04/30 10:23:49 UTC

git commit: updated refs/heads/4.5 to 9642e86

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 0e7975d4d -> 9642e862d


CLOUDSTACK-8406: Fixed selecting userdata as VR with dhcp service


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9642e862
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9642e862
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9642e862

Branch: refs/heads/4.5
Commit: 9642e862d65606fcfbecd909305b94c8fce82fcf
Parents: 0e7975d
Author: Jayapal <ja...@apache.org>
Authored: Thu Apr 30 12:21:15 2015 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Thu Apr 30 12:24:24 2015 +0530

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java     | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9642e862/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index b18e154..5c97af7 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<Provider, Set<Service>> providerCombinationToVerify = new HashMap<Provider, Set<Service>>();
         Map<String, List<String>> 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<Service> 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);