cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [4/11] git commit: VPC: don't allow vm to be a part of more than one VPC
Date Fri, 06 Jul 2012 18:11:02 GMT
VPC: don't allow vm to be a part of more than one VPC


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

Branch: refs/heads/vpc
Commit: b13acc6459fe5c824206ae77885600404368c476
Parents: d6774e6
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Jul 5 15:28:30 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Jul 6 11:09:06 2012 -0700

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b13acc64/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 5df2b44..f151c32 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2341,6 +2341,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService,
Manager
         List<Pair<NetworkVO, NicProfile>> networks = new ArrayList<Pair<NetworkVO,
NicProfile>>();
         short defaultNetworkNumber = 0;
         boolean securityGroupEnabled = false;
+        boolean vpcNetwork = false;
         for (NetworkVO network : networkList) {
             if (network.getDataCenterId() != zone.getId()) {
                 throw new InvalidParameterValueException("Network id=" + network.getId()
+ " doesn't belong to zone " + zone.getId());
@@ -2368,6 +2369,14 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService,
Manager
             if (_networkMgr.isSecurityGroupSupportedInNetwork(network)) {
                 securityGroupEnabled = true;
             }
+            
+            //vm can't be a part of more than 1 VPC network
+            if (network.getVpcId() != null) {
+                if (vpcNetwork) {
+                    throw new InvalidParameterValueException("Vm can't be a part of more
than 1 VPC network");
+                }
+                vpcNetwork = true;
+            }
         }
 
         if (securityGroupIdList != null && !securityGroupIdList.isEmpty() &&
!securityGroupEnabled) {


Mime
View raw message