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

Various log_set_flag RPC issues #3365

Open
jimharris opened this issue May 3, 2024 · 1 comment
Open

Various log_set_flag RPC issues #3365

jimharris opened this issue May 3, 2024 · 1 comment
Assignees
Labels

Comments

@jimharris
Copy link
Member

jimharris commented May 3, 2024

I'm grouping a few things in one issue rather than submitting separate ones for each. Probably if one person is going to fix one of these, they'll look at all of them.

  1. log_set_flag RPC doesn't return an error if an invalid flag name is passed
  2. save_config RPC does not emit log_set_flag RPCs for the currently set flags

I think it would also be nice if we could pass a comma separated list of log flags to enable - not just for the RPC but also on the command line. We already do something similar for tracing groups on the command line (i.e. -e bdev,nvmf_tcp). This would avoid 100+ log_set_flag calls in the JSON-RPC conf file if user passed -L all on the command line. I guess in that case log library could detect that all flags were set and emit log_set_flag all to the RPC conf, but I still think a comma separated list would be a nice-to-have.

Obviously log_clear_flag RPC needs to be fixed too.

@ksprzacz ksprzacz self-assigned this May 17, 2024
@ksprzacz
Copy link
Contributor

ksprzacz commented May 22, 2024

The working-progress proposal you can find here: [(https://review.spdk.io/gerrit/c/spdk/spdk/+/23221)]

So far addressed topics:

  1. log_set_flag: RPC doesn't return an error if an invalid flag name is passed
  2. log_set_flag: pass all or a comma-separated list of log flags to enable (for the RPC)
  3. log_clear_flag: RPC doesn't return an error if an invalid flag name is passed
  4. log_clear_flag: pass all or a comma-separated list of log flags to disable (for the RPC)
  5. save_config RPC does not emit log_set_flag RPCs for the currently set flags
  6. load_config RPC should restore flags based on config.json

To do:

  • log_set_flag: pass a comma-separated list of log flags to enable (for the command line)
  • log_clear_flag: pass a comma-separated list of log flags to disable (for the command line)

Ad.1

$ scripts/rpc.py log_set_flag nonexist_flag
request:
{
  "flag": "nonexist_flag",
  "method": "log_set_flag",
  "req_id": 1
}
Got JSON-RPC error response
response:
{
  "code": -32602,
  "message": "invalid log flag"
}

Ad.2

$ scripts/rpc.py log_set_flag all 
$ scripts/rpc.py log_set_flag nvme,bdev,lvol 

Ad.3

$ scripts/rpc.py log_clear_flag nonexist_flag
request:
{
  "flag": "nonexist_flag",
  "method": "log_clear_flag",
  "req_id": 1
}
Got JSON-RPC error response
response:
{
  "code": -32602,
  "message": "invalid log flag"
}

Ad.4

$ scripts/rpc.py log_clear_flag all 
$ scripts/rpc.py log_clear_flag nvme,bdev,lvol 

Ad.5
NOTE: only enabled flags are saved

$ scripts/rpc.py save_config > config.json
{
  "subsystems": [
    {
      "subsystem": "scheduler",
      "config": [
        {
          "method": "framework_set_scheduler",
          "params": {
            "name": "static"
          }
        }
      ]
    },
    ....
    },
    {
      "subsystem": "nbd",
      "config": []
    }
  ],
  "log_flags": {
    "bdev": true,
    "lvol": true,
    "nvme": true
  }

Ad.6
OPEN: since only enabled flags are saved to config.json file during save_config operation, should all flags be cleared first?
$ scripts/rpc.py load_config < config.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants