-
Notifications
You must be signed in to change notification settings - Fork 21
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
worker::CollectionStatus for each inventory FRU #547
base: 1110
Are you sure you want to change the base?
worker::CollectionStatus for each inventory FRU #547
Conversation
a39536e
to
24cdfd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is assigned when we hit prime inventory path on
VPD collection failure due to VPD exceptions and also when
single FRU VPD collection fails.
This is not correct.
vpd-manager/src/worker.cpp
Outdated
logging::logMessage("Priming of inventory failed for FRU " + | ||
i_vpdFilePath); | ||
}*/ | ||
if (!primeInventory(i_vpdFilePath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this has been un-commented? This breaks the current flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted back
vpd-manager/src/worker.cpp
Outdated
if (std::filesystem::exists(i_vpdFilePath)) | ||
{ | ||
l_propertyValueMap["Present"] = true; | ||
|
||
// FRU exist and if we hit prime inventory path | ||
processFRUCollectionStatus(l_interfaces, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree with this.
If execution is here, does not mean that the collection has failed.
vpd-manager/src/worker.cpp
Outdated
@@ -1138,6 +1149,10 @@ void Worker::populateDbus(const types::VPDMapVariant& parsedVpdMap, | |||
processFunctionalProperty(inventoryPath, interfaces); | |||
processEnabledProperty(inventoryPath, interfaces); | |||
|
|||
// FRU VPD collection is successful | |||
processFRUCollectionStatus(interfaces, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we set the property to "InProgress" in worker class during collection of all the FRUs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InProgress will not be displayed during collection of all FRUs as its an intermediate state between success/failure. InProgress was introduced for collecting single FRU only.
vpd-manager/src/worker.cpp
Outdated
@@ -1138,6 +1149,10 @@ void Worker::populateDbus(const types::VPDMapVariant& parsedVpdMap, | |||
processFunctionalProperty(inventoryPath, interfaces); | |||
processEnabledProperty(inventoryPath, interfaces); | |||
|
|||
// FRU VPD collection is successful | |||
processFRUCollectionStatus(interfaces, | |||
constants::vpdCollectionSuccess); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we need to see where can we set it as failure.
vpd-manager/src/manager.cpp
Outdated
@@ -447,6 +448,16 @@ void Manager::collectSingleFruVpd( | |||
} | |||
} | |||
|
|||
// Set CollectionStatus as InProgress before performing single FRU VPD | |||
// collection | |||
if (!dbusUtility::setFruVpdCollectionStatus( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see a need to persist in-progress status using PIM. It is an intermediate state, no point persisting that data.
Notify is an expensive call compared to set property. If there is no requirement to persist the data, should we use set-property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
vpd-manager/src/worker.cpp
Outdated
{ | ||
types::PropertyMap l_fruCollectionProperty = { | ||
{"CollectionStatus", i_fruCollectionStatus}}; | ||
vpdSpecificUtility::insertOrMerge(io_interfaces, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have "insertOrMerge" API in utility. Why this API is required? Just a value is being initialized in the API before "insertOrMerge" is called which could have been directly passed to the API.
Looks more like a wrapper over utility methods with no requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this wrapper.
Will address all the comments. currently keeping it as draft to avoid further reviews. |
24cdfd2
to
274baa5
Compare
274baa5
to
4a152f1
Compare
vpd-manager/src/worker.cpp
Outdated
@@ -1103,6 +1111,7 @@ void Worker::populateDbus(const types::VPDMapVariant& parsedVpdMap, | |||
{ | |||
const auto& inventoryPath = aFru["inventoryPath"]; | |||
sdbusplus::message::object_path fruObjectPath(inventoryPath); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove it
vpd-manager/src/worker.cpp
Outdated
@@ -1469,14 +1506,32 @@ std::tuple<bool, std::string> | |||
logging::logMessage(ex.what()); | |||
} | |||
|
|||
// update CollectionStatus as Failure | |||
types::ObjectMap l_objectMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to a utility method so that manager can reuse it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
vpd-manager/src/worker.cpp
Outdated
@@ -1375,7 +1392,6 @@ types::VPDMapVariant Worker::parseVpdFile(const std::string& i_vpdFilePath) | |||
|
|||
std::shared_ptr<Parser> vpdParser = | |||
std::make_shared<Parser>(i_vpdFilePath, m_parsedJson); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove it
vpd-manager/src/worker.cpp
Outdated
// D-bus set-property call is good enough to update the status. | ||
try | ||
{ | ||
const std::string& l_collStatusProp = "CollectionStatus"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a variable is needed here? Its a one time use variable. Can be used in place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbusUtility::writeDbusProperty() expects ref of the property variable. so I need a memory address to be allocated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ok, it anyways accepts constant reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
vpd-manager/src/worker.cpp
Outdated
@@ -1421,6 +1437,9 @@ types::VPDMapVariant Worker::parseVpdFile(const std::string& i_vpdFilePath) | |||
std::tuple<bool, std::string> | |||
Worker::parseAndPublishVPD(const std::string& i_vpdFilePath) | |||
{ | |||
const std::string& l_inventoryPath = | |||
jsonUtility::getInventoryObjPathFromJson(m_parsedJson, i_vpdFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API can throw exceptions and this can go uncaught. This will break the threading for all other collections.
Let the variable be at outer scope, bring the API call to "getInventoryObjPathFromJson" under try/catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
8040efd
to
6956b31
Compare
vpd-manager/src/worker.cpp
Outdated
// D-bus set-property call is good enough to update the status. | ||
try | ||
{ | ||
const std::string& l_collStatusProp = "CollectionStatus"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ok, it anyways accepts constant reference.
* | ||
* @return true if update succeeds, false otherwise. | ||
*/ | ||
inline bool notifyFRUCollectionStatus(const std::string& i_inventoryPath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API just updates a property on DBus.
Should this be under dbusUtility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved it to dbusUtility
This commit implements CollectionStatus D-bus property under com.ibm.VPD.Collection D-bus interface for each inventory D-bus object path which represents a FRU. The property tells the current status of VPD collection for a given FRU's D-bus object path. The property takes the below enum values: >>>com.ibm.VPD.Collection.Status.Success ------------------------------------- This value is assigned when VPD collection is successful. >>>com.ibm.VPD.Collection.Status.Failure ------------------------------------- VPD collection failure due to VPD exceptions. >>>com.ibm.VPD.Collection.Status.InProgress ---------------------------------------- This value is assigned when VPD collection starts for the given FRU. >>>com.ibm.VPD.Collection.Status.NotStarted ---------------------------------------- This default value is assigned when we hit prime inventory path. Test: 1. VPD parsing failed for /sys/bus/i2c/drivers/at24/0-0051/eeprom due to error: Unable to determine VPD format busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.NotStarted" busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.InProgress" busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Failure" 2. FRU not found busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot0/pcie_card0 com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.NotStarted" busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot0/pcie_card0 com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.InProgress" busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot0/pcie_card0 com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Failure" 3. Successful collection of VPD busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Success" Change-Id: Ia5010a181f720454bb51538d6fcf308daf6b75ca Signed-off-by: Priyanga Ramasamy <[email protected]>
6956b31
to
5ff3795
Compare
This commit implements CollectionStatus D-bus property under com.ibm.VPD.Collection D-bus interface for each inventory D-bus object path which represents a FRU.
The property tells the current status of VPD collection for a given FRU's D-bus object path.
The property takes the below enum values:
This value is assigned when we hit prime inventory path on VPD collection failure due to VPD exceptions and also when single FRU VPD collection fails.
This value is assigned before single FRU VPD collection starts for the given FRU.
This value is assigned when we hit prime inventory path when the VPD collection is not started as the FRU itself is not present.
Test:
busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
com.ibm.VPD.Collection interface - - -
.CollectionStatus property s "com.ibm.VPD.Collection.Status.Success" emits-change writable
busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
com.ibm.VPD.Collection interface - - -
.CollectionStatus property s "com.ibm.VPD.Collection.Status.NotSta... emits-change writable
busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
com.ibm.VPD.Collection interface - - -
.CollectionStatus property s "com.ibm.VPD.Collection.Status.Failure" emits-change writable
Previous state is Failure && perform singleFRUVPDCollect busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Failure"
root@testhostname2:~busctl call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager CollectFRUVPD o /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson root@testhostname2: busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Failure"
Previous state is Success && perform singleFRUVPDCollect
busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/lcd_op_panel_hill com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Success"
root@testhostname2:busctl call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager CollectFRUVPD o /xyz/openbmc_project/inventory/system/chassis/motherboard/lcd_op_panel_hill
root@testhostname2:busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/lcd_op_panel_hill com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.Success"
root@testhostname2:~ busctl call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager CollectFRUVPD o /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 root@testhostname2:~ busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 com.ibm.VPD.Collection CollectionStatus s "com.ibm.VPD.Collection.Status.NotStarted"
Change-Id: Ia5010a181f720454bb51538d6fcf308daf6b75ca