diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst index 66e43b637..4373cd8b1 100644 --- a/api-ref/source/index.rst +++ b/api-ref/source/index.rst @@ -15,3 +15,4 @@ Watcher API .. include:: watcher-api-v1-strategies.inc .. include:: watcher-api-v1-services.inc .. include:: watcher-api-v1-scoring_engines.inc +.. include:: watcher-api-v1-datamodel.inc diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 6df5171e5..b454e363b 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -129,6 +129,14 @@ r_strategy: in: query required: false type: string +r_type: + description: | + Type of data model user want to list. Default type is compute. + Supported values: compute. + Future support values: storage, baremetal. + in: query + required: false + type: string sort_dir: description: | Sorts the response by the requested sort direction. @@ -411,6 +419,62 @@ links: required: true type: array +# Data Model Node +node_disk: + description: | + The Disk of the node(in GiB). + in: body + required: true + type: integer +node_disk_ratio: + description: | + The Disk Ratio of the node. + in: body + required: true + type: float +node_hostname: + description: | + The Host Name of the node. + in: body + required: true + type: string +node_memory: + description: | + The Memory of the node(in MiB). + in: body + required: true + type: integer +node_memory_ratio: + description: | + The Memory Ratio of the node. + in: body + required: true + type: float +node_state: + description: | + The State of the node. The value is up or down. + in: body + required: true + type: string +node_uuid: + description: | + The Unique UUID of the node. + in: body + required: true + type: string +node_vcpu_ratio: + description: | + The Vcpu ratio of the node. + in: body + required: true + type: float +node_vcpus: + description: | + The Vcpu of the node. + in: body + required: true + type: integer + # Scoring Engine scoring_engine_description: description: | @@ -430,34 +494,72 @@ scoring_engine_name: in: body required: true type: string + +# Data Model Server +server_disk: + description: | + The Disk of the server. + in: body + required: true + type: integer +server_memory: + description: | + The Memory of server. + in: body + required: true + type: integer +server_name: + description: | + The Name of the server. + in: body + required: true + type: string +server_state: + description: | + The State of the server. + in: body + required: true + type: string +server_uuid: + description: | + The Unique UUID of the server. + in: body + required: true + type: string +server_vcpus: + description: | + The Vcpu of the server. + in: body + required: true + type: integer # Service service_host: description: | - Name of host where service is placed on. + The Name of host where service is placed on. in: body required: true type: string service_id: description: | - ID of service. + The ID of service. in: body required: true type: integer service_last_seen_up: description: | - Time when Watcher service sent latest heartbeat. + The Time when Watcher service sent latest heartbeat. in: body required: true type: string service_name: description: | - Name of service like ``watcher-applier``. + The Name of service like ``watcher-applier``. in: body required: true type: string service_status: description: | - State of service. It can be either in ACTIVE or FAILED state. + The State of service. It can be either in ACTIVE or FAILED state. in: body required: true type: string diff --git a/api-ref/source/samples/datamodel-list-response.json b/api-ref/source/samples/datamodel-list-response.json new file mode 100644 index 000000000..11de82dda --- /dev/null +++ b/api-ref/source/samples/datamodel-list-response.json @@ -0,0 +1,38 @@ +{ + "context": [ + { + "server_uuid": "1bf91464-9b41-428d-a11e-af691e5563bb", + "server_name": "chenke-test1", + "server_vcpus": "1", + "server_memory": "512", + "server_disk": "1", + "server_state": "active", + "node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112", + "node_hostname": "localhost.localdomain", + "node_vcpus": "4", + "node_vcpu_ratio": "16.0", + "node_memory": "16383", + "node_memory_ratio": "1.5", + "node_disk": "37" + "node_disk_ratio": "1.0", + "node_state": "up", + }, + { + "server_uuid": "e2cb5f6f-fa1d-4ba2-be1e-0bf02fa86ba4", + "server_name": "chenke-test2", + "server_vcpus": "1", + "server_memory": "512", + "server_disk": "1", + "server_state": "active", + "node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112", + "node_hostname": "localhost.localdomain", + "node_vcpus": "4", + "node_vcpu_ratio": "16.0", + "node_memory": "16383", + "node_memory_ratio": "1.5", + "node_disk": "37" + "node_disk_ratio": "1.0", + "node_state": "up", + } + ] +} diff --git a/api-ref/source/watcher-api-v1-datamodel.inc b/api-ref/source/watcher-api-v1-datamodel.inc new file mode 100644 index 000000000..60e3cafd3 --- /dev/null +++ b/api-ref/source/watcher-api-v1-datamodel.inc @@ -0,0 +1,55 @@ +.. -*- rst -*- + +========== +Data Model +========== + +``Data Model`` is very important for Watcher to generate resource +optimization solutions. Users can easily view the data model by the +API. + + +List Data Model +=============== + +.. rest_method:: GET /v1/data_model + +Returns the information about Data Model. + +Normal response codes: 200 + +Error codes: 400,401 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - audit: r_audit + - type: r_type + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - server_uuid: server_uuid + - server_name: server_name + - server_vcpus: server_vcpus + - server_memory: server_memory + - server_disk: server_disk + - server_state: server_state + - node_uuid: node_uuid + - node_hostname: node_hostname + - node_vcpus: node_vcpus + - node_vcpu_ratio: node_vcpu_ratio + - node_memory: node_memory + - node_memory_ratio: node_memory_ratio + - node_disk: node_disk + - node_disk_ratio: node_disk_ratio + - node_state: node_state + +**Example JSON representation of a Data Model:** + +.. literalinclude:: samples/datamodel-list-response.json + :language: javascript