fix for a failed sub batch
Change-Id: Ie686efd41a6815f913e06d1167f2282334a98ecb
Showing
2 changed files
with
13 additions
and
7 deletions
... | @@ -401,7 +401,7 @@ public class FlowRuleManager | ... | @@ -401,7 +401,7 @@ public class FlowRuleManager |
401 | CompletedBatchOperation completed; | 401 | CompletedBatchOperation completed; |
402 | for (Future<CompletedBatchOperation> future : futures) { | 402 | for (Future<CompletedBatchOperation> future : futures) { |
403 | completed = future.get(); | 403 | completed = future.get(); |
404 | - success = validateBatchOperation(failed, completed, future); | 404 | + success = validateBatchOperation(failed, completed); |
405 | } | 405 | } |
406 | 406 | ||
407 | return finalizeBatchOperation(success, failed); | 407 | return finalizeBatchOperation(success, failed); |
... | @@ -426,14 +426,13 @@ public class FlowRuleManager | ... | @@ -426,14 +426,13 @@ public class FlowRuleManager |
426 | long now = System.nanoTime(); | 426 | long now = System.nanoTime(); |
427 | long thisTimeout = end - now; | 427 | long thisTimeout = end - now; |
428 | completed = future.get(thisTimeout, TimeUnit.NANOSECONDS); | 428 | completed = future.get(thisTimeout, TimeUnit.NANOSECONDS); |
429 | - success = validateBatchOperation(failed, completed, future); | 429 | + success = validateBatchOperation(failed, completed); |
430 | } | 430 | } |
431 | return finalizeBatchOperation(success, failed); | 431 | return finalizeBatchOperation(success, failed); |
432 | } | 432 | } |
433 | 433 | ||
434 | private boolean validateBatchOperation(List<FlowEntry> failed, | 434 | private boolean validateBatchOperation(List<FlowEntry> failed, |
435 | - CompletedBatchOperation completed, | 435 | + CompletedBatchOperation completed) { |
436 | - Future<CompletedBatchOperation> future) { | ||
437 | 436 | ||
438 | if (isCancelled()) { | 437 | if (isCancelled()) { |
439 | throw new CancellationException(); | 438 | throw new CancellationException(); | ... | ... |
providers/openflow/flow/src/main/java/org/onlab/onos/provider/of/flow/impl/OpenFlowRuleProvider.java
... | @@ -62,6 +62,7 @@ import java.util.HashSet; | ... | @@ -62,6 +62,7 @@ import java.util.HashSet; |
62 | import java.util.List; | 62 | import java.util.List; |
63 | import java.util.Map; | 63 | import java.util.Map; |
64 | import java.util.Set; | 64 | import java.util.Set; |
65 | +import java.util.concurrent.CancellationException; | ||
65 | import java.util.concurrent.ConcurrentHashMap; | 66 | import java.util.concurrent.ConcurrentHashMap; |
66 | import java.util.concurrent.CountDownLatch; | 67 | import java.util.concurrent.CountDownLatch; |
67 | import java.util.concurrent.ExecutionException; | 68 | import java.util.concurrent.ExecutionException; |
... | @@ -166,7 +167,14 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -166,7 +167,14 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
166 | FlowRule flowRule = fbe.getTarget(); | 167 | FlowRule flowRule = fbe.getTarget(); |
167 | OpenFlowSwitch sw = controller.getSwitch(Dpid.dpid(flowRule.deviceId().uri())); | 168 | OpenFlowSwitch sw = controller.getSwitch(Dpid.dpid(flowRule.deviceId().uri())); |
168 | if (sw == null) { | 169 | if (sw == null) { |
169 | - log.warn("WTF {}", flowRule.deviceId()); | 170 | + /* |
171 | + * if a switch we are supposed to install to is gone then | ||
172 | + * cancel (ie. rollback) the work that has been done so far | ||
173 | + * and return the associated future. | ||
174 | + */ | ||
175 | + InstallationFuture failed = new InstallationFuture(sws, fmXids); | ||
176 | + failed.cancel(true); | ||
177 | + return failed; | ||
170 | } | 178 | } |
171 | sws.add(new Dpid(sw.getId())); | 179 | sws.add(new Dpid(sw.getId())); |
172 | FlowModBuilder builder = new FlowModBuilder(flowRule, sw.factory()); | 180 | FlowModBuilder builder = new FlowModBuilder(flowRule, sw.factory()); |
... | @@ -377,7 +385,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -377,7 +385,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
377 | 385 | ||
378 | 386 | ||
379 | public void satisfyRequirement(Dpid dpid) { | 387 | public void satisfyRequirement(Dpid dpid) { |
380 | - log.warn("Satisfaction from switch {}", dpid); | 388 | + log.debug("Satisfaction from switch {}", dpid); |
381 | removeRequirement(dpid); | 389 | removeRequirement(dpid); |
382 | } | 390 | } |
383 | 391 | ||
... | @@ -432,7 +440,6 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -432,7 +440,6 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
432 | throws InterruptedException, ExecutionException, | 440 | throws InterruptedException, ExecutionException, |
433 | TimeoutException { | 441 | TimeoutException { |
434 | if (countDownLatch.await(timeout, unit)) { | 442 | if (countDownLatch.await(timeout, unit)) { |
435 | - | ||
436 | this.state = BatchState.FINISHED; | 443 | this.state = BatchState.FINISHED; |
437 | return new CompletedBatchOperation(ok.get(), offendingFlowMods); | 444 | return new CompletedBatchOperation(ok.get(), offendingFlowMods); |
438 | } | 445 | } | ... | ... |
-
Please register or login to post a comment