【问题标题】:Using busctl to create a log entry使用 busctl 创建日志条目
【发布时间】:2020-09-22 20:53:13
【问题描述】:

在 openbmc 上工作并尝试通过 busctl 创建一个日志条目。我看到 Create 调用需要 ssa{ss}:

# busctl introspect xyz.openbmc_project.Logging
/xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create      
interface -              -             - .Create                      
method    ssa{ss}        -             -

但是,我尝试拨打电话失败了:

# busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} 1 "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" "ARG1" "ARG2"
Failed to parse 'xyz.openbmc_project.Logging.Entry.Level.Error' number of array entries: Invalid argument

猜测问题与参数的格式有关。有什么想法吗?

【问题讨论】:

    标签: dbus openbmc


    【解决方案1】:

    我没有 openbmc,因此无法对此进行测试,但您的陈述可能有一些问题。

    ssa{ss} 后面的数字指的是数组的长度,所以我认为是放错了地方。我希望它在两个字符串之后(在您的示例中为"This is a Test""xyz.openbmc_project.Logging.Entry.Level.Error"

    例如

    busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" 1 "ARG1" "ARG2"
    

    我在https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Logging/Create.interface.yaml#L7找到了我认为的文档

    如果 "ARG1""ARG2""KEY1""VALUE1",您的示例可能会更清楚。我认为如果您有两个键/值对,以下情况将是正确的:

    busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" 2 "KEY1" "VALUE1" "KEY2" "VALUE2"
    

    在使用 busctl 时,我总是需要反复试验才能正确解决这个问题。在另一个运行 dbus-monitor 的终端中有时可能有助于调试。

    【讨论】:

    • 谢谢,ukBaz。您提供的示例效果很好。非常感激!感谢您发布该 YAML 链接。我很早就发现了。只是不知道如何应用它。我同意,我应该为 args 使用名称/值对。这将有助于清晰。
    猜你喜欢
    • 2015-09-05
    • 2017-12-02
    • 2015-10-03
    • 1970-01-01
    • 2015-07-22
    • 2013-11-26
    • 2014-12-21
    • 1970-01-01
    • 2019-12-06
    相关资源
    最近更新 更多