Browse Source

Merge "Add api-ref doc for data model api"

changes/77/563477/4
Zuul 1 week ago
parent
commit
7d1b179d32

+ 1
- 0
api-ref/source/index.rst View File

@@ -15,3 +15,4 @@ Watcher API
15 15
 .. include:: watcher-api-v1-strategies.inc
16 16
 .. include:: watcher-api-v1-services.inc
17 17
 .. include:: watcher-api-v1-scoring_engines.inc
18
+.. include:: watcher-api-v1-datamodel.inc

+ 107
- 5
api-ref/source/parameters.yaml View File

@@ -129,6 +129,14 @@ r_strategy:
129 129
   in: query
130 130
   required: false
131 131
   type: string
132
+r_type:
133
+  description: |
134
+    Type of data model user want to list. Default type is compute.
135
+    Supported values: compute.
136
+    Future support values: storage, baremetal.
137
+  in: query
138
+  required: false
139
+  type: string
132 140
 sort_dir:
133 141
   description: |
134 142
     Sorts the response by the requested sort direction.
@@ -411,6 +419,62 @@ links:
411 419
   required: true
412 420
   type: array
413 421
 
422
+# Data Model Node
423
+node_disk:
424
+  description: |
425
+    The Disk of the node(in GiB).
426
+  in: body
427
+  required: true
428
+  type: integer
429
+node_disk_ratio:
430
+  description: |
431
+    The Disk Ratio of the node.
432
+  in: body
433
+  required: true
434
+  type: float
435
+node_hostname:
436
+  description: |
437
+    The Host Name of the node.
438
+  in: body
439
+  required: true
440
+  type: string
441
+node_memory:
442
+  description: |
443
+    The Memory of the node(in MiB).
444
+  in: body
445
+  required: true
446
+  type: integer
447
+node_memory_ratio:
448
+  description: |
449
+    The Memory Ratio of the node.
450
+  in: body
451
+  required: true
452
+  type: float
453
+node_state:
454
+  description: |
455
+    The State of the node. The value is up or down.
456
+  in: body
457
+  required: true
458
+  type: string
459
+node_uuid:
460
+  description: |
461
+    The Unique UUID of the node.
462
+  in: body
463
+  required: true
464
+  type: string
465
+node_vcpu_ratio:
466
+  description: |
467
+    The Vcpu ratio of the node.
468
+  in: body
469
+  required: true
470
+  type: float
471
+node_vcpus:
472
+  description: |
473
+    The Vcpu of the node.
474
+  in: body
475
+  required: true
476
+  type: integer
477
+
414 478
 # Scoring Engine
415 479
 scoring_engine_description:
416 480
   description: |
@@ -430,34 +494,72 @@ scoring_engine_name:
430 494
   in: body
431 495
   required: true
432 496
   type: string
497
+
498
+# Data Model Server
499
+server_disk:
500
+  description: |
501
+    The Disk of the server.
502
+  in: body
503
+  required: true
504
+  type: integer
505
+server_memory:
506
+  description: |
507
+    The Memory of server.
508
+  in: body
509
+  required: true
510
+  type: integer
511
+server_name:
512
+  description: |
513
+    The Name of the server.
514
+  in: body
515
+  required: true
516
+  type: string
517
+server_state:
518
+  description: |
519
+    The State of the server.
520
+  in: body
521
+  required: true
522
+  type: string
523
+server_uuid:
524
+  description: |
525
+    The Unique UUID of the server.
526
+  in: body
527
+  required: true
528
+  type: string
529
+server_vcpus:
530
+  description: |
531
+    The Vcpu of the server.
532
+  in: body
533
+  required: true
534
+  type: integer
433 535
 # Service
434 536
 service_host:
435 537
   description: |
436
-    Name of host where service is placed on.
538
+    The Name of host where service is placed on.
437 539
   in: body
438 540
   required: true
439 541
   type: string
440 542
 service_id:
441 543
   description: |
442
-    ID of service.
544
+    The ID of service.
443 545
   in: body
444 546
   required: true
445 547
   type: integer
