Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
3255b726
Commit
3255b726
authored
11 years ago
by
Rob Adams
Browse files
Options
Downloads
Patches
Plain Diff
Add delete node option and make it so you can set domain ID and seeds at the same time
parent
ab43676d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/sdnplatform/sync/client/BootstrapTool.java
+37
-24
37 additions, 24 deletions
src/main/java/org/sdnplatform/sync/client/BootstrapTool.java
src/test/java/org/sdnplatform/sync/internal/BootstrapTest.java
+1
-1
1 addition, 1 deletion
...est/java/org/sdnplatform/sync/internal/BootstrapTest.java
with
38 additions
and
25 deletions
src/main/java/org/sdnplatform/sync/client/BootstrapTool.java
+
37
−
24
View file @
3255b726
package
org.sdnplatform.sync.client
;
import
java.util.ArrayList
;
import
org.kohsuke.args4j.Option
;
import
org.sdnplatform.sync.IStoreClient
;
import
org.sdnplatform.sync.Versioned
;
...
...
@@ -56,6 +55,13 @@ public class BootstrapTool extends SyncClientBase {
"bootstrap process while retaining existing node IDs. "
+
"The node will be put into its own local domain."
)
protected
boolean
reseed
;
@Option
(
name
=
"--delete"
,
usage
=
"Remove the specified node from the cluster. Note "
+
"that if the node is still active it will rejoin "
+
"automatically, so only run this once the node has "
+
"been disabled."
)
protected
short
deleteNode
;
}
public
BootstrapTool
(
BootstrapToolSettings
bootstrapSettings
)
{
...
...
@@ -72,21 +78,6 @@ public class BootstrapTool extends SyncClientBase {
syncManager
.
getStoreClient
(
SyncStoreCCProvider
.
SYSTEM_NODE_STORE
,
Short
.
class
,
Node
.
class
);
Short
localNodeId
=
null
;
if
(
bSettings
.
reseed
||
bSettings
.
domainId
!=
0
)
{
String
localNodeIdStr
=
waitForValue
(
uStoreClient
,
SyncStoreCCProvider
.
LOCAL_NODE_ID
,
5000000
);
if
(
localNodeIdStr
==
null
)
{
err
.
println
(
"Error: Local node ID is not set; you must "
+
"first seed the cluster by using the --seeds "
+
"option"
);
System
.
exit
(
3
);
}
localNodeId
=
Short
.
valueOf
(
localNodeIdStr
);
}
if
(
bSettings
.
localNodeIface
!=
null
)
{
while
(
true
)
{
...
...
@@ -115,14 +106,6 @@ public class BootstrapTool extends SyncClientBase {
}
catch
(
ObsoleteVersionException
e
)
{}
}
}
if
(
bSettings
.
reseed
)
{
while
(
true
)
{
try
{
nodeStoreClient
.
delete
(
localNodeId
);
break
;
}
catch
(
ObsoleteVersionException
e
)
{
};
}
}
if
(
bSettings
.
seeds
!=
null
)
{
String
[]
seedsStr
=
bSettings
.
seeds
.
split
(
","
);
boolean
seedsvalid
=
true
;
...
...
@@ -153,6 +136,28 @@ public class BootstrapTool extends SyncClientBase {
}
catch
(
ObsoleteVersionException
e
)
{}
}
}
Short
localNodeId
=
null
;
if
(
bSettings
.
reseed
||
bSettings
.
domainId
!=
0
)
{
String
localNodeIdStr
=
waitForValue
(
uStoreClient
,
SyncStoreCCProvider
.
LOCAL_NODE_ID
,
10000000000L
);
if
(
localNodeIdStr
==
null
)
{
err
.
println
(
"Error: Local node ID is not set; you must "
+
"first seed the cluster by using the --seeds "
+
"option"
);
System
.
exit
(
3
);
}
localNodeId
=
Short
.
valueOf
(
localNodeIdStr
);
}
if
(
bSettings
.
reseed
)
{
while
(
true
)
{
try
{
nodeStoreClient
.
delete
(
localNodeId
);
break
;
}
catch
(
ObsoleteVersionException
e
)
{
};
}
}
if
(
bSettings
.
domainId
!=
0
)
{
while
(
true
)
{
try
{
...
...
@@ -176,6 +181,14 @@ public class BootstrapTool extends SyncClientBase {
}
}
if
(
bSettings
.
deleteNode
!=
0
)
{
while
(
true
)
{
try
{
nodeStoreClient
.
delete
(
bSettings
.
deleteNode
);
break
;
}
catch
(
ObsoleteVersionException
e
)
{}
}
}
}
private
String
waitForValue
(
IStoreClient
<
String
,
String
>
uStoreClient
,
...
...
This diff is collapsed.
Click to expand it.
src/test/java/org/sdnplatform/sync/internal/BootstrapTest.java
+
1
−
1
View file @
3255b726
...
...
@@ -138,7 +138,7 @@ public class BootstrapTest {
syncManagers
.
toArray
(
new
SyncManager
[
syncManagers
.
size
()]);
waitForFullMesh
(
syncManagerArr
,
5000
);
logger
.
info
(
"Cluster successfully buil
d
. Attempting reseed"
);
logger
.
info
(
"Cluster successfully buil
t
. Attempting reseed"
);
// Test reseeding
nodeStores
.
get
(
0
).
delete
(
nodeIds
.
get
(
0
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment