mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-13 08:21:01 +02:00
Fix: add a timer to harden the k8s node's state checking logic
Change-Id: I76eb3dd22a712299669dac81fb48f2a4937ebecf
This commit is contained in:
parent
8cc1599f11
commit
e560f673dc
@ -64,6 +64,7 @@ import java.util.Objects;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static java.lang.Thread.sleep;
|
||||||
import static java.util.concurrent.Executors.newSingleThreadExecutor;
|
import static java.util.concurrent.Executors.newSingleThreadExecutor;
|
||||||
import static org.onlab.packet.TpPort.tpPort;
|
import static org.onlab.packet.TpPort.tpPort;
|
||||||
import static org.onlab.util.Tools.groupedThreads;
|
import static org.onlab.util.Tools.groupedThreads;
|
||||||
@ -110,6 +111,7 @@ public class DefaultK8sNodeHandler implements K8sNodeHandler {
|
|||||||
private static final String DEFAULT_OF_PROTO = "tcp";
|
private static final String DEFAULT_OF_PROTO = "tcp";
|
||||||
private static final int DEFAULT_OFPORT = 6653;
|
private static final int DEFAULT_OFPORT = 6653;
|
||||||
private static final int DPID_BEGIN = 3;
|
private static final int DPID_BEGIN = 3;
|
||||||
|
private static final long SLEEP_MS = 3000; // we wait 3s
|
||||||
|
|
||||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||||
protected CoreService coreService;
|
protected CoreService coreService;
|
||||||
@ -479,6 +481,7 @@ public class DefaultK8sNodeHandler implements K8sNodeHandler {
|
|||||||
case COMPLETE:
|
case COMPLETE:
|
||||||
case INCOMPLETE:
|
case INCOMPLETE:
|
||||||
case ON_BOARDED:
|
case ON_BOARDED:
|
||||||
|
case POST_ON_BOARD:
|
||||||
// always return false
|
// always return false
|
||||||
// run init CLI to re-trigger node bootstrap
|
// run init CLI to re-trigger node bootstrap
|
||||||
return false;
|
return false;
|
||||||
@ -493,6 +496,14 @@ public class DefaultK8sNodeHandler implements K8sNodeHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// we need to wait a while, in case interface and bridge
|
||||||
|
// creation requires some time
|
||||||
|
sleep(SLEEP_MS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("Exception caused during init state checking...");
|
||||||
|
}
|
||||||
|
|
||||||
return k8sNode.intgBridge() != null && k8sNode.extBridge() != null &&
|
return k8sNode.intgBridge() != null && k8sNode.extBridge() != null &&
|
||||||
deviceService.isAvailable(k8sNode.intgBridge()) &&
|
deviceService.isAvailable(k8sNode.intgBridge()) &&
|
||||||
deviceService.isAvailable(k8sNode.extBridge()) &&
|
deviceService.isAvailable(k8sNode.extBridge()) &&
|
||||||
@ -500,6 +511,15 @@ public class DefaultK8sNodeHandler implements K8sNodeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDeviceCreatedStateDone(K8sNode k8sNode) {
|
private boolean isDeviceCreatedStateDone(K8sNode k8sNode) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// we need to wait a while, in case interface and bridge
|
||||||
|
// creation requires some time
|
||||||
|
sleep(SLEEP_MS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("Exception caused during init state checking...");
|
||||||
|
}
|
||||||
|
|
||||||
if (k8sNode.dataIp() != null &&
|
if (k8sNode.dataIp() != null &&
|
||||||
!isIntfEnabled(k8sNode, VXLAN_TUNNEL)) {
|
!isIntfEnabled(k8sNode, VXLAN_TUNNEL)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user