446 548
 service_last_seen_up:
447 549
   description: |
448
-    Time when Watcher service sent latest heartbeat.
550
+    The Time when Watcher service sent latest heartbeat.
449 551
   in: body
450 552
   required: true
451 553
   type: string
452 554
 service_name:
453 555
   description: |
454
-    Name of service like ``watcher-applier``.
556
+    The Name of service like ``watcher-applier``.
455 557
   in: body
456 558
   required: true
457 559
   type: string
458 560
 service_status:
459 561
   description: |
460
-    State of service. It can be either in ACTIVE or FAILED state.
562
+    The State of service. It can be either in ACTIVE or FAILED state.
461 563
   in: body
462 564
   required: true
463 565
   type: string

+ 38
- 0
api-ref/source/samples/datamodel-list-response.json View File

@@ -0,0 +1,38 @@
1
+{
2
+    "context": [
3
+        {
4
+            "server_uuid": "1bf91464-9b41-428d-a11e-af691e5563bb",
5
+            "server_name": "chenke-test1",
6
+            "server_vcpus": "1",
7
+            "server_memory": "512",
8
+            "server_disk": "1",
9
+            "server_state": "active",
10
+            "node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112",
11
+            "node_hostname": "localhost.localdomain",
12
+            "node_vcpus": "4",
13
+            "node_vcpu_ratio": "16.0",
14
+            "node_memory": "16383",
15
+            "node_memory_ratio": "1.5",
16
+            "node_disk": "37"
17
+            "node_disk_ratio": "1.0",
18
+            "node_state": "up",
19
+        },
20
+        {
21
+            "server_uuid": "e2cb5f6f-fa1d-4ba2-be1e-0bf02fa86ba4",
22
+            "server_name": "chenke-test2",
23
+            "server_vcpus": "1",
24
+            "server_memory": "512",
25
+            "server_disk": "1",
26
+            "server_state": "active",
27
+            "node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112",
28
+            "node_hostname": "localhost.localdomain",
29
+            "node_vcpus": "4",
30
+            "node_vcpu_ratio": "16.0",
31
+            "node_memory": "16383",
32
+            "node_memory_ratio": "1.5",
33
+            "node_disk": "37"
34
+            "node_disk_ratio": "1.0",
35
+            "node_state": "up",
36
+        }
37
+    ]
38
+}

+ 55
- 0
api-ref/source/watcher-api-v1-datamodel.inc View File

@@ -0,0 +1,55 @@
1
+.. -*- rst -*-
2
+
3
+==========
4
+Data Model
5
+==========
6
+
7
+``Data Model`` is very important for Watcher to generate resource
8
+optimization solutions. Users can easily view the data model by the
9
+API.
10
+
11
+
12
+List Data Model
13
+===============
14
+
15
+.. rest_method::  GET /v1/data_model
16
+
17
+Returns the information about Data Model.
18
+
19
+Normal response codes: 200
20
+
21
+Error codes: 400,401
22
+
23
+Request
24
+-------
25
+
26
+.. rest_parameters:: parameters.yaml
27
+
28
+   - audit: r_audit
29
+   - type: r_type
30
+
31
+Response
32
+--------
33
+
34
+.. rest_parameters:: parameters.yaml
35
+
36
+    - server_uuid: server_uuid
37
+    - server_name: server_name
38
+    - server_vcpus: server_vcpus
39
+    - server_memory: server_memory
40
+    - server_disk: server_disk
41
+    - server_state: server_state
42
+    - node_uuid: node_uuid
43
+    - node_hostname: node_hostname
44
+    - node_vcpus: node_vcpus
45
+    - node_vcpu_ratio: node_vcpu_ratio
46
+    - node_memory: node_memory
47
+    - node_memory_ratio: node_memory_ratio
48
+    - node_disk: node_disk
49
+    - node_disk_ratio: node_disk_ratio
50
+    - node_state: node_state
51
+
52
+**Example JSON representation of a Data Model:**
53
+
54
+.. literalinclude:: samples/datamodel-list-response.json
55
+   :language: javascript

Loading…
Cancel
Save