You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/06/12 12:38:47 UTC

git commit: updated refs/heads/4.4 to 1c17df8

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 40d350376 -> 1c17df853


CLOUDSTACK-6755: [OVS] Can't create more than 7 GRE tunnel networks in
xen cluster

XenServer does not create a bridge automatically when VIF from domU is connected
to internal network. So there is logic to force bridge creation by
creating VIF in dom0 connected to GRE tunnel network. But there is no
logic to delete the VIF after bridge gets created. So this fix ensure
VIF is delted when atleast there is one domU VIF connected to the
network.

(cherry picked from commit 9e4e62466a8c3d00ab5381d7ebfeb70466192a55)


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

Branch: refs/heads/4.4
Commit: 1c17df853f46adf8af57a9aeb7e32b0eebd27126
Parents: 40d3503
Author: Murali Reddy <mu...@gmail.com>
Authored: Thu Jun 12 13:50:01 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Thu Jun 12 12:38:12 2014 +0200

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java        | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c17df85/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 31a8de4..a8a1419 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -902,7 +902,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
      * if you create a network then create bridge by brctl or openvswitch yourself,
      * then you will get an expection that is "REQUIRED_NETWROK" when you start a
      * vm with this network. The soultion is, create a vif of dom0 and plug it in
-     * network, xenserver will create the bridge on behalf of you
+     * network, xenserver will create the bridge on behalf of you. But we can not keep the dom0 vif for the entire
+     * existence of network, as we will seen reach max VIF (8) that can be conencted to a domain. So as soon as we have
+     * one more VIF for any of the VM, delete dom0 VIF so that we can scale beyond 8 networks on a host.
      * @throws XmlRpcException
      * @throws XenAPIException
      */
@@ -921,7 +923,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             }
         }
 
-        if (dom0vif == null) {
+        int domuVifCount=0;
+        Set<VIF> domUVifs = nw.getVIFs(conn);
+        Host host = Host.getByUuid(conn, _host.uuid);
+        for (VIF vif : domUVifs) {
+            vif.getRecord(conn);
+            if (vif.getVM(conn).getResidentOn(conn).equals(host)) {
+                domuVifCount++;
+            }
+        }
+
+        if (dom0vif == null && domuVifCount == 0) {
             s_logger.debug("Create a vif on dom0 for " + networkDesc);
             VIF.Record vifr = new VIF.Record();
             vifr.VM = dom0;
@@ -948,6 +960,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             }
             dom0vif.unplug(conn);
         }
+
+        if (dom0vif != null && domuVifCount > 1) {
+            // now that there is at least one more VIF (other than dom0 vif) destroy dom0 VIF
+            dom0vif.destroy(conn);
+        }
     }
 
     private synchronized Network setupvSwitchNetwork(Connection conn) {