From ed9c19d02c21b66d888715c63a8d99116ff36671 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Mon, 9 Jan 2017 15:40:02 +0800 Subject: [PATCH] Remove target_power_state Maybe this is useful for tracking power transition, but seems we should expose task_state or something else to users instead of just using ironic's feild, this is the first step of refactoring. Change-Id: Ibe83f3bfd534e2600769f39045da4d2812ebf5e1 --- api-ref/source/v1/instances.inc | 4 +--- api-ref/source/v1/parameters.yaml | 7 ------- .../v1/samples/instances/instance-get-state-response.json | 3 +-- mogan/api/controllers/v1/instances.py | 8 ++------ 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/api-ref/source/v1/instances.inc b/api-ref/source/v1/instances.inc index 08547d7e..3dc9b127 100644 --- a/api-ref/source/v1/instances.inc +++ b/api-ref/source/v1/instances.inc @@ -296,8 +296,7 @@ Instance Management (instances) Instances can be managed through several sub-resources. A Instance can be rebooted, turned on, or turned off by requesting a change to -its power state. This is handled asynchronously and tracked in the -``target_power_state`` field after the request is received. +its power state. This is handled asynchronously. Instance State Summary @@ -322,7 +321,6 @@ Response .. rest_parameters:: parameters.yaml - power_state: power_state - - target_power_state: target_power_state **Example instance state:** diff --git a/api-ref/source/v1/parameters.yaml b/api-ref/source/v1/parameters.yaml index b0bca8bd..d8901511 100644 --- a/api-ref/source/v1/parameters.yaml +++ b/api-ref/source/v1/parameters.yaml @@ -210,13 +210,6 @@ project_id_body: in: body required: true type: string -target_power_state: - description: | - If a power state transition has been requested, this field represents the - requested (ie, "target") state. - in: body - required: true - type: string type_description: description: | The description of the type. diff --git a/api-ref/source/v1/samples/instances/instance-get-state-response.json b/api-ref/source/v1/samples/instances/instance-get-state-response.json index baae88ec..997ddc2e 100644 --- a/api-ref/source/v1/samples/instances/instance-get-state-response.json +++ b/api-ref/source/v1/samples/instances/instance-get-state-response.json @@ -1,4 +1,3 @@ { - "power_state": "power off", - "target_power_state": null + "power_state": "power off" } diff --git a/mogan/api/controllers/v1/instances.py b/mogan/api/controllers/v1/instances.py index cdcb74bc..fb02c0fd 100644 --- a/mogan/api/controllers/v1/instances.py +++ b/mogan/api/controllers/v1/instances.py @@ -85,15 +85,11 @@ class InstanceStates(base.APIBase): # Just support power state at present. # We can expend other fields for other type state. power_state = wtypes.text - """Represent the current (not transition) power state of the instance""" - - target_power_state = wtypes.text - """The user modified desired power state of the instance.""" + """Represent the current power state of the instance""" @classmethod def sample(cls): - sample = cls(target_power_state=ir_states.POWER_ON, - power_state=ir_states.POWER_ON) + sample = cls(power_state=ir_states.POWER_ON) return sample