ExternalStorer: Cleanups and fix existence check

An ExternalStorer instance (directory representing a Redfish container)
is a directory with an index.json file in it, and optionally also
contains a middle, another subdirectory with another index.json file in
it. Now checking for all of these to be in existence first, before
declaring a duplicate creation error. If any of these are missing, the
creation request will now be allowed to go through, so partials are now
eligible for creation again (overwriting any previous content) instead
of falsely declaring an error preventing further creation. This
resolves the situation in which a directory could be in an invalid
state, somehow created but missing the index.json file within.

Added more debugging statements regarding files and directories. These
will only show up when debugging is enabled.

Refactored the writeJsonFile function similar to readJsonFile earlier,
cleaning it up. Now checks for maximum size before writing file, and
writes the entire file all at once.

Making sure all BMCWEB_ROUTE() paths have trailing slashes, so that
they work regardless of whether the user includes a trailing slash, or
not, in their query.

Ran through clang-format again, as some formatting errors had crept
into processor.hpp during previous patches.

Tested: Did a deep query by itself, and did a shallow query with expand
level 6, with the /run/bmcweb directory in each of these 3 states:
completely empty, containing files and directories, and containing only
empty directories (no files). All now give correct results.

/redfish/v1/Systems/system/Processors/cpu0/SubProcessors/core0/SubProcessors/thread0/ProcessorMetrics
/redfish/v1/Systems/system/Processors?\$expand=\*\(\$levels=6\)

Patch Tracking Bug: b/289119203
Upstream info / review: n/a
Upstream-Status: Inappropriate [b/230806664]
Justification: Overall the ExternalStorer feature already upstream rejected

Google-Bug-Id: 283698917
Change-Id: I5dd73675f7709a455885be24faa422739df69a48
Signed-off-by: Josh Lehan <krellan@google.com>
2 files changed
tree: 0c813b811db408facbc52862068abed5b5aec75b
  1. conf/
  2. dynamic-layers/
  3. meta-nuvoton-npcm8xx/
  4. recipes-bsp/
  5. recipes-connectivity/
  6. recipes-core/
  7. recipes-devtools/
  8. recipes-extended/
  9. recipes-google/
  10. recipes-kernel/
  11. recipes-phosphor/
  12. LICENSE
  13. README.md
README.md

meta-gbmc-staging

This repository contains additions to the openbmc/meta-google layer that are not yet ready for OpenBMC inclusion.

How to use this layer

  1. Clone openbmc/openbmc from GitHub.
  2. Clone this layer from GitHub into a subdirectory of openbmc.