Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api work #403

Merged
merged 30 commits into from
Sep 11, 2023
Merged

api work #403

merged 30 commits into from
Sep 11, 2023

Commits on Sep 11, 2023

  1. Implement more api handlers

    * GET /instance/monitor
    * GET /instance/config
    
    Use x-go-type openapi syntax to avoid a lot of transtyping code.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    4827319 View commit details
    Browse the repository at this point in the history
  2. api tidying

    * Rename api.GetInstance*Element to api.Instance*Item
    
    * Use api.InstanceStatusItem in the PostInstanceStatus handler,
      so the POST and GET /instance/status use the same body format
    
    * Make PostInstanceStatus verify the emitter node is the
      localhost
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    30590d7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a67daf1 View commit details
    Browse the repository at this point in the history
  4. Add the GET /instance api handler

    Example:
    
    $ curl -X GET 'https://localhost:1215/instance?path=foo001'   -H 'accept: application/json'   -H 'Authorization: Basic ..'  -k -s |jq
    [
      {
        "data": {
          "config": {
            "app": "default",
            "csum": "80e572a36f85f34823211913bce56059",
            "children": [
              "foo010",
              "foo011",
              "foo012",
              "foo013",
              "foo014@dev2n1",
              "notexist"
            ],
            "orchestrate": "ha",
            "placement_policy": "last start",
            "priority": 50,
            "resources": {
              "fs#1": {
                "is_disabled": false,
                "is_monitored": false,
                "is_standby": false,
                "restart": 0,
                "restart_delay": 500000000
              },
              "volume#1": {
                "is_disabled": false,
                "is_monitored": false,
                "is_standby": false,
                "restart": 0,
                "restart_delay": 500000000
              },
              "volume#2": {
                "is_disabled": false,
                "is_monitored": false,
                "is_standby": false,
                "restart": 0,
                "restart_delay": 500000000
              },
              "volume#3": {
                "is_disabled": false,
                "is_monitored": false,
                "is_standby": false,
                "restart": 0,
                "restart_delay": 500000000
              }
            },
            "scope": [
              "dev2n1",
              "dev2n2",
              "dev2n3"
            ],
            "subsets": {},
            "topology": "failover",
            "updated_at": "2023-08-23T08:20:50.605710559+02:00"
          },
          "monitor": {
            "global_expect": "none",
            "global_expect_updated_at": "0001-01-01T00:00:00Z",
            "global_expect_options": null,
            "is_leader": false,
            "is_ha_leader": false,
            "local_expect": "started",
            "local_expect_updated_at": "2023-09-02T10:55:54.246600548+02:00",
            "orchestration_id": "00000000-0000-0000-0000-000000000000",
            "orchestration_is_done": false,
            "session_id": "00000000-0000-0000-0000-000000000000",
            "state": "idle",
            "state_updated_at": "2023-09-02T10:55:51.397889345+02:00",
            "monitor_action_executed_at": "0001-01-01T00:00:00Z",
            "preserved": false,
            "resources": {
              "fs#1": {
                "restart": {
                  "remaining": 0,
                  "last_at": "0001-01-01T00:00:00Z"
                }
              },
              "volume#1": {
                "restart": {
                  "remaining": 0,
                  "last_at": "0001-01-01T00:00:00Z"
                }
              },
              "volume#2": {
                "restart": {
                  "remaining": 0,
                  "last_at": "0001-01-01T00:00:00Z"
                }
              },
              "volume#3": {
                "restart": {
                  "remaining": 0,
                  "last_at": "0001-01-01T00:00:00Z"
                }
              }
            },
            "updated_at": "2023-09-02T10:55:54.246628287+02:00",
            "children": {
              "foo010": "up",
              "foo011": "up",
              "foo012": "undef",
              "foo013": "up",
              "foo014@dev2n1": "up",
              "notexist": "undef"
            }
          },
          "status": {
            "avail": "up",
            "frozen_at": "0001-01-01T00:00:00Z",
            "last_started_at": "2023-08-25T19:35:47.633870082+02:00",
            "overall": "up",
            "provisioned": "true",
            "resources": [
              {
                "rid": "volume#1",
                "label": "foo001-vol-1",
                "status": "up",
                "type": "volume",
                "provisioned": {
                  "mtime": "2023-07-06T10:03:25.231284828+02:00",
                  "state": "true"
                }
              },
              {
                "rid": "volume#2",
                "label": "foo001-vol-2",
                "status": "up",
                "type": "volume",
                "provisioned": {
                  "mtime": "2023-07-06T10:03:30.127315837+02:00",
                  "state": "true"
                }
              },
              {
                "rid": "volume#3",
                "label": "foo001-vol-3",
                "status": "up",
                "type": "volume",
                "provisioned": {
                  "mtime": "2023-07-06T10:03:35.211348039+02:00",
                  "state": "true"
                }
              },
              {
                "rid": "fs#1",
                "label": "flag /dev/shm/opensvc/svc/foo001/fs#1.flag",
                "status": "up",
                "type": "fs.flag",
                "provisioned": {
                  "mtime": "2023-07-06T10:03:35.543350141+02:00",
                  "state": "true"
                }
              }
            ],
            "updated_at": "2023-09-02T10:55:51.574173407+02:00"
          }
        },
        "meta": {
          "node": "dev2n1",
          "object": "foo001"
        }
      },
    ...
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    a8e805f View commit details
    Browse the repository at this point in the history
  5. Stop using POST /object/monitor

    Use POST /objet/action/<action> instead, in the objectaction
    package.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    9202652 View commit details
    Browse the repository at this point in the history
  6. Use POST /object/action/abort instead of /object/abort

    And drop the POST /object/abort handler.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    e8b7d43 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    36d3ee9 View commit details
    Browse the repository at this point in the history
  8. Add /node handlers

    GET /node
    GET /node/config
    GET /node/status
    GET /node/monitor
    
    These handlers return list of meta+data items, suited for
    filtered by meta tabular outputs.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    167dbbf View commit details
    Browse the repository at this point in the history
  9. Add /cluster handlers

    * POST /cluster/action/abort
    * POST /cluster/action/freeze
    * POST /cluster/action/unfreeze
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    919f18b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    6c21dbc View commit details
    Browse the repository at this point in the history
  11. Rename "node abort" cmd as "cluster abort"

    As "cluster freeze" and "cluster unfreeze" are the command to
    submit an orchestration, the orchestration abort must be in the
    same command subsystem.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    977ce60 View commit details
    Browse the repository at this point in the history
  12. Fix the "om3 node drain" command

    Set LocalExpect instead of State to "drained".
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    f586128 View commit details
    Browse the repository at this point in the history
  13. Add the "om <sel> instance ls" command

    Example:
    
    root@dev2n1:~/dev/om3# ./om3 "test/**" instance ls
    OBJ           NODE   AVAIL
    test/svc/svc1 dev2n1 n/a
    test/cfg/cfg1 dev2n1 n/a
    test/cfg/cfg1 dev2n3 n/a
    test/cfg/cfg1 dev2n2 n/a
    
    Also add support for adding columns to a default columning.
    
    Example:
    
    root@dev2n1:~/dev/om3# ./om3 "test/**" instance ls -o "+OVERALL:.data.status.overall"
    OBJ           NODE   AVAIL OVERALL
    test/cfg/cfg1 dev2n2 n/a   n/a
    test/cfg/cfg1 dev2n1 n/a   n/a
    test/svc/svc1 dev2n1 n/a   n/a
    test/cfg/cfg1 dev2n3 n/a   n/a
    
    This patch also rename the output.Renderer.Format field to
    output.Renderer.Output for alignment with the commandline --output.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    6a26c21 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    c145732 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    9c77ad5 View commit details
    Browse the repository at this point in the history
  16. Add fine-grained "instance * ls" commands

    * instance config ls
    * instance monitor ls
    * instance status ls
    
    In addition to instance ls that reports all of the above info.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    1347870 View commit details
    Browse the repository at this point in the history
  17. Revert to maps to repr res config monitor and status in instance

    So the rid is not embeded in rcfg, rstat and rmon
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    5d8f610 View commit details
    Browse the repository at this point in the history
  18. Rename resource.Status() to EvalStatus()

    So the Status word is free to be used as a type.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    6f5c76f View commit details
    Browse the repository at this point in the history
  19. Renames in the resource package

    * ExposedStatus => Status
    * GetExposedStatus => GetStatus
    * exposedStatusInfo => getStatusInfo
    * exposedStatusInfoSched => getStatusInfoSched
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    a22c35a View commit details
    Browse the repository at this point in the history
  20. Add the GET /object handler

    And convert the "ls" command to use that.
    
    Also,
    * Fix the yaml properties stripped from their underscore.
    * Rename the drbd allocation ExpireAt to ExpiredAt
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    c6791bf View commit details
    Browse the repository at this point in the history
  21. Add GET /resource handlers

    * GET /resource
    * GET /resource/config
    * GET /resource/monitor
    * GET /resource/status
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    04e5cc6 View commit details
    Browse the repository at this point in the history
  22. Fix the daemondata test

    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    4c4917d View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    1e2c735 View commit details
    Browse the repository at this point in the history
  24. Fix core/instance tests

    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    823ae9e View commit details
    Browse the repository at this point in the history
  25. Fix the core/object go tests

    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    df29284 View commit details
    Browse the repository at this point in the history
  26. Add the "resource * ls" commandset

    * resource ls
    * resource config ls
    * resource monitor ls
    * resource status ls
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    e21b55a View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    d1d7b51 View commit details
    Browse the repository at this point in the history
  28. Don't exit from tab renderer on jsonpath find error

    Report the error in the table cell and continue, so the user can
    easily see which part of the columning syntax is wrong.
    cvaroqui committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    515f6ab View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    53d1162 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    9fae4e3 View commit details
    Browse the repository at this point in the history