Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 48 additions & 10 deletions libvirt/tests/cfg/libvirt_mem.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
wait_before_save_secs = 10
variants:
- positive_test:
max_mem_rt = 3584000
max_mem = 2048000
current_mem = 2048000
numa_cells = "{'id':'0','cpus':'0-1','memory':'1024000','unit':'KiB'} {'id':'1','cpus':'2-3','memory':'1024000','unit':'KiB'}"
max_mem_rt = 2560000
mem_online = "yes"
max_mem = 1024000
current_mem = 1024000
numa_cells = "{'id':'0','cpus':'0-1','memory':'512000','unit':'KiB'} {'id':'1','cpus':'2-3','memory':'512000','unit':'KiB'}"
add_mem_device = "yes"
tg_size = 524288
tg_sizeunit = "KiB"
Expand Down Expand Up @@ -153,11 +154,48 @@
- hot_plug:
memory_val = 1500000
hot_plug = yes
- memory_attach_detach_comprehensive:
test_qemu_cmd = "no"
attach_device = "yes"
detach_device = "yes"
test_dom_xml = "yes"
restart_libvirtd = "no"
test_managedsave = "no"
test_save_restore = "no"
max_mem_rt = 22020096
max_mem = 2097152
current_mem = 2097152
numa_cells = "{'id':'0','cpus':'0-1','memory':'1048576','unit':'KiB'} {'id':'1','cpus':'2-3','memory':'1048576','unit':'KiB'}"
tg_size = 524288
tg_sizeunit = "KiB"
tg_node = 0
variants:
- config_only:
attach_option = "--config"
detach_option = "--config"
- live_and_config:
mem_online = "yes"
attach_option = "--live --config"
detach_option = "--live --config"
- live_only:
attach_option = "--live"
detach_option = "--live"
- persistent_only:
attach_option = "--persistent"
detach_option = "--persistent"
- current_running:
attach_option = "--current"
detach_option = "--current"
start_vm = "yes"
- current_shutoff:
attach_option = "--current"
detach_option = "--current"
start_vm = "no"
Comment on lines +190 to +193

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

current_shutoff does not currently test a shutoff-domain --current flow.

This variant sets start_vm = "no", but libvirt/tests/src/libvirt_mem.py still starts the guest up front whenever attach_device = "yes". As written, this case will execute --current against a running VM and duplicate current_running semantics instead of covering the shutoff path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libvirt/tests/cfg/libvirt_mem.cfg` around lines 190 - 193, The test variant
current_shutoff sets start_vm = "no" but the test harness in
libvirt/tests/src/libvirt_mem.py still forces a guest start whenever
attach_device == "yes", so the case exercises the running (--current) path
instead of the shutoff path. Update the start logic in libvirt_mem.py (the code
that checks attach_device and starts the guest) to respect the start_vm flag for
this variant: when start_vm == "no" (or when the variant name is
current_shutoff) do not start the domain before invoking the attach/detach flow
so --current runs against a shutoff domain; alternatively add an explicit branch
for current_shutoff to skip the guest startup. Ensure the check references the
existing attach_device and start_vm variables (or the variant identifier) so
behavior matches the libvirt_mem.cfg setting.

- negative_test:
max_mem_rt = 3584000
max_mem = 2048000
current_mem = 2048000
numa_cells = "{'id':'0','cpus':'0-1','memory':'1024000','unit':'KiB'} {'id':'1','cpus':'2-3','memory':'1024000','unit':'KiB'}"
max_mem_rt = 2560000
max_mem = 1024000
current_mem = 1024000
numa_cells = "{'id':'0','cpus':'0-1','memory':'512000','unit':'KiB'} {'id':'1','cpus':'2-3','memory':'512000','unit':'KiB'}"
add_mem_device = "yes"
tg_size = 524288
tg_sizeunit = "KiB"
Expand Down Expand Up @@ -202,7 +240,7 @@
attach_option = "--config"
memory_addr = "{'type':'dimm','slot':'1','base':'0x11f000000'}"
- attach_many_times:
max_mem_rt = 3671040
max_mem_rt = 2622464
attach_times = 4
attach_option = "--config"
- attach_invalid_size:
Expand All @@ -226,7 +264,7 @@
attach_option = "--config"
memory_addr = "{'type':'dimm','slot':'1','base':'0x11f000000'}"
- detach_many_times:
max_mem_rt = 3671040
max_mem_rt = 2622464
attach_times = 4
attach_option = "--config"
- detach_invalid_size:
Expand Down
Loading