Support Drain SLA API (#88)

* Bringing thrift API up to date with Aurora 0.21.0.

* Adding support for SLA Drain Host API.
This commit is contained in:
Renan DelValle 2018-11-16 11:41:09 -08:00 committed by GitHub
parent a09a18ea3b
commit 2eaa60f681
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 2842 additions and 1323 deletions

View file

@ -554,6 +554,37 @@ func main() {
fmt.Print(result.String())
case "SLADrainHosts":
fmt.Println("Setting hosts to DRAINING using SLA aware draining")
if hostList == "" {
log.Fatal("No hosts specified to drain")
}
hosts := strings.Split(hostList, ",")
policy := aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 50.0}}
result, err := r.SLADrainHosts(&policy, 30, hosts...)
if err != nil {
log.Fatalf("error: %+v\n", err.Error())
}
// Monitor change to DRAINING and DRAINED mode
hostResult, err := monitor.HostMaintenance(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
5,
10)
if err != nil {
for host, ok := range hostResult {
if !ok {
fmt.Printf("Host %s did not transtion into desired mode(s)\n", host)
}
}
log.Fatalf("error: %+v\n", err.Error())
}
fmt.Print(result.String())
case "endMaintenance":
fmt.Println("Setting hosts to ACTIVE")
if hostList == "" {