VPC: fixed user vm start in case when Implemented network existed w/o VR (it 
was expunged with DestroyRouter command)


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

Branch: refs/heads/vpc
Commit: 7fda6306b8a1c6f108dc651d7bbf69f2eea15691
Parents: 19f648f
Author: Alena Prokharchyk <[email protected]>
Authored: Wed Jun 20 10:36:59 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Wed Jun 20 17:19:17 2012 -0700

----------------------------------------------------------------------
 .../network/element/VpcVirtualRouterElement.java   |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7fda6306/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java 
b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
index 794503b..b4462db 100644
--- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
@@ -189,6 +189,16 @@ public class VpcVirtualRouterElement extends 
VirtualRouterElement implements Vpc
                 throw new ResourceUnavailableException("Can't find at least 
one running router!",
                         DataCenter.class, network.getDataCenterId());
             }
+            for (VirtualRouter router : routers) {
+                //Add router to guest network if needed
+                if (!_networkMgr.isVmPartOfNetwork(router.getId(), 
network.getId())) {
+                    if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(router, 
network, false)) {
+                        throw new CloudRuntimeException("Failed to add VPC 
router " + router + " to guest network " + network);
+                    } else {
+                        s_logger.debug("Successfully added VPC router " + 
router + " to guest network " + network);
+                    }
+                }
+            }
         }
        
         return true;

Reply via email to