VPC: CS-15725 - don't allow regular offering upgrade to the offering that can 
be used inside vpc only


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

Branch: refs/heads/vpc
Commit: 9be0a5525dae4dc4b9ec3d0553017a9aba3c2f02
Parents: e0c85c0
Author: Alena Prokharchyk <[email protected]>
Authored: Fri Jul 27 11:28:42 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Wed Aug 1 18:19:20 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkManagerImpl.java  |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9be0a552/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java 
b/server/src/com/cloud/network/NetworkManagerImpl.java
index 880466c..e022ea3 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -4725,6 +4725,14 @@ public class NetworkManagerImpl implements 
NetworkManager, NetworkService, Manag
                 String errMsg = forVpcNew ? "a vpc offering " : "not a vpc 
offering";
                 throw new InvalidParameterValueException("Can't update as the 
new offering is " + errMsg);
             }
+            
+            //can't update from vpc to non-vpc network offering
+            boolean forVpcNew = _configMgr.isOfferingForVpc(networkOffering);
+            boolean vorVpcOriginal = 
_configMgr.isOfferingForVpc(_configMgr.getNetworkOffering(oldNetworkOfferingId));
+            if (forVpcNew != vorVpcOriginal) {
+                String errMsg = forVpcNew ? "a vpc offering " : "not a vpc 
offering";
+                throw new InvalidParameterValueException("Can't update as the 
new offering is " + errMsg);
+            }
 
             //perform below validation if the network is vpc network
             if (network.getVpcId() != null) {

Reply via email to