2019-04-01 21-32-49 |
Lei YU <mine260309@gmail.com> |
Refactor: only untar once
The code in processImage() execute "tar xf" twice, the first time to
extract the MANIFEST, and the second time to extract the whole tarball.
On a tarball without compression, it's OK. But if the tarball is
compressed, it takes much longer time to de-compress the tarball for
twice.
This commit changes the behavior by:
1. Untar the whole tarball into a temp dir;
2. Parse the manifest as before;
3. If something is wrong, remove the temp dir as before;
4. If it's valid, rename the temp dir to the valid image dir.
It also fixes an issue that it uses const_cast in mkdtemp, which is
undefined behavior because the returned const char* shall be read-only,
writing this memory could cause undefined behavior.
Partially resovles openbmc/bmcweb#60
Tested: Verify the image upload works well, and it takes much less time
on a gzip compressed tarball.
Change-Id: I0af81acbd948e9c54d5d168c9f72e8ebbf8daebe
Signed-off-by: Lei YU <mine260309@gmail.com> |
2019-03-28 14-41-54 |
Patrick Venture <venture@google.com> |
build: install into bin instead of sbin
Installs into bin instead of sbin per guidelines.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I77f4082b9d55da775b0af59328d504f9ac9cd163 |
2019-02-13 17-26-00 |
Patrick Venture <venture@google.com> |
build: pkg anti-pattern: use defaults
Use the defaults in the pkg check where the default error message is
sufficient to identify which package is missing.
Change-Id: I505ebc57cc86595df294d6e9cf7e57513ffc3aa5
Signed-off-by: Patrick Venture <venture@google.com> |
2018-12-11 15-07-12 |
Adriana Kobylak <anoo@us.ibm.com> |
item_updater: Call remove association on delete
The remove association function was supposed to be called on delete but
was never implemented so if the associations are queried but the version
has been deleted, that'd be false information, so call to remove the
associations on delete, also rename it to delete all associations,
because the delete function already determined if the requested version
is functional.
Tested: Verified the associations for the requested version are deleted
with a DeleteAll and Delete call.
Change-Id: Ia4fde01c9500b648660bc9a4c355d44a35af7cc5
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |
2018-12-11 08-21-31 |
Adriana Kobylak <anoo@us.ibm.com> |
Remove deprecated is_method_error code
The is_method_error() function is no longer needed, instead a
try-catch block should be used instead.
Reference:
https://lists.ozlabs.org/pipermail/openbmc/2018-October/013696.html,
Change-Id: I1919ea33fc18be2b8afd51fb1f85ddef15041e7c
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |
2018-12-03 16-09-02 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
sync/watch: reduce memory usage
Currently we get a different inotify handle for every file in the
synclist, and register all of them with sd_event. A single fd will
work and saves memory in libsystemd and the kernel, so do that instead.
This in turn allows the fileMap structure to be simplified down to a
basic map of watch descriptor / filename pairs.
Remove redundant calls to both close and inotify_rm_watch - let the
kernel do the work for us. From the inotify man page:
When all file descriptors referring to an inotify instance have been
closed (using close(2)), the underlying object and its resources are
freed for reuse by the kernel; all associated watches are auto‐
matically freed.
Change-Id: Ia63cb667cdf41c171276a0351d95347a54578f2f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |
2018-11-26 11-29-58 |
Adriana Kobylak <anoo@us.ibm.com> |
sync_watch: Handle IN_IGNORED
When the hostname is updated via systemd, it modifies the /etc/hostname
file in a way that triggers a IN_CLOSE_NOWRITE and IN_IGNORED signal.
* When IN_IGNORED is received, re-subscribe the file, since it means
that the inotify watch was removed.
* A subsequent IN_CLOSE_WRITE signal is received after the re-subscribe
which takes care of syncing the hostname file.
Tested: The hostname was synced when changed multiple times in a row
using the REST API.
Change-Id: I30abfcdc8b33f77adc6349d345cc957b07898018
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |
2018-10-17 15-13-57 |
Adriana Kobylak <anoo@us.ibm.com> |
Rename Version::Errors to Image::Errors
The Version interface is a public interface, and errors are being
added to it:
https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-dbus-interfaces/+/13836/
This conflicts with the internal Version errors, so rename the
internal one to an Image namespace since that's not a public
interface and make more sense since the errors deal with failures
during image file extraction.
Tested:
Uploaded an invalid tar file (u-boot.bin) and the new Image::Error
was created:
"/xyz/openbmc_project/logging/entry/2": {
"AdditionalData": [
"PATH=/tmp/images/u-boot.bin",
"_PID=1348"
],
"Description": "An internal BMC error occurred",
"EventID": "None",
"Id": 2,
"Message": "xyz.openbmc_project.Software.Image.Error.UnTarFailure",
Change-Id: I6f6c84e2ea782c8ebc952bba4d5cee6be232f08f
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |
2018-09-24 13-21-35 |
Adriana Kobylak <anoo@us.ibm.com> |
Switch to C++17
Change-Id: I18db16de1fa603e366a25f564610c63076108eb9
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |
2018-09-19 11-34-29 |
Adriana Kobylak <anoo@us.ibm.com> |
Fix being able to activate a Failed version
When an activation fails, the version is marked as Failed.
On a subsequent activation, the bmc updater core dumps due
to 2 issues during the freeSpace call:
1. The Failed activation doesn't have a Priority object, so
default its priority to a large value.
2. If the subsequent activation is to the same version id,
then freeSpace should not do an erase on it, because that
removes the activations object that it's trying to activate.
Tested: Verified that doing an activation after a version
was marked as Failed did not core dump the updater anymore.
Change-Id: Iba36497b53738e00283cfec55e8c666f943cd5d5
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> |