[next-0.10] admin api: fix logic in get cluster status
All checks were successful
ci/woodpecker/pr/debug Pipeline was successful
ci/woodpecker/push/debug Pipeline was successful
ci/woodpecker/deployment/debug Pipeline was successful
ci/woodpecker/deployment/release/4 Pipeline was successful
ci/woodpecker/deployment/release/1 Pipeline was successful
ci/woodpecker/deployment/release/3 Pipeline was successful
ci/woodpecker/deployment/release/2 Pipeline was successful
ci/woodpecker/deployment/publish Pipeline was successful
ci/woodpecker/cron/release/3 Pipeline was successful
ci/woodpecker/cron/release/2 Pipeline was successful
ci/woodpecker/cron/release/1 Pipeline was successful
ci/woodpecker/cron/debug Pipeline was successful
ci/woodpecker/cron/release/4 Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
All checks were successful
ci/woodpecker/pr/debug Pipeline was successful
ci/woodpecker/push/debug Pipeline was successful
ci/woodpecker/deployment/debug Pipeline was successful
ci/woodpecker/deployment/release/4 Pipeline was successful
ci/woodpecker/deployment/release/1 Pipeline was successful
ci/woodpecker/deployment/release/3 Pipeline was successful
ci/woodpecker/deployment/release/2 Pipeline was successful
ci/woodpecker/deployment/publish Pipeline was successful
ci/woodpecker/cron/release/3 Pipeline was successful
ci/woodpecker/cron/release/2 Pipeline was successful
ci/woodpecker/cron/release/1 Pipeline was successful
ci/woodpecker/cron/debug Pipeline was successful
ci/woodpecker/cron/release/4 Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
This commit is contained in:
parent
4eba32f29f
commit
25c196f34d
1 changed files with 16 additions and 12 deletions
|
@ -70,18 +70,21 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Some(n) => {
|
Some(n) => {
|
||||||
if n.role.is_none() {
|
|
||||||
n.role = Some(role);
|
n.role = Some(role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for ver in layout.versions().iter().rev().skip(1) {
|
for ver in layout.versions().iter().rev().skip(1) {
|
||||||
for (id, _, role) in ver.roles.items().iter() {
|
for (id, _, role) in ver.roles.items().iter() {
|
||||||
if let layout::NodeRoleV(Some(r)) = role {
|
if let layout::NodeRoleV(Some(r)) = role {
|
||||||
if !nodes.contains_key(id) && r.capacity.is_some() {
|
if r.capacity.is_some() {
|
||||||
|
if let Some(n) = nodes.get_mut(id) {
|
||||||
|
if n.role.is_none() {
|
||||||
|
n.draining = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
nodes.insert(
|
nodes.insert(
|
||||||
*id,
|
*id,
|
||||||
NodeResp {
|
NodeResp {
|
||||||
|
@ -94,6 +97,7 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut nodes = nodes.into_values().collect::<Vec<_>>();
|
let mut nodes = nodes.into_values().collect::<Vec<_>>();
|
||||||
nodes.sort_by(|x, y| x.id.cmp(&y.id));
|
nodes.sort_by(|x, y| x.id.cmp(&y.id));
|
||||||
|
|
Loading…
Reference in a new issue