Skip to content

Commit

Permalink
Merge pull request autotest#5397 from hs0210/memory_increase
Browse files Browse the repository at this point in the history
memory: Increase guest memory to 4G
  • Loading branch information
chunfuwen authored Feb 22, 2024
2 parents c6a36d8 + d4f3387 commit 70e4871
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# expected to fail on older libvirt.
setmem_old_libvirt_fail = "no"
take_regular_screendumps = no
vm_attrs = {'memory': 4, 'memory_unit': 'GiB', 'current_mem': 4, 'current_mem_unit': 'GiB'}
variants:
- valid_options:
# These should not fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from virttest import libvirt_version
from virttest.utils_test import libvirt
from virttest.libvirt_xml import vm_xml
from virttest.staging import utils_memory

from provider.memory import memory_base


# Using as lower capital is not the best way to do, but this is just a
Expand Down Expand Up @@ -251,6 +254,21 @@ def print_debug_stats(original_inside_mem, original_outside_mem,
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
backup_xml = vmxml.copy()

vm_attrs = eval(params.get('vm_attrs'))
memory_size = vm_attrs['memory']
memory_unit = vm_attrs['memory_unit']
guest_memory = memory_base.convert_data_size(
str(memory_size) + memory_unit, dest_unit='KiB')
host_free_mem = utils_memory.freememtotal()
logging.debug("The allocation memory for guest is %sKiB,"
" the total free memory of host is %sKiB.",
guest_memory, host_free_mem)
if host_free_mem < guest_memory:
test.cancel("There is not enough memory for guest.")

vmxml.setup_attrs(**vm_attrs)
vmxml.sync()

if with_packed and not libvirt_version.version_compare(6, 3, 0):
test.cancel("The virtio packed attribute is not supported in"
" current libvirt version.")
Expand Down

0 comments on commit 70e4871

Please sign in to comment.