#
e568fcad |
| 25-May-2023 |
Matt Spinler <spinler@us.ibm.com> |
Convert to lg2
Convert the remaining logging statements to lg2.
Change-Id: I45bc8ed76f9b71517a5a8119e89713278e31679d Signed-off-by: Matt Spinler <spinler@us.ibm.com>
|
#
fb1ad7cc |
| 24-May-2023 |
Matt Spinler <spinler@us.ibm.com> |
Convert version 1 files to version 2 on startup
When reading in persisted property values from their files, check the version number the file was saved in. If that version is less than the first ve
Convert version 1 files to version 2 on startup
When reading in persisted property values from their files, check the version number the file was saved in. If that version is less than the first version using name/value pairs, then rewrite the file using the latest version.
This is done so that it removes the possibility of the problem described in openbmc/phosphor-settingsd/#16 of occurring in the future, which is where if a new property is added it gets set to another property's value.
This also creates functions for the serializing and deserializing so the code to do it just needs to be in one place.
Note that if a version of code runs from when before NVP support was added, it can still read files saved with the new version so this change is backwards compatible.
Change-Id: Ib0be93de2151bc9435664179690b0eac2bb980ff Signed-off-by: Matt Spinler <spinler@us.ibm.com>
show more ...
|
#
c2f84c7b |
| 24-May-2023 |
Matt Spinler <spinler@us.ibm.com> |
Use named values when serializing
As described by openbmc/phosphor-settingsd#16, the code has a problem when a new D-Bus property is added to a settings object that has a modified property, meaning
Use named values when serializing
As described by openbmc/phosphor-settingsd#16, the code has a problem when a new D-Bus property is added to a settings object that has a modified property, meaning it has been serialized to file. This is because the file doesn't say which property the value is meant for - the fields are only named value0, value1, etc. So if the new property is alphabetically before the original property, the code will read the value0 value into the new property though it was meant to be for the original one.
To fix this, start using cereal's Name/Value Pair (NVP) feature, with the field names named after the property, like: "QuiesceOnHwError": true
This requires the cereal version to bump from 1 to 2. When saving, the code will always write using version 2 using NVPs. When loading it will check the version in the file and if it was 1 it will read it using the original non-NVP method, otherwise it will use the NVP method.
Example generated load and save functions:
``` template<class Archive> void save(Archive& a, const Impl& setting, [[maybe_unused]] const std::uint32_t version) { a(cereal::make_nvp("AutoReboot", setting.autoReboot())); }
template<class Archive> void load(Archive& a, Impl& setting, const std::uint32_t version) { decltype(setting.autoReboot()) AutoReboot{};
if (version < CLASS_VERSION_WITH_NVP) { a(AutoReboot); } else { try { a(CEREAL_NVP(AutoReboot)); } catch (const cereal::Exception& e) { std::cerr << "Could not restore property AutoReboot on /xyz/openbmc_project/control/host0/auto_reboot, " << "setting to default value.\n"; AutoReboot = true; } }
setting.autoReboot(AutoReboot); } ```
This does require that the property names be unique across all interfaces on that object path. So far that isn't an issue for anything I've seen, and there is a check in the code that will cause a compile failure if that occurs. If necessary, support could be added for this but it didn't seem necessary as that is fairly unlikely.
Now if a new property is added to an object path with existing serialized data, the code can see that that field isn't in the file and will just initialize that property to the default value given in the YAML.
If the version of code before this commit is applied to a system after this code has already been run, it is still able to read in the values even though they have real names instead of the valueN ones since other than the name they are still in the same order and format.
Resolves openbmc/phosphor-settingsd#16
Change-Id: Ia8f4712d7098dd530895b1db4e4d0a7f88f4b9dc Signed-off-by: Matt Spinler <spinler@us.ibm.com>
show more ...
|
#
ffdf8658 |
| 24-May-2023 |
Matt Spinler <spinler@us.ibm.com> |
Extract default property value calc into function
Make a function out of the python code that calculates the default value of a property so that it can be used in multiple places.
An upcoming commi
Extract default property value calc into function
Make a function out of the python code that calculates the default value of a property so that it can be used in multiple places.
An upcoming commit will also use it if it has problems restoring the property from its backing file.
Change-Id: I22b0f1130e7dce8c4b83e9111ad0d4895637404e Signed-off-by: Matt Spinler <spinler@us.ibm.com>
show more ...
|
#
4d28bcd3 |
| 24-Apr-2023 |
Jagpal Singh Gill <paligill@gmail.com> |
meson: Switch autoconf build to meson
Summary: - Add meson build flow. - Remove the options not being configured from yocto as configure args and add them as constants/define in settings_manager.h
meson: Switch autoconf build to meson
Summary: - Add meson build flow. - Remove the options not being configured from yocto as configure args and add them as constants/define in settings_manager.hpp
Tested: - autotools build passes. - meson build passes with "ninja -C build".
Change-Id: Iaa7704886cdcd5481a04bae77e02df2c6a53aee9 Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
show more ...
|
#
cfd49eb8 |
| 24-Apr-2023 |
Jagpal Singh Gill <paligill@gmail.com> |
meson: Address warnings for switching autoconf to meson
This commit addresses the compilation warnings when switching autoconf to meson.
Tested: Build passes with CIT and "ninja -C build".
Change-
meson: Address warnings for switching autoconf to meson
This commit addresses the compilation warnings when switching autoconf to meson.
Tested: Build passes with CIT and "ninja -C build".
Change-Id: Ieda04b856f4fd24de867c3eaee8b9c4a9b333aaf Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
show more ...
|
#
7c4181cf |
| 22-Jul-2022 |
Patrick Williams <patrick@stwcx.xyz> |
sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are
sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are for: * bus_t * exception_t * manager_t * match_t * message_t * object_t * slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I662faee19b7b289bc0a39665fc5ce9e19406f933
show more ...
|
#
f792a6d7 |
| 20-Jul-2022 |
Adriana Kobylak <anoo@us.ibm.com> |
Use relative path to append path
The path append behavior changed between std::experimental and std::filesystem, appending an absolute path (path with a leading slash) replaces the path instead of a
Use relative path to append path
The path append behavior changed between std::experimental and std::filesystem, appending an absolute path (path with a leading slash) replaces the path instead of appending to it, therefore need to use the relative path (path without the leading slash) when appending.
The issue was that directories were attempted to be created on "/xyz/.." instead of "SETTINGS_PERSIST_PATH/xyz/..", causing the settings manager to fail with: what(): filesystem error: cannot create directories: Read-only file system [/xyz/openbmc_project/control/host0]
Tested: Verified this error is not seeing when making redfish calls. Also verified the generated build/settings_manager.hpp file uses either the relative path or the xyz path doesn't have the leading slash: p /= path.relative_path(); path = fs::path(SETTINGS_PERSIST_PATH) / "xyz/openbmc_project/control/host0/TPMEnable";
Change-Id: Idd456baff5f39dc4464745daef9cb884481dca45 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
#
6306e5e4 |
| 16-Jun-2022 |
Patrick Williams <patrick@stwcx.xyz> |
switch experimental::fs to std::fs
std::filesystem was added to C++17 and is well supported now. Remove the older std::experimental::filesystem usage.
Signed-off-by: Patrick Williams <patrick@stwc
switch experimental::fs to std::fs
std::filesystem was added to C++17 and is well supported now. Remove the older std::experimental::filesystem usage.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I873667cf78efdf4f8ee2b63e8299783a5cba5ae4
show more ...
|
#
0f6903db |
| 15-Apr-2022 |
Patrick Williams <patrick@stwcx.xyz> |
fix cppcheck warnings
- Single parameter constructor was not marked 'explicit'. - Member variable was not initialized in the constructor init.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Ch
fix cppcheck warnings
- Single parameter constructor was not marked 'explicit'. - Member variable was not initialized in the constructor init.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I42c35e8300ca6670155840ddf47f61a7b93d5b42
show more ...
|
#
74c4f3b1 |
| 05-Apr-2022 |
Patrick Williams <patrick@stwcx.xyz> |
sdbusplus: object: don't use 'bool' argument constructor
`sdbusplus::server::object_t` has long had an enum-based parameter for signal action, but maintained a backwards compatible boolean mapping.
sdbusplus: object: don't use 'bool' argument constructor
`sdbusplus::server::object_t` has long had an enum-based parameter for signal action, but maintained a backwards compatible boolean mapping. It is time to remove this boolean to make it more observable which actions are being used in applications. Map all `true` occurrences to `action::defer_emit`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6d8796f14e3e25c9dbf7149e9affdb3d826d220c
show more ...
|
#
c0ce992f |
| 09-Mar-2022 |
Lei YU <yulei.sh@bytedance.com> |
mako: Support interfaces without property
If a settings interface contains no property, the code get compiles failure that the cereal does not know how to de-serialize the object.
It turns out that
mako: Support interfaces without property
If a settings interface contains no property, the code get compiles failure that the cereal does not know how to de-serialize the object.
It turns out that if an interface has no property, it does not need to serialize/de-serialize the properties at all.
Add a check in mako to skip the above for interfaces without properties, and then the code compiles fine.
Tested: Verify we could add an interface without property to a DBus object, e.g. xyz.openbmc_project.Inventory.Item.Bmc
Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: I68a9e689c2e2a9da65c8b090ac925baebd27733a
show more ...
|
#
b6fa9bb1 |
| 06-Oct-2021 |
Patrick Williams <patrick@stwcx.xyz> |
catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ic4d935b6d33e49dfb5606239b20db10514a95c1a
|
#
23552631 |
| 14-May-2021 |
Matt Spinler <spinler@us.ibm.com> |
Use full name for enum default values
In the case where there were multiple interfaces specified in the settings YAML that had the same last segment, the code generator would create unbuildable code
Use full name for enum default values
In the case where there were multiple interfaces specified in the settings YAML that had the same last segment, the code generator would create unbuildable code when those classes both specified default values for properties that were enums. This happened because there was a 'using namespace ...' line for every class at global scope, so when the default value for the enum was specified, the compiler wouldn't know which class to use.
For example, if there were two interfaces that used a class called Mode that each tried to set default values like: * Mode::bootMode::Safe * Mode::powerMode::Static then the generated code wouldn't compile.
Fix this by removing the global using namespace lines and add the full prefix to the enum default values when they are set in the initSetting lambdas.
Note that the code still won't compile when classes of the same name are used on the same object path. This is because of the 'using IfaceX' lines in the scope of each Impl class. Fixing that is outside of the scope of this commit, which was done to fix a real world use.
Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I25ac36a58febe4449a29af845e5faba12bb0e63f
show more ...
|
#
bcf95781 |
| 05-May-2021 |
Patrick Williams <patrick@stwcx.xyz> |
Use sdbus++ python library for name conversion
This code attempts to come up with sdbus++ property names by doing its own string manipulation. That conversion is likely wrong in the future. Instea
Use sdbus++ python library for name conversion
This code attempts to come up with sdbus++ property names by doing its own string manipulation. That conversion is likely wrong in the future. Instead, import the sdbus++ python code directly and call the appropriate function from it.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I767ff842c37b183f925d7add87e96bb850092810
show more ...
|
#
2b7152fb |
| 02-Apr-2020 |
Patrick Williams <patrick@stwcx.xyz> |
python2 to python3 conversion
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1716d022bb67b1301f771c575842175372b04bef
|
#
74e3be7d |
| 15-Feb-2019 |
James Feist <james.feist@linux.intel.com> |
Add array support for defauts
Based on: https://uscilab.github.io/cereal/stl_support.html
To support vector we need to #include the cereal vector header.
Closes #12
Tested-by: Was able to add an
Add array support for defauts
Based on: https://uscilab.github.io/cereal/stl_support.html
To support vector we need to #include the cereal vector header.
Closes #12
Tested-by: Was able to add an array default using C++ vector syntax
Change-Id: I3b00c372b668ddcda69a56ede8edbc51ab2693f5 Signed-off-by: James Feist <james.feist@linux.intel.com>
show more ...
|
#
a29a3eb7 |
| 29-Sep-2017 |
Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> |
Enable Cereal class versioning
Fixes openbmc/openbmc#2320
Change-Id: Iac2649cd5f4794e2049cbdd4eb2df874d26beaaa Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
|
#
4636e07c |
| 24-Sep-2017 |
Tom Joseph <tomjoseph@in.ibm.com> |
cereal: Fix empty file scenario
Cereal throws execption when deserialising empty file, add code to handle empty exception and default the setting to the default value.
Change-Id: I466f44d07c902a273
cereal: Fix empty file scenario
Cereal throws execption when deserialising empty file, add code to handle empty exception and default the setting to the default value.
Change-Id: I466f44d07c902a27344a483b5b574e0507baa2f4 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
show more ...
|
#
db838626 |
| 27-Aug-2017 |
Deepak Kodihalli <dkodihal@in.ibm.com> |
settings objects: support multiple interfaces
A settings object had the limitation that it could implement a single, corresponding settings interface. This was found to be too restrictive because th
settings objects: support multiple interfaces
A settings object had the limitation that it could implement a single, corresponding settings interface. This was found to be too restrictive because there are use-cases (such as in the boot settings area) that would simplify describing settings with objects that can implement more than one interface.
This commit adds the ability for settings objects to implement multiple interfaces. The settings config yaml now should contain a list of interface(s) under each settings object.
Change-Id: I90dec9e766e1afd1b0c8616e491832714bbd069d Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
show more ...
|
#
242bc77c |
| 04-Aug-2017 |
Deepak Kodihalli <dkodihal@in.ibm.com> |
Fix settingsd core dump/persistence fail
The problem was seen only with network settings objects, because they had paths as following:
A setting d-bus object /foo/bar/baz is persisted in the filesy
Fix settingsd core dump/persistence fail
The problem was seen only with network settings objects, because they had paths as following:
A setting d-bus object /foo/bar/baz is persisted in the filesystem with the same path. This eases re-construction of settings objects when we restore from the filesystem. This can be a problem though when you have two objects such as - /foo/bar and /foo/bar/baz. This is because 'bar' will be treated a file in the first case, and a subdir in the second. This was causing an exception to be thrown by Cereal, because it found a dir where it was expecting a file. This also caused us to not persist certain network setting objects because we couldn't create subdirs as there were files of the same name.
To solve this, suffix files with a trailing __. The __ is a safe character sequence to use, because we won't have d-bus object paths ending with this. With this the objects would be persisted as - /foo/bar__ and /foo/bar/baz__.
Change-Id: I76b6a0423db1f2f51bd1b6ab2ea5f9cafd1a36d9 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
show more ...
|
#
61d3b6a1 |
| 25-Jul-2017 |
Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com> |
Validate changes to default settings.
Resolves openbmc/openbmc#1771
Change-Id: I763e811e88710425131ec504ff933e3c41c458e6 Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
|
#
c15990a3 |
| 06-Jul-2017 |
Andrew Geissler <andrewg@us.ibm.com> |
Fix to allow multiple properties per interface
The path variable needs to be shared among all properties in an interface
Resolves openbmc/openbmc#1910
Change-Id: I73f85ef9fd36eb8110f3f352fb968f062
Fix to allow multiple properties per interface
The path variable needs to be shared among all properties in an interface
Resolves openbmc/openbmc#1910
Change-Id: I73f85ef9fd36eb8110f3f352fb968f062585c3d9 Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
show more ...
|
#
7a6f2526 |
| 23-Jun-2017 |
Deepak Kodihalli <dkodihal@in.ibm.com> |
Persist changes to settings
Persist changes made to settings, if any, such that those changes can be restored upon a reboot.
Use Cereal for serialization of the settings' properties. Since the sett
Persist changes to settings
Persist changes made to settings, if any, such that those changes can be restored upon a reboot.
Use Cereal for serialization of the settings' properties. Since the settings code is generated based on a system specific settings policy, generate the serialization code as well such that only relevant settings are serialized.
Resolves openbmc/openbmc#1764.
Change-Id: Id8bd84a9455cf4348b22f255d038b050d004eb7c Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
show more ...
|
#
89872291 |
| 31-May-2017 |
Deepak Kodihalli <dkodihal@in.ibm.com> |
Fix bug in mako template
Fix a bug in the settings manager mako template, which was causing some of the settings manager code (header includes and using namespaces) to not be generated appropriately
Fix bug in mako template
Fix a bug in the settings manager mako template, which was causing some of the settings manager code (header includes and using namespaces) to not be generated appropriately.
Change-Id: Ie55fb2f0d637a842dd59148fefe4e3ed6aa75808 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
show more ...
|