Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add case for dimm memory with access and discard setting #5328

Merged

Conversation

nanli1
Copy link
Contributor

@nanli1 nanli1 commented Dec 8, 2023

xxxx-299048:Dimm memory device with access and discard settings

Signed-off-by: nanli [email protected]

x86+rhel9 & rhel8

avocado run --vt-type libvirt --test-runner=runner --vt-machine-type q35 memory.devices.dimm.access_and_discard
 (1/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.undefined.file: PASS (131.14 s)
 (2/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.undefined.anonymous: PASS (130.06 s)
 (3/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.undefined.memfd: PASS (127.07 s)
 (4/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.shared_and_discard.file: PASS (130.73 s)
 (5/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.shared_and_discard.anonymous: PASS (127.75 s)
 (6/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.shared_and_discard.memfd: PASS (126.44 s)
 (7/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.private_and_no_discard.file: PASS (126.11 s)
 (8/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.private_and_no_discard.anonymous: PASS (127.82 s)
 (9/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.private_and_no_discard.memfd: PASS (124.00 s)

aarm+rhel9

 avocado run --vt-type libvirt --test-runner=runner --vt-machine-type arm64-mmio memory.devices.dimm.access_and_discard
 (1/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.undefined.file: PASS (267.42 s)
 (2/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.undefined.anonymous: PASS (264.22 s)
 (3/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.undefined.memfd: PASS (264.65 s)
 (4/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.shared_and_discard.file: PASS (264.61 s)
 (5/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.shared_and_discard.anonymous: PASS (267.70 s)
 (6/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.shared_and_discard.memfd: PASS (265.65 s)
 (7/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.private_and_no_discard.file: PASS (260.87 s)
 (8/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.private_and_no_discard.anonymous: PASS (264.70 s)
 (9/9) type_specific.io-github-autotest-libvirt.memory.devices.dimm.access_and_discard.with_numa.private_and_no_discard.memfd: PASS (264.61 s)


@nanli1 nanli1 marked this pull request as draft December 8, 2023 14:54
@nanli1 nanli1 force-pushed the add_case_for_dimm_with_access_discard_setting branch 4 times, most recently from ff7ac0a to caf9c33 Compare December 13, 2023 09:12
@nanli1 nanli1 marked this pull request as ready for review December 13, 2023 09:16
@nanli1 nanli1 marked this pull request as draft December 13, 2023 09:59
@nanli1 nanli1 marked this pull request as ready for review December 13, 2023 11:49
Copy link
Contributor

@cliping cliping left a comment

Choose a reason for hiding this comment

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

Others LGTM

from virttest.utils_libvirtd import Libvirtd


def get_vm_attrs(test, params):
Copy link
Contributor

Choose a reason for hiding this comment

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

The same function is in #5290. Maybe we can move this function to provide/memory/memory_base.py. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks liping , Good idea. Currently , It's not very common for all the cases , only suitable for these two prs, Could I move it if exists more usage ?

@nanli1 nanli1 requested a review from cliping December 18, 2023 02:53
def get_vm_attrs(test, params):
"""
Get vm attrs.
:param test: test object
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a blank line above this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks dzheng, Done

variants memory_backing:
- file:
source_type = 'file'
source_attr = "'source_type':'${source_type}'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this line and all same occurences below to line 53

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks dzheng, Done

return vm_attrs


def get_dimm_mem(test, params):
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is to create a list of memory devices xml. So let's make the name accurate, like create_dimm_mem_list()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks dzheng, Done


test.log.info("TEST_STEP5: Hot unplug all dimm memory device")
for mem in all_dimms:
dimm = memory.Memory()
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to create new objects again for hotunplugging, I think.
We could put dimm in line 150 to a list and reuse them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks dzheng, Done

dimm device.
"""
test.log.info("TEST_STEP1: Define vm with dimm memory")
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is duplicated with line 207 original_xml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi dzheng,Thanks for your comment. L144 is used for step1, original_xml is used for step8

test.fail("Expected '%s', but got '%s'" % (path_error, res))

test.log.info("TEST_STEP8: Define guest without any dimm memory")
original_xml.setup_attrs(**vm_attrs)
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand why we use vm_attrs to configure vm xml?
Is it required attributes?
And could we make sure original_xml has no dimm memory device? If not, we need explicitly to remove existing dimm device if any.

Copy link
Contributor Author

@nanli1 nanli1 Feb 4, 2024

Choose a reason for hiding this comment

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

Hi dzheng, Thanks your comment. For these two questions:

  1. vm_attrs should be used to define required attributes as the polarion case
  2. Done , Removed dimm


test.log.info("TEST_STEP9: Hot plug all dimm memory device")
for mem in all_dimms:
dimm = memory.Memory()
Copy link
Contributor

Choose a reason for hiding this comment

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

Reuse above created memory device objects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks dzheng, Done

@nanli1 nanli1 force-pushed the add_case_for_dimm_with_access_discard_setting branch from caf9c33 to a0c7cf6 Compare February 4, 2024 01:37
    xxxx-299048:Dimm memory device with access and discard settings
Signed-off-by: nanli <[email protected]>
@nanli1 nanli1 force-pushed the add_case_for_dimm_with_access_discard_setting branch from a0c7cf6 to fc2ea57 Compare February 4, 2024 01:48
@nanli1 nanli1 requested a review from dzhengfy February 4, 2024 02:01
Copy link
Contributor

@dzhengfy dzhengfy left a comment

Choose a reason for hiding this comment

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

LGTM

@dzhengfy dzhengfy merged commit fa5a7a0 into autotest:master Feb 19, 2024
5 checks passed
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.

3 participants