cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/4.4 to faf5253
Date Tue, 08 Apr 2014 13:36:27 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 6dacfa9ef -> faf52530c


CLOUDSTACK-6356: OVS: tunnel networks does not work across the XenServer
clusers

across the poll members an internal network created is visible to al the
members but bridge is not necessariliy created. This fix enables
plugging a temp VIF connected to internal network to dom0 and then
unplug-it. this action creates a bridge on the host of the network.


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

Branch: refs/heads/4.4
Commit: faf52530cc9ff5827825eefe1c09b2887d0a0883
Parents: 6dacfa9
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Tue Apr 8 19:04:06 2014 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Tue Apr 8 19:06:15 2014 +0530

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java        | 39 ++++++++++++--------
 1 file changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/faf52530/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 20497b5..90042ff 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
@@ -918,6 +918,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 s_logger.debug("A VIF for dom0 has already been found - No need to create
one");
             }
         }
+
         if (dom0vif == null) {
             s_logger.debug("Create a vif on dom0 for " + networkDesc);
             VIF.Record vifr = new VIF.Record();
@@ -935,14 +936,17 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
 
             vifr.lockingMode = Types.VifLockingMode.NETWORK_DEFAULT;
             dom0vif = VIF.create(conn, vifr);
+            synchronized (_tmpDom0Vif) {
+                _tmpDom0Vif.add(dom0vif);
+            }
         }
         // At this stage we surely have a VIF
-        dom0vif.plug(conn);
-        dom0vif.unplug(conn);
-        synchronized (_tmpDom0Vif) {
-            _tmpDom0Vif.add(dom0vif);
+        try {
+            dom0vif.plug(conn);
+        } catch (Exception e) {
+            // though an exception is thrown here, VIF actually gets plugged-in to dom0,
so just ignore the exception
         }
-
+        dom0vif.unplug(conn);
     }
 
     private synchronized Network setupvSwitchNetwork(Connection conn) {
@@ -994,11 +998,11 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                 rec.otherConfig = otherConfig;
                 nw = Network.create(conn, rec);
                 // Plug dom0 vif only when creating network
-                if (!is_xcp())
-                    enableXenServerNetwork(conn, nw, nwName, "tunnel network for account
" + nwName);
+                enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " +
nwName);
                 s_logger.debug("### Xen Server network for tunnels created:" + nwName);
             } else {
                 nw = networks.iterator().next();
+                enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " +
nwName);
                 s_logger.debug("Xen Server network for tunnels found:" + nwName);
             }
             return nw;
@@ -1031,8 +1035,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
             }
             if (!configured) {
                 // Plug dom0 vif only if not done before for network and host
-                if (!is_xcp())
-                    enableXenServerNetwork(conn, nw, nwName, "tunnel network for account
" + bridgeName);
+                enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " +
bridgeName);
                 String result;
                 if (bridgeName.startsWith("OVS-DR-VPC-Bridge")) {
                     result = callHostPlugin(conn, "ovstunnel", "setup_ovs_bridge_for_distributed_routing",
"bridge", bridge,
@@ -1670,7 +1673,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         return cmd;
     }
 
-    private void cleanUpTmpDomVif(Connection conn) {
+    private void cleanUpTmpDomVif(Connection conn, Network nw) {
         List<VIF> vifs;
         synchronized (_tmpDom0Vif) {
             vifs = _tmpDom0Vif;
@@ -1678,13 +1681,16 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         }
 
         for (VIF v : vifs) {
-            String vifName = "unkown";
+            String vifName = "unknown";
             try {
                 VIF.Record vifr = v.getRecord(conn);
-                Map<String, String> config = vifr.otherConfig;
-                vifName = config.get("nameLabel");
-                v.destroy(conn);
-                s_logger.debug("Destroy temp dom0 vif" + vifName + " success");
+                if (v.getNetwork(conn).getUuid(conn).equals(nw.getUuid(conn))) {
+                    Map<String, String> config = vifr.otherConfig;
+                    vifName = config.get("nameLabel");
+                    s_logger.debug("A VIF in dom0 for the network is found - so destroy the
vif");
+                    v.destroy(conn);
+                    s_logger.debug("Destroy temp dom0 vif" + vifName + " success");
+                }
             } catch (Exception e) {
                 s_logger.warn("Destroy temp dom0 vif " + vifName + "failed", e);
             }
@@ -1822,7 +1828,6 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                     }
                 }
             }
-            cleanUpTmpDomVif(conn);
 
             if (_canBridgeFirewall) {
                 String result = null;
@@ -5250,6 +5255,8 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
 
     private Answer execute(OvsDestroyBridgeCommand cmd) {
         Connection conn = getConnection();
+        Network nw = findOrCreateTunnelNetwork(conn, cmd.getBridgeName());
+        cleanUpTmpDomVif(conn, nw);
         destroyTunnelNetwork(conn, cmd.getBridgeName());
         s_logger.debug("OVS Bridge destroyed");
         return new Answer(cmd, true, null);


Mime
View raw message