Skip to content

Commit

Permalink
Resolve memory attachment & update issues
Browse files Browse the repository at this point in the history
Fix memory device attachment and update errors.
The block size was too small, requiring a minimum
of 524288KiB.This commit corrects the issue, allowing
successful memory device attachment and updates.

Signed-off-by: Aakanksha Tripathi <[email protected]>
  • Loading branch information
Aakanksha Tripathi authored and root committed Oct 27, 2023
1 parent 5e52f53 commit c9d41cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions libvirt/tests/cfg/memory/memory_attach_device.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
variants test_case:
- virtio_mem:
no pseries
set_num_huge_pages = 1000
required_kernel = [5.14.0,)
guest_required_kernel = [5.8.0,)
func_supported_since_libvirt_ver = (8, 0, 0)
func_supported_since_qemu_kvm_ver = (6, 2, 0)
vm_attrs = {'max_mem_rt': 10485760, 'max_mem_rt_slots': 16, 'max_mem_rt_unit': 'KiB', 'vcpu': 4, 'cpu': {'numa_cell': [{'id': '0', 'cpus': '0-1', 'memory': '1048576', 'unit': 'KiB'}]}}
mem_device_attrs = {'mem_model': 'virtio-mem', 'target': {'requested_unit': 'KiB', 'size': 262144, 'node': 0, 'size_unit': 'KiB', 'requested_size': 131072, 'block_unit': 'KiB', 'block_size': 2048}}
aarch64:
vm_attrs = {'max_mem_rt': 10485760, 'max_mem_rt_slots': 16, 'max_mem_rt_unit': 'KiB', 'vcpu': 4, 'cpu': {'mode': 'host-passthrough', 'numa_cell': [{'id': '0', 'cpus': '0-3', 'memory': '524288', 'unit': 'KiB'}]}}
mem_device_attrs = {'mem_model': 'virtio-mem', 'target': {'requested_unit': 'KiB', 'size': 262144, 'node': 0, 'size_unit': 'KiB', 'requested_size': 131072, 'block_unit': 'KiB', 'block_size': 2048}, 'source': {'pagesize_unit': 'KiB', 'pagesize': 2048, 'nodemask': '0'}}
mem_device_attrs = {'mem_model': 'virtio-mem', 'target': {'requested_unit': 'KiB', 'size': 1048576, 'node': 0, 'size_unit': 'KiB', 'requested_size': 524288, 'block_unit': 'KiB', 'block_size': 524288}}
5 changes: 2 additions & 3 deletions libvirt/tests/cfg/memory/memory_update_device.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
variants test_case:
- virtio_mem:
no pseries
set_num_huge_pages = 1000
required_kernel = [5.14.0,)
guest_required_kernel = [5.8.0,)
func_supported_since_libvirt_ver = (8, 0, 0)
func_supported_since_qemu_kvm_ver = (6, 2, 0)
vm_attrs = {'max_mem_rt': 10485760, 'max_mem_rt_slots': 16, 'max_mem_rt_unit': 'KiB', 'vcpu': 4, 'cpu': {'numa_cell': [{'id': '0', 'cpus': '0-1', 'memory': '1048576', 'unit': 'KiB'}]}}
aarch64:
vm_attrs = {'max_mem_rt': 10485760, 'max_mem_rt_slots': 16, 'max_mem_rt_unit': 'KiB', 'vcpu': 4, 'cpu': {'mode': 'host-passthrough', 'numa_cell': [{'id': '0', 'cpus': '0-3', 'memory': '524288', 'unit': 'KiB'}]}}
mem_device_attrs = {'mem_model': 'virtio-mem', 'target': {'requested_unit': 'KiB', 'size': 262144, 'node': 0, 'size_unit': 'KiB', 'requested_size': 131072, 'block_unit': 'KiB', 'block_size': 2048}, 'source': {'pagesize_unit': 'KiB', 'pagesize': 2048, 'nodemask': '0'}}
requested_size = 160MiB
mem_device_attrs = {'mem_model': 'virtio-mem', 'target': {'requested_unit': 'KiB', 'size': 1048576, 'node': 0, 'size_unit': 'KiB', 'requested_size': 524288, 'block_unit': 'KiB', 'block_size': 524288}}
requested_size = 1048576KiB
check_log_str = "MEMORY_DEVICE_SIZE_CHANGE.*virtiomem"
virsh_opts = "--alias %s --requested-size ${requested_size}"
7 changes: 2 additions & 5 deletions libvirt/tests/src/memory/memory_attach_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from virttest.staging import utils_memory
from virttest.utils_libvirt import libvirt_vmxml
from virttest.utils_version import VersionInterval
import time

