Skip to content
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

tpm_device.py: clean audit before vm start #5914

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

yanqzhan
Copy link
Contributor

@yanqzhan yanqzhan commented Sep 24, 2024

Cleaning audit logs should be before vm start, and need clean all
audit.log*(.1, .2, etc) files. Also move it later to wait more time.
And replace ausearch cmd since it can not capture well sometimes,
audit.log can reflect actual info instead.

@yanqzhan
Copy link
Contributor Author

(1/1) type_specific.io-github-autotest-libvirt.virtual_devices.tpm_device.normal_test.tpm-crb_model.external.start_vm: PASS (30.38 s)

@yanqzhan yanqzhan marked this pull request as draft September 24, 2024 07:32
@yanqzhan yanqzhan force-pushed the tpm_clean_audit branch 5 times, most recently from ccada3c to 5a430a3 Compare September 26, 2024 06:46
Cleaning audit logs should be before vm start, and need clean all
audit.log*(.1, .2, etc) files. Also move it later to wait more time.
And replace ausearch cmd since it can not capture well sometimes,
audit.log can reflect actual info instead.

Signed-off-by: Yanqiu Zhang <[email protected]>
@yanqzhan
Copy link
Contributor Author

yanqzhan commented Sep 26, 2024

Before:(only reproduces online in jenkins)
Command 'ausearch -m VIRT_RESOURCE| grep 'tpm-external'' failed.\nstdout: b''\nstderr: b'<no matches>\n'\nadditional_info: None (12.60 s)
After:
Check fix history in $jenkins/job/libvirt-RHEL-9.4-runtest-x86_64-function-tpm_emulator/44/testReport/rhel/virtual_devices/tpm_device_normal_test_tpm_crb_model_external_start_vm/history/

2024-09-26 08:51:21,525 avocado.utils.process process          L0657 INFO | Running 'truncate -s 0  /var/log/audit/audit.log*'
2024-09-26 08:51:23,063 avocado.utils.process process          L0714 INFO | Command 'truncate -s 0  /var/log/audit/audit.log*' finished with 0 after 1.536528244s
2024-09-26 08:51:23,063 avocado.utils.process process          L0657 INFO | Running 'cat /var/log/audit/audit.log| grep 'tpm-external''
2024-09-26 08:51:23,066 avocado.utils.process process          L0714 INFO | Command 'cat /var/log/audit/audit.log| grep 'tpm-external'' finished with 1 after 0.001594883s
2024-09-26 08:51:23,078 avocado.virttest.libvirt_vm libvirt_vm       L2653 DEBUG| Starting vm 'avocado-vt-vm1'
---------
2024-09-26 08:51:23,613 avocado.utils.process process          L0657 INFO | Running 'cat /var/log/audit/audit.log| grep 'tpm-external''
2024-09-26 08:51:23,616 avocado.utils.process process          L0473 DEBUG| [stdout] type=VIRT_RESOURCE msg=audit(1727355083.438:13226): pid=137870 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=tpm-external reason=start vm="avocado-vt-vm1" uuid=0fe66337-90de-47ab-b265-64fa0196f14c device="/var/tmp/guest-swtpm.sock" exe="/usr/sbin/virtqemud" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset"

@yanqzhan yanqzhan marked this pull request as ready for review September 26, 2024 13:41
@yanqzhan
Copy link
Contributor Author

@chunfuwen This is minor fix for jira LIBVIRTAT-19404. Please help review. Thanks.

Copy link
Contributor

@chunfuwen chunfuwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chunfuwen chunfuwen merged commit 7eb1188 into autotest:master Oct 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants