Skip to content

Commit c310b8d

Browse files
committed
virsh_dump: drop --live option support
The --live flag was removed from virsh dump upstream, so any positive test that still use it now fails immediately. ref: https://gitlab.com/libvirt/libvirt/-/issues/646 Delete all test cases that relied on --live, and add a negative test to make sure the command rejects the obsolete option. Additionally, fix an unstable race by using utils_misc.wait_for(). Preventing the race condition where the log file had not yet been fully generated when the first check occurred. Also fix an unstable teardown issue Signed-off-by: zhentang-tz <[email protected]>
1 parent 983f459 commit c310b8d

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

libvirt/tests/cfg/guest_kernel_debugging/virsh_dump.cfg

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020
- pause_dump:
2121
paused_after_start_vm = "yes"
2222
variants:
23-
- live:
24-
dump_options = "--live"
2523
- crash:
2624
dump_options = "--crash"
2725
- reset:
2826
dump_options = "--reset"
29-
- live_dump:
30-
dump_options = "--live"
3127
- crash_dump:
3228
dump_options = "--crash"
3329
- reset_dump:
@@ -89,6 +85,8 @@
8985
dump_options = "--live --reset"
9086
- invalid_option4:
9187
dump_options = "--crash --reset"
88+
- invalid_option_live:
89+
dump_options = "--live"
9290
- shutoff_dump:
9391
start_vm = "no"
9492
- acl_test:

libvirt/tests/cfg/virsh_cmd/monitor/virsh_domstate.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@
7777
- dump_vm:
7878
domstate_vm_action = dump
7979
variants:
80-
- dump_live:
81-
dump_option = "--live"
8280
- dump_crash:
8381
dump_option = "--crash"
8482
- error_test:

libvirt/tests/src/guest_kernel_debugging/virsh_dump.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def run(test, params, env):
6666
unprivileged_user = 'testacl'
6767
document_string = eval(params.get("document_string", "[]"))
6868
valid_format = ["lzop", "gzip", "bzip2", "xz", 'elf', 'data']
69+
backup_xml = None
6970

7071
if not libvirt_version.version_compare(1, 1, 1):
7172
if params.get('setup_libvirt_polkit') == 'yes':
@@ -334,7 +335,7 @@ def check_logfile(image_format):
334335
if not log_file:
335336
log_file = utils_misc.get_path(test.debugdir, "libvirtd.log")
336337
error = "Invalid dump_image_format.*" + image_format
337-
return libvirt.check_logfile(error, log_file, ignore_status=True)
338+
return utils_misc.wait_for(lambda: libvirt.check_logfile(error, log_file, ignore_status=True), timeout=30)
338339

339340
# Configure dump_image_format in /etc/libvirt/qemu.conf.
340341
qemu_config = utils_config.LibvirtQemuConfig()
@@ -349,9 +350,12 @@ def check_logfile(image_format):
349350
qemu_config.dump_image_format = dump_image_format
350351
if dump_image_format not in valid_format:
351352
libvirtd.restart(wait_for_start=False)
352-
if check_logfile(dump_image_format):
353-
qemu_config.restore()
354-
libvirtd_socket.restart()
353+
err_msg_found = check_logfile(dump_image_format)
354+
qemu_config.restore()
355+
libvirtd_socket.restart()
356+
if not err_msg_found:
357+
test.fail("Cannot find the expected error message in log that indicates invalid image mode")
358+
else:
355359
return
356360
libvirtd.restart()
357361

@@ -482,7 +486,8 @@ def check_logfile(image_format):
482486
logging.info("Able to analyse guest vmcore using crash")
483487

484488
finally:
485-
backup_xml.sync()
489+
if backup_xml:
490+
backup_xml.sync()
486491
qemu_config.restore()
487492
libvirtd.restart()
488493
if os.path.isfile(small_img):

0 commit comments

Comments
 (0)