Committed by
Gerrit Code Review
Move CopyCat log to $KARAF_DATA/raft
Change-Id: I97f4766279f875c15c818d4b7f0b168e06e85ac1
Showing
3 changed files
with
12 additions
and
4 deletions
... | @@ -82,8 +82,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -82,8 +82,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
82 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 82 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
83 | protected DatabaseProtocolService copycatMessagingProtocol; | 83 | protected DatabaseProtocolService copycatMessagingProtocol; |
84 | 84 | ||
85 | - // FIXME: point to appropriate path | 85 | + public static final String LOG_FILE_PREFIX = "raft/onos-copy-cat-log_"; |
86 | - public static final String LOG_FILE_PREFIX = "/tmp/onos-copy-cat-log_"; | ||
87 | 86 | ||
88 | // Current working dir seems to be /opt/onos/apache-karaf-3.0.2 | 87 | // Current working dir seems to be /opt/onos/apache-karaf-3.0.2 |
89 | // TODO: Set the path to /opt/onos/config | 88 | // TODO: Set the path to /opt/onos/config |
... | @@ -126,6 +125,10 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -126,6 +125,10 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
126 | @Activate | 125 | @Activate |
127 | public void activate() throws InterruptedException, ExecutionException { | 126 | public void activate() throws InterruptedException, ExecutionException { |
128 | 127 | ||
128 | + // KARAF_DATA | ||
129 | + // http://karaf.apache.org/manual/latest/users-guide/start-stop.html | ||
130 | + final String dataDir = System.getProperty("karaf.data", "./data"); | ||
131 | + | ||
129 | // load tablet configuration | 132 | // load tablet configuration |
130 | File file = new File(CONFIG_DIR, initialMemberConfig); | 133 | File file = new File(CONFIG_DIR, initialMemberConfig); |
131 | log.info("Loading config: {}", file.getAbsolutePath()); | 134 | log.info("Loading config: {}", file.getAbsolutePath()); |
... | @@ -179,7 +182,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -179,7 +182,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
179 | 182 | ||
180 | DatabaseStateMachine stateMachine = new DatabaseStateMachine(); | 183 | DatabaseStateMachine stateMachine = new DatabaseStateMachine(); |
181 | stateMachine.addEventListener(expirationTracker); | 184 | stateMachine.addEventListener(expirationTracker); |
182 | - Log consensusLog = new MapDBLog(LOG_FILE_PREFIX + localNode.id(), | 185 | + Log consensusLog = new MapDBLog(dataDir + "/" + LOG_FILE_PREFIX + localNode.id(), |
183 | ClusterMessagingProtocol.DB_SERIALIZER); | 186 | ClusterMessagingProtocol.DB_SERIALIZER); |
184 | 187 | ||
185 | CopycatConfig ccConfig = new CopycatConfig(); | 188 | CopycatConfig ccConfig = new CopycatConfig(); | ... | ... |
... | @@ -35,6 +35,10 @@ ssh $remote " | ... | @@ -35,6 +35,10 @@ ssh $remote " |
35 | mkdir $ONOS_INSTALL_DIR/var | 35 | mkdir $ONOS_INSTALL_DIR/var |
36 | mkdir $ONOS_INSTALL_DIR/config | 36 | mkdir $ONOS_INSTALL_DIR/config |
37 | 37 | ||
38 | + # create dir for Raft log | ||
39 | + # TODO: use $KARAF_DATA | ||
40 | + mkdir -p -- $ONOS_INSTALL_DIR/$KARAF_DIST/data/raft | ||
41 | + | ||
38 | # Install the upstart configuration file and setup options for debugging | 42 | # Install the upstart configuration file and setup options for debugging |
39 | [ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf | 43 | [ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf |
40 | echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options | 44 | echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options | ... | ... |
... | @@ -10,4 +10,5 @@ nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) | ... | @@ -10,4 +10,5 @@ nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) |
10 | 10 | ||
11 | onos-service --cell stop | 11 | onos-service --cell stop |
12 | 12 | ||
13 | -for node in $nodes; do onos-ssh $node "rm -v /tmp/onos-copy-cat-log_*"; done | 13 | +# TODO: use $KARAF_DATA |
14 | +for node in $nodes; do onos-ssh $node "rm -v -- $ONOS_INSTALL_DIR/$KARAF_DIST/data/raft/onos-copy-cat-log_*"; done | ... | ... |
-
Please register or login to post a comment