virsh_cmd: Change boot time fetching function - #6905
Conversation
The --since arg for uptime is not part of the basic package shipped with SLES releases. This caused the test to fail silently. This change uses /proc/stat to get boot time which will be present in every linux distro, thus making the test distro-independent
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughIn Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Before: 08:22:57 INFO : Running: /usr/local/bin/avocado run --vt-type libvirt --vt-config /home/stuff/tests/data/avocado-vt/backends/libvirt/cfg/backuprestore.cfg --force-job-id 4b0f7b7a93c2a59a2d5c34c56c9d17bbef45595a --job-results-dir /home/stuff/tests/results --vt-only-filter "virtio_scsi virtio_net qcow2 SLES.16.1.ppc64le" RESULTS : PASS 0 | ERROR 0 | FAIL 1 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 After: |
|
The code itself is ok ad make sense. even improving functionality as the returned comparision is beteween timestamp not the datetime string but when introducing new code it will be better to refactor this 7y old approach. it would be possible to remove the get_boot_time and reuse vm.uptime() instead. (and probably would be good to rename in such case variables to [second | first] _uptime |
|
Hi @hholoubk I'm not sure if getting the uptime in seconds would be useful here, since we need the time at which the vm booted, and not the uptime, and then we compare both and check if the time at which the vm boots has actually been updated which then represents a reboot. Perhaps there are existing utilities that save the time at which the vm boots, in which case you can point me to them, and if not, I can implement the same in virttest. |
harihare
left a comment
There was a problem hiding this comment.
LGTM, As there is no generic record of boot time. The code seems to be generic for all distros.
The --since arg for uptime is not part of the basic package shipped with SLES releases. This caused the test to fail silently. This change uses /proc/stat to get boot time which will be present in every linux distro, thus making the test distro-independent
Summary by CodeRabbit