VIRSH_ARGS = {'debug': True, 'ignore_status': False}
ORG_HP = utils_memory.get_num_huge_pages()
Expand Down Expand Up @@ -56,9 +57,6 @@ def setup_test_virtio_mem():
"""
Setup vmxml for test
"""
set_num_huge_pages = params.get("set_num_huge_pages")
if set_num_huge_pages:
utils_memory.set_num_huge_pages(int(set_num_huge_pages))

libvirt_vmxml.remove_vm_devices_by_type(vm, 'memory')
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name)
Expand All @@ -83,6 +81,7 @@ def run_test_virtio_mem():
virsh.attach_device(vm_name, mem_device.xml, flagstr=options,
debug=True, ignore_status=False)

time.sleep(10)
if not vm.is_alive():
vm.start()
vm.wait_for_login().close()
Expand Down Expand Up @@ -111,8 +110,6 @@ def cleanup_test_virtio_mem():
"""
Clean up environment
"""
if utils_memory.get_num_huge_pages() != ORG_HP:
utils_memory.set_num_huge_pages(ORG_HP)

# Variable assignment
test_case = params.get('test_case', '')
Expand Down
13 changes: 4 additions & 9 deletions libvirt/tests/src/memory/memory_update_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ def setup_test_virtio_mem():
"""
Setup vmxml for test
"""
set_num_huge_pages = params.get("set_num_huge_pages")
if set_num_huge_pages:
utils_memory.set_num_huge_pages(int(set_num_huge_pages))

libvirt_vmxml.remove_vm_devices_by_type(vm, 'memory')
vm_attrs = eval(params.get('vm_attrs', '{}'))
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name)
Expand All @@ -89,7 +85,8 @@ def run_test_virtio_mem():
test.log.debug("VM's memory before updating requested size: %s",
vm_mem_before)

test.log.info("TEST_STEP1: Update requested size for virtio-mem device.")
test.log.info(
"TEST_STEP1: Update requested size for virtio-mem device.")
vmxml_cur = vm_xml.VMXML.new_from_dumpxml(vm_name)
mem_dev = vmxml_cur.devices.by_device_tag("memory")[0]
mem_dev_alias = mem_dev.fetch_attrs()['alias']['name']
Expand All @@ -114,7 +111,8 @@ def run_test_virtio_mem():
test.log.info("TEST_STEP3: Check 'MEMORY_DEVICE_SIZE_CHANGE' in "
"libvirtd/virtqemud log")
log_file = utils_misc.get_path(test.debugdir, "libvirtd.log")
check_log_str = params.get("check_log_str", "MEMORY_DEVICE_SIZE_CHANGE")
check_log_str = params.get(
"check_log_str", "MEMORY_DEVICE_SIZE_CHANGE")
libvirt.check_logfile(check_log_str, log_file)

test.log.info("TEST STEP4: Check memory in the VM.")
Expand All @@ -131,9 +129,6 @@ def cleanup_test_virtio_mem():
"""
Clean up environment
"""
if utils_memory.get_num_huge_pages() != ORG_HP:
utils_memory.set_num_huge_pages(ORG_HP)

# Variable assignment
test_case = params.get('test_case', '')

Expand Down

0 comments on commit c9d41cb

Please sign in to comment.