metal3-io / ironic-image

Container image to run OpenStack Ironic as part of Metal³
Apache License 2.0
56 stars 116 forks source link

🐛runlogwatch.sh fix CPU usage and partial files #540

Closed steveb closed 4 days ago

steveb commented 2 weeks ago

Currently runlogwatch.sh runs in a tight loop when there are no files, consuming CPU. Also there have been reports of truncated logs being outputted which would be explained by ironic not writing these files atomically [1]. This change improves this script by:

metal3-io-bot commented 2 weeks ago

Hi @steveb. Thanks for your PR.

I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
tuminoid commented 2 weeks ago

/ok-to-test

tuminoid commented 2 weeks ago

/test metal3-centos-e2e-integration-test-main metal3-ubuntu-e2e-integration-test-main

tuminoid commented 2 weeks ago
[2024-08-27T07:15:52.536Z] dnf install -y dnsmasq dosfstools httpd httpd-tools inotify-tools ipcalc ipmitool iproute mod_ssl procps python3-jinja2 qemu-img sqlite syslinux-nonlinux util-linux xorriso
[2024-08-27T07:15:52.914Z] Last metadata expiration check: 0:02:06 ago on Tue Aug 27 07:13:46 2024.
[2024-08-27T07:15:52.914Z] No match for argument: inotify-tools
[2024-08-27T07:15:52.914Z] Error: Unable to find a match: inotify-tools

It doesn't seem to be able to install the package you added.

elfosardo commented 2 weeks ago

/hold please do not add inotify-tools to the list of packages, it comes from the epel repo (disabled by default by choice) and it's already installed here https://github.com/metal3-io/ironic-image/blob/main/prepare-image.sh#L81

steveb commented 2 weeks ago

Actually I'm going to go back to a polling approach, but fix the cpu churn issue, and also add some mitigation for partially written tar files

tuminoid commented 2 weeks ago

/test metal3-centos-e2e-integration-test-main metal3-ubuntu-e2e-integration-test-main

tuminoid commented 2 weeks ago

/retest

dtantsur commented 2 weeks ago

/approve /hold cancel

metal3-io-bot commented 2 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtantsur

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/metal3-io/ironic-image/blob/main/OWNERS)~~ [dtantsur] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
blallau commented 1 week ago

Hi Steve, I was working on the same issue without seeing that you already work on it. In order to be sure that archive file is fully ready, I made use of the inotify close_write event. You can take a look at https://github.com/metal3-io/ironic-image/pull/548 regards,

steveb commented 1 week ago

https://github.com/metal3-io/ironic-image/pull/548 looks nice and clean. Seems like a good alternative to this change

tuminoid commented 1 week ago

/hold I'm holding this as concensus seems to be to use inotifywait anyways?

steveb commented 4 days ago

Closing my PR to make it clear which approach I think we should use :)