Skip to content

Change the specified fsfreeze mountpoint to /boot#6824

Open
iccaszhulili wants to merge 1 commit intoautotest:masterfrom
iccaszhulili:fsfreeze
Open

Change the specified fsfreeze mountpoint to /boot#6824
iccaszhulili wants to merge 1 commit intoautotest:masterfrom
iccaszhulili:fsfreeze

Conversation

@iccaszhulili
Copy link
Contributor

@iccaszhulili iccaszhulili commented Mar 11, 2026

Under image mode, there is no mountpoint of "/",
so change the specified fsfreeze mountpoint to /boot.

Also change the function in test_thaw for listing file, The file can not be created if fsfreeze is sucessfully, and is not created before fsthaw in the code. It does not make sense to fail the case if the file is not exsiting after fsthaw.

Summary by CodeRabbit

  • Tests
    • Updated domfsfreeze tests to target /boot instead of / for mountpoint-related scenarios.
    • Improved thaw-path robustness with status-based checks and retry behavior for missing files.
    • Switched test logging to standard logging and enabled debug mode for better diagnostics during test runs.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d6b0e78-3551-4e75-860c-4de026e42a9c

📥 Commits

Reviewing files that changed from the base of the PR and between 4762c66 and b1b3a7f.

📒 Files selected for processing (4)
  • libvirt/tests/cfg/virsh_cmd/domain/virsh_domfsfreeze.cfg
  • libvirt/tests/cfg/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.cfg
  • libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py
  • libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • libvirt/tests/cfg/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.cfg
  • libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py
  • libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py

Walkthrough

Configuration for domfsfreeze tests updated to use "/boot" instead of "/" for mountpoint values. The inner function check_freeze(session) was changed to check_freeze(session, options) and now derives a target path from the options string to construct a dynamic touch command. Tests in virsh_domfsfreeze_domfsthaw.py replace test.log.info with logging.info, use session.cmd_status for a file-existence check during thaw, add debug=True to domfsfreeze calls, and change the default mountpoint from "/" to "/boot". No other control flow or public API signatures were introduced.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: updating the fsfreeze mountpoint from '/' to '/boot' across multiple test files and test logic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py (1)

57-70: ⚠️ Potential issue | 🟡 Minor

Potential UnboundLocalError for output and typo fix needed.

Two issues in this function:

  1. Line 62: Typo - "exsiting" should be "existing"
  2. Lines 66-70: If status is 0 (file exists), the code skips the if block where output is assigned, but the except handler at line 69 still references output. If cmd_status raises ShellTimeoutError, output will be undefined.
🐛 Proposed fix
     def check_thaw(session, mountpoints, file_name):
         ...
         logging.info("TEST_STEP: Check file system thaw.")
         for mntpoint in mountpoints:
+            output = ""
             try:
                 status = session.cmd_status("ls %s/%s" % (mntpoint, file_name))
                 if status:
