dont try forever return after max retires and move on for the next request,...

dont try forever return after max retires and move on for the next request, for deletion of flows relating to vm port, openstack deletes it so we dont have to do anything for that
parent 65081c5b
...@@ -64,12 +64,18 @@ def computeOFlowInstall(dic, start_response): ...@@ -64,12 +64,18 @@ def computeOFlowInstall(dic, start_response):
p = Popen(ifcmd, shell=True, stdout=PIPE, stderr=PIPE) p = Popen(ifcmd, shell=True, stdout=PIPE, stderr=PIPE)
out, err = p.communicate() out, err = p.communicate()
TAPNAME=out.rstrip() TAPNAME=out.rstrip()
retry = 10;
while len(TAPNAME) < 3: while len(TAPNAME) < 3:
retry -=1;
sleep(5) sleep(5)
p = Popen(ifcmd, shell=True, stdout=PIPE, stderr=PIPE) p = Popen(ifcmd, shell=True, stdout=PIPE, stderr=PIPE)
out, err = p.communicate() out, err = p.communicate()
TAPNAME=out.rstrip() TAPNAME=out.rstrip()
if retry == 0:
print "max retries reached"
break;
LOG.info("TAPNAME: %s", TAPNAME) LOG.info("TAPNAME: %s", TAPNAME)
OVSPORTNAME='qvo%s' % TAPNAME[3:] OVSPORTNAME='qvo%s' % TAPNAME[3:]
...@@ -122,9 +128,13 @@ def computeOFlowInstall(dic, start_response): ...@@ -122,9 +128,13 @@ def computeOFlowInstall(dic, start_response):
LOG.info("%s", computeintflow) LOG.info("%s", computeintflow)
ovscmdlist.append(computeintflow) ovscmdlist.append(computeintflow)
'''
#don't worry about the ovs port deletion it is done by openstack
#itself
computedropoutflow = 'sudo ovs-ofctl del-flows br-int in_port=%d' \ computedropoutflow = 'sudo ovs-ofctl del-flows br-int in_port=%d' \
% (int(OVSPORTNUMBER)) % (int(OVSPORTNUMBER))
LOG.info("%s", computedropoutflow) LOG.info("%s", computedropoutflow)
'''
ovscmdlist.append(computedropoutflow) ovscmdlist.append(computedropoutflow)
for cmd in ovscmdlist: for cmd in ovscmdlist:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment