mirror of https://github.com/apache/cloudstack.git
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
This commit is contained in:
parent
aa21cdcd49
commit
cdb3dc97b5
|
|
@ -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
|
||||
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
|
||||
|
|
@ -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':
|
||||
|
|
|
|||
Loading…
Reference in New Issue