aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-21 14:07:15 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-21 14:08:28 +0000
commitbe0a2bae8112de1d4674767c5c60e296c28e8532 (patch)
tree84211f371693c9085caf6bf27c6bae715dbdd599 /src/main.rs
parentcc4f2f1cfb30e3995edf3c1174bd06b4bc0a9bf1 (diff)
downloadgarage-be0a2bae8112de1d4674767c5c60e296c28e8532.tar.gz
garage-be0a2bae8112de1d4674767c5c60e296c28e8532.zip
Add node tags in configuration
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 9b75740d..01972928 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -111,6 +111,10 @@ pub struct ConfigureNodeOpt {
/// Number of tokens
n_tokens: u32,
+
+ /// Optionnal node tag
+ #[structopt(long = "tag", default_value = "")]
+ tag: String,
}
#[derive(StructOpt, Debug)]
@@ -266,8 +270,8 @@ async fn cmd_status(rpc_cli: RpcAddrClient<Message>, rpc_host: SocketAddr) -> Re
for adv in status.iter() {
if let Some(cfg) = config.members.get(&adv.id) {
println!(
- "{:?}\t{}\t{}\t{}\t{}",
- adv.id, adv.state_info.hostname, adv.addr, cfg.datacenter, cfg.n_tokens
+ "{:?}\t{}\t{}\t{}\t{}\t{}",
+ adv.id, adv.state_info.hostname, adv.addr, cfg.tag, cfg.datacenter, cfg.n_tokens
);
}
}
@@ -281,7 +285,10 @@ async fn cmd_status(rpc_cli: RpcAddrClient<Message>, rpc_host: SocketAddr) -> Re
println!("\nFailed nodes:");
for (id, cfg) in config.members.iter() {
if !status.iter().any(|x| x.id == *id) {
- println!("{:?}\t{}\t{}", id, cfg.datacenter, cfg.n_tokens);
+ println!(
+ "{:?}\t{}\t{}\t{}",
+ id, cfg.tag, cfg.datacenter, cfg.n_tokens
+ );
}
}
}
@@ -340,6 +347,7 @@ async fn cmd_configure(
NetworkConfigEntry {
datacenter: args.datacenter,
n_tokens: args.n_tokens,
+ tag: args.tag,
},
);
config.version += 1;