From e3bb6be5aa9c1bb3d74d7e93c4894a32b6124769 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Wed, 29 Jun 2016 00:24:45 +0200 Subject: [PATCH] ciao-controller: All running instances status should be 'active' When asking for a specific instance details or a list of instances details, the status string for a running instance should be consistent. Then, for OpenStack compatibility sake, we want this string to be 'active' and not 'running'. Fixes #323 Signed-off-by: Samuel Ortiz --- ciao-controller/compute.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ciao-controller/compute.go b/ciao-controller/compute.go index baf0cbee2..423128102 100644 --- a/ciao-controller/compute.go +++ b/ciao-controller/compute.go @@ -449,6 +449,12 @@ func instanceToServer(context *controller, instance *types.Instance) (payloads.S SSHPort: instance.SSHPort, } + // OpenStack compatibility: expected status for a running + // instance is 'active and not 'running'. + if server.Status == "running" { + server.Status = "active" + } + return server, nil } @@ -498,11 +504,6 @@ func showServerDetails(w http.ResponseWriter, r *http.Request, context *controll return } - // OpenStack compatibility: expect active status not running for API Call - if server.Server.Status == "running" { - server.Server.Status = "active" - } - b, err := json.Marshal(server) if err != nil { returnErrorCode(w, http.StatusInternalServerError, err.Error())