-                    logging.info("file %s/%s is not exsiting after thaw"
+                    logging.info("file %s/%s is not existing after thaw"
                                  % (mntpoint, file_name))
                     output = session.cmd_output("touch %s/%s" % (mntpoint, file_name),
                                                 timeout=10)
             except aexpect.ShellTimeoutError:
                 test.fail(
                     "Failed to thaw file system %s. Touch file timeout:\n%s"
                     % (mntpoint, output)
                 )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py` around
lines 57 - 70, Initialize a local variable output before the try block and
correct the typo "exsiting"→"existing"; specifically, in the loop over
mountpoints where session.cmd_status and session.cmd_output are used
(referencing session.cmd_status, session.cmd_output, aexpect.ShellTimeoutError,
mountpoints, file_name, and test.fail), set output = "" (or None) just before
try so the except handler can safely reference it, and change the logging string
from "not exsiting" to "not existing".
🧹 Nitpick comments (1)
libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py (1)

20-26: Update docstring to document the new options parameter.

The docstring should document the options parameter that was added to the function signature.

📝 Proposed docstring update
     def check_freeze(session, options):
         """
         Check whether file system has been frozen by touch a test file
         and see if command will hang.

         :param session: Guest session to be tested.
+        :param options: The domfsfreeze options string to extract the mountpoint.
         """
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py` around lines 20 -
26, The docstring for the function check_freeze is missing documentation for the
newly added options parameter; update the check_freeze docstring to include a
short description of options (its type and purpose) alongside the existing
:param session: entry—e.g., add a line like ":param options: <type> and
description of what options controls (e.g., timeout, file path, flags)"; keep
wording concise and consistent with other docstrings in the file and reference
the function name check_freeze and the parameter options when adding the new
docstring line.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py`:
- Line 2: The file currently imports the logging module and calls
logging.info(); change these to use the project convention by removing the
import of logging and replacing all calls to logging.info(...) with
test.log.info(...). Ensure any other logging.* calls in this file (e.g.,
logging.debug/error) are likewise replaced with the appropriate test.log methods
and that the function parameter named test is used for logging (e.g.,
test.log.info(...)) so the file matches the other tests.

In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py`:
- Around line 28-30: The code assumes options.split() has elements and does path
= options.split()[-1], which raises IndexError when domfsfreeze_options is
empty; change it to first split into parts = options.split() and then set path =
parts[-1] if parts else '' (or another safe default), and only build/run cmd =
'touch %s/freeze_test' % path and call session.cmd_output when path is non-empty
(skip or handle the empty-case appropriately) so that options, path, cmd, and
session.cmd_output are guarded against empty domfsfreeze_options.

---

Outside diff comments:
In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py`:
- Around line 57-70: Initialize a local variable output before the try block and
correct the typo "exsiting"→"existing"; specifically, in the loop over
mountpoints where session.cmd_status and session.cmd_output are used
(referencing session.cmd_status, session.cmd_output, aexpect.ShellTimeoutError,
mountpoints, file_name, and test.fail), set output = "" (or None) just before
try so the except handler can safely reference it, and change the logging string
from "not exsiting" to "not existing".

---

Nitpick comments:
In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py`:
- Around line 20-26: The docstring for the function check_freeze is missing
documentation for the newly added options parameter; update the check_freeze
docstring to include a short description of options (its type and purpose)
alongside the existing :param session: entry—e.g., add a line like ":param
options: <type> and description of what options controls (e.g., timeout, file
path, flags)"; keep wording concise and consistent with other docstrings in the
file and reference the function name check_freeze and the parameter options when
adding the new docstring line.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6eed8348-6e26-4848-9d31-403e703ff591

📥 Commits

Reviewing files that changed from the base of the PR and between 230d80d and 4762c66.

📒 Files selected for processing (4)
  • libvirt/tests/cfg/virsh_cmd/domain/virsh_domfsfreeze.cfg
  • libvirt/tests/cfg/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.cfg
  • libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze.py
  • libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py

@@ -1,4 +1,5 @@
import aexpect
import logging
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check which logging pattern is more common in the codebase
echo "=== Files using test.log.info ==="
rg -l "test\.log\.info" libvirt/tests/src/ | wc -l
echo "=== Files using logging.info directly ==="
rg -l "^import logging" libvirt/tests/src/ | head -20

Repository: autotest/tp-libvirt

Length of output: 1573


🏁 Script executed:

#!/bin/bash
# Examine the reviewed file to see the logging pattern
cat -n libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py | head -50

Repository: autotest/tp-libvirt

Length of output: 2362


🏁 Script executed:

#!/bin/bash
# Search for logging usage in the reviewed file
echo "=== logging.info calls ==="
rg -n "logging\.info" libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py
echo "=== test.log.info calls ==="
rg -n "test\.log\.info" libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py
echo "=== Check if test.log is defined ==="
rg -n "test\.log\s*=" libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py

Repository: autotest/tp-libvirt

Length of output: 761


🏁 Script executed:

#!/bin/bash
# Check if there's a test fixture/setup that initializes test.log
rg -n "class.*Test\|def.*setUp\|test\.log" libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py | head -30

Repository: autotest/tp-libvirt

Length of output: 45


Consider using test.log.info() for consistency with project conventions.

The file imports logging and uses logging.info() throughout, but the project standard is to use test.log.info() (used in 362 other test files). Since test is available as a function parameter, align this file with the codebase convention by switching to test.log.info().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libvirt/tests/src/virsh_cmd/domain/virsh_domfsfreeze_domfsthaw.py` at line 2,
The file currently imports the logging module and calls logging.info(); change
these to use the project convention by removing the import of logging and
replacing all calls to logging.info(...) with test.log.info(...). Ensure any
other logging.* calls in this file (e.g., logging.debug/error) are likewise
replaced with the appropriate test.log methods and that the function parameter
named test is used for logging (e.g., test.log.info(...)) so the file matches
the other tests.

Under image mode, there is no mountpoint of "/",
so change the specified fsfreeze mountpoint to /boot.

Also change the function in test_thaw for listing file,
The file can not be created if fsfreeze is sucessfully,
and is not created before fsthaw in the code. It does not
make sense to fail the case if the file is not exsiting
after fsthaw.

Signed-off-by: Lili Zhu <lizhu@redhat.com>
@iccaszhulili
Copy link
Contributor Author

Image mode:
# avocado run --vt-type libvirt domfsfreeze
JOB ID : 00f873170487eff813b4f95a4d821e5bf5e8d231
JOB LOG : /var/log/avocado/job-results/job-2026-03-11T03.11-00f8731/job.log
...
RESULTS : PASS 19 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /var/log/avocado/job-results/job-2026-03-11T03.11-00f8731/results.html
JOB TIME : 1592.27 s

# avocado run --vt-type libvirt domfsfreeze_domfsthaw
JOB ID : 1fe9e093c3240379cd997726ecd12428c5ed4e09
JOB LOG : /var/log/avocado/job-results/job-2026-03-11T04.06-1fe9e09/job.log
....
RESULTS : PASS 4 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /var/log/avocado/job-results/job-2026-03-11T04.06-1fe9e09/results.html
JOB TIME : 347.78 s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant