cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [05/25] git commit: updated refs/heads/ui-mixed-zone-management to c3009e3
Date Wed, 17 Apr 2013 18:09:16 GMT
Create Public IP address - If system account is specified do nothing
Dedicate Public IP address - If system account is specified fail the request


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

Branch: refs/heads/ui-mixed-zone-management
Commit: 9ad50272c1fa2d1bb53ebce0d57b97e91d36246d
Parents: 8b8a2f2
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Wed Apr 17 02:13:58 2013 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Wed Apr 17 02:16:07 2013 +0530

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java    |   11 ++++++++---
 .../configuration/ConfigurationManagerTest.java    |    4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ad50272/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 c9ae854..cb780ea 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2154,6 +2154,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
             vlanOwner = _accountDao.findActiveAccount(accountName, domainId);
             if (vlanOwner == null) {
                 throw new InvalidParameterValueException("Please specify a valid account.");
+            } else if (vlanOwner.getId() == Account.ACCOUNT_ID_SYSTEM) {
+                // by default vlan is dedicated to system account
+                vlanOwner = null;
             }
         }
 
@@ -2705,14 +2708,16 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         if ((accountName != null) && (domainId != null)) {
             vlanOwner = _accountDao.findActiveAccount(accountName, domainId);
             if (vlanOwner == null) {
-                throw new InvalidParameterValueException("Please specify a valid account");
+                throw new InvalidParameterValueException("Unable to find account by name
" + accountName);
+            } else if (vlanOwner.getId() == Account.ACCOUNT_ID_SYSTEM) {
+                throw new InvalidParameterValueException("Please specify a valid account.
Cannot dedicate IP range to system account");
             }
         }
 
         // Check if range is valid
         VlanVO vlan = _vlanDao.findById(vlanDbId);
         if (vlan == null) {
-            throw new InvalidParameterValueException("Please specify a valid Public IP range
id");
+            throw new InvalidParameterValueException("Unable to find vlan by id " + vlanDbId);
         }
 
         // Check if range has already been dedicated
@@ -2742,7 +2747,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
             if (allocatedToAccountId != null) {
                 Account accountAllocatedTo = _accountMgr.getActiveAccountById(allocatedToAccountId);
                 if (!accountAllocatedTo.getAccountName().equalsIgnoreCase(accountName))
-                    throw new InvalidParameterValueException("Public IP address in range
is already allocated to another account");
+                    throw new InvalidParameterValueException(ip.getAddress() + " Public IP
address in range is allocated to another account ");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ad50272/server/test/com/cloud/configuration/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/configuration/ConfigurationManagerTest.java b/server/test/com/cloud/configuration/ConfigurationManagerTest.java
index ee98d53..5c1cabf 100755
--- a/server/test/com/cloud/configuration/ConfigurationManagerTest.java
+++ b/server/test/com/cloud/configuration/ConfigurationManagerTest.java
@@ -224,7 +224,7 @@ public class ConfigurationManagerTest {
         try {
             configurationMgr.dedicatePublicIpRange(dedicatePublicIpRangesCmd);
         } catch (Exception e) {
-            Assert.assertTrue(e.getMessage().contains("Please specify a valid Public IP range
id"));
+            Assert.assertTrue(e.getMessage().contains("Unable to find vlan by id"));
         } finally {
             txn.close("runDedicatePublicIpRangeInvalidRange");
         }
@@ -306,7 +306,7 @@ public class ConfigurationManagerTest {
         try {
             configurationMgr.dedicatePublicIpRange(dedicatePublicIpRangesCmd);
         } catch (Exception e) {
-            Assert.assertTrue(e.getMessage().contains("Public IP address in range is already
allocated to another account"));
+            Assert.assertTrue(e.getMessage().contains("Public IP address in range is allocated
to another account"));
         } finally {
             txn.close("runDedicatePublicIpRangeIPAdressAllocated");
         }


Mime
View raw message