Configure ZooKeeper connection to ONOS/RAMCloud
- ZooKeeper server list specified by zookeeper.hosts (onos_node.conf)
will be used as ZooKeeper fallback connection list for
ONOS, RAMCloud. (ONOS-1756)
Change-Id: Iaef6bee82a28f3181f3fc681707666033f8d746f
diff --git a/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java b/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java
index 103438e..ce68ec2 100644
--- a/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java
@@ -56,6 +56,8 @@
public class ZookeeperRegistry implements IFloodlightModule,
IControllerRegistryService {
+ private static final String DEFAULT_CONNECTION_STRING = "localhost:2181";
+
private static final Logger log = LoggerFactory.getLogger(ZookeeperRegistry.class);
private String controllerId;
@@ -64,7 +66,7 @@
// This is the default. It is overwritten by the connectionString
// configuration parameter
- private String connectionString = "localhost:2181";
+ private String connectionString = DEFAULT_CONNECTION_STRING;
/**
* JVM Option to specify ZooKeeper namespace.
@@ -570,6 +572,10 @@
String connectionStringParam = configParams.get("connectionString");
if (connectionStringParam != null) {
connectionString = connectionStringParam;
+ } else {
+ connectionString = System.getProperty(
+ "net.onrc.onos.core.registry.ZookeeperRegistry.connectionString",
+ DEFAULT_CONNECTION_STRING);
}
log.info("Setting Zookeeper connection string to {}", this.connectionString);