cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [2/2] git commit: updated refs/heads/4.4 to 473c2b4
Date Fri, 13 Jun 2014 11:56:14 GMT
CLOUDSTACK-6749: [OVS] xe network-param-get with
param-key=is-ovs-vpc-distributed-vr-network alway returns error

fixing unnecessary errors in the logs

(cherry picked from commit 9dfbdb5ffd2f0981651bc98f1c5d71718a24a29f)


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

Branch: refs/heads/4.4
Commit: 473c2b4806220d34755c57808aea34f7066e751d
Parents: a4512c0
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Fri Jun 13 15:50:41 2014 +0530
Committer: Daan Hoogland <daan@onecht.net>
Committed: Fri Jun 13 13:55:55 2014 +0200

----------------------------------------------------------------------
 .../xenserver/cloudstack_pluginlib.py           | 54 ++++++++++++++------
 .../vm/hypervisor/xenserver/ovs-vif-flows.py    | 19 ++-----
 2 files changed, 40 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/473c2b48/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py b/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
index d3d234f..44812b2 100644
--- a/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
+++ b/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
@@ -420,23 +420,9 @@ def create_tunnel(bridge, remote_ip, gre_key, src_host, dst_host, network_uuid):
         # find xs network for this bridge, verify is used for ovs tunnel network
         xs_nw_uuid = do_cmd([XE_PATH, "network-list",
 								   "bridge=%s" % bridge, "--minimal"])
-        ovs_tunnel_network = False
-        try:
-            ovs_tunnel_network = do_cmd([XE_PATH,"network-param-get",
-						       "uuid=%s" % xs_nw_uuid,
-						       "param-name=other-config",
-						       "param-key=is-ovs-tun-network", "--minimal"])
-        except:
-            pass
 
-        ovs_vpc_distributed_vr_network = False
-        try:
-            ovs_vpc_distributed_vr_network = do_cmd([XE_PATH,"network-param-get",
-                           "uuid=%s" % xs_nw_uuid,
-                           "param-name=other-config",
-                           "param-key=is-ovs-vpc-distributed-vr-network", "--minimal"])
-        except:
-            pass
+        ovs_tunnel_network = is_regular_tunnel_network(xs_nw_uuid)
+        ovs_vpc_distributed_vr_network = is_vpc_network_with_distributed_routing(xs_nw_uuid)
 
         if ovs_tunnel_network == 'True':
             # add flow entryies for dropping broadcast coming in from gre tunnel
@@ -867,4 +853,38 @@ def update_flooding_rules_on_port_plug_unplug(bridge, interface, command,
if_net
         error_message = "An unexpected error occurred while updating the flooding rules for
the bridge " + \
                         bridge + " when interface " + " %s" %interface + " is %s" %command
         logging.debug(error_message + " due to " + str(e))
-        raise error_message
\ No newline at end of file
+        raise error_message
+
+
+def is_regular_tunnel_network(xs_nw_uuid):
+    cmd = [XE_PATH,"network-param-get", "uuid=%s" % xs_nw_uuid, "param-name=other-config",
+                            "param-key=is-ovs-tun-network", "--minimal"]
+    logging.debug("Executing:%s", cmd)
+    pipe = subprocess.PIPE
+    proc = subprocess.Popen(cmd, shell=False, stdin=pipe, stdout=pipe,
+                            stderr=pipe, close_fds=True)
+    ret_code = proc.wait()
+    if ret_code:
+        return False
+
+    output = proc.stdout.read()
+    if output.endswith('\n'):
+        output = output[:-1]
+    return output
+
+
+def is_vpc_network_with_distributed_routing(xs_nw_uuid):
+    cmd = [XE_PATH,"network-param-get", "uuid=%s" % xs_nw_uuid, "param-name=other-config",
+                            "param-key=is-ovs-vpc-distributed-vr-network", "--minimal"]
+    logging.debug("Executing:%s", cmd)
+    pipe = subprocess.PIPE
+    proc = subprocess.Popen(cmd, shell=False, stdin=pipe, stdout=pipe,
+                            stderr=pipe, close_fds=True)
+    ret_code = proc.wait()
+    if ret_code:
+        return False
+
+    output = proc.stdout.read()
+    if output.endswith('\n'):
+        output = output[:-1]
+    return output
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/473c2b48/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py b/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
index ba5f41a..62601bf 100644
--- a/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
+++ b/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
@@ -90,24 +90,10 @@ def main(command, vif_raw):
     # find xs network for this bridge, verify is used for ovs tunnel network
     xs_nw_uuid = pluginlib.do_cmd([pluginlib.XE_PATH, "network-list",
 								   "bridge=%s" % bridge, "--minimal"])
-    ovs_tunnel_network = False
-    try:
-        ovs_tunnel_network = pluginlib.do_cmd([pluginlib.XE_PATH,"network-param-get",
-						       "uuid=%s" % xs_nw_uuid,
-						       "param-name=other-config",
-						       "param-key=is-ovs-tun-network", "--minimal"])
-    except:
-        pass
 
-    ovs_vpc_distributed_vr_network = False
-    try:
-        ovs_vpc_distributed_vr_network = pluginlib.do_cmd([pluginlib.XE_PATH,"network-param-get",
-						       "uuid=%s" % xs_nw_uuid,
-						       "param-name=other-config",
-						       "param-key=is-ovs-vpc-distributed-vr-network", "--minimal"])
-    except:
-        pass
+    ovs_tunnel_network = pluginlib.is_regular_tunnel_network(xs_nw_uuid)
 
+    # handle case where network is reguar tunnel network
     if ovs_tunnel_network == 'True':
         vlan = pluginlib.do_cmd([pluginlib.VSCTL_PATH, 'br-to-vlan', bridge])
         if vlan != '0':
@@ -137,6 +123,7 @@ def main(command, vif_raw):
 
 
     # handle case where bridge is setup for VPC which is enabled for distributed routing
+    ovs_vpc_distributed_vr_network = pluginlib.is_vpc_network_with_distributed_routing(xs_nw_uuid)
     if ovs_vpc_distributed_vr_network == 'True':
         vlan = pluginlib.do_cmd([pluginlib.VSCTL_PATH, 'br-to-vlan', bridge])
         if vlan != '0':


Mime
View raw message