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

RAS: add new case for RAS feature support #5811

Merged
merged 1 commit into from
Oct 10, 2024
Merged
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
14 changes: 14 additions & 0 deletions libvirt/tests/cfg/features/ras.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- features.ras:
xiaodwan marked this conversation as resolved.
Show resolved Hide resolved
type = ras
start_vm = no
only aarch64
func_supported_since_libvirt_ver = (10, 4, 0)
unsupported_err_msg = "Ras feature is not supported on current version."
variants:
- on:
ras_state = on
- off:
ras_state = off
variants:
- positive_test:
status_error = "no"
62 changes: 62 additions & 0 deletions libvirt/tests/src/features/ras.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import logging

from virttest import virsh
from virttest import libvirt_version
from virttest.libvirt_xml.vm_xml import VMXML
from virttest.utils_libvirt import libvirt_vmxml
from virttest.utils_test import libvirt

LOG = logging.getLogger('avocado.' + __name__)


def run(test, params, env):
"""
Test the ras feature
1. Enable 'ras=on/off' in a guest
2. check the xml and qemu cmd line
"""
# Ras feature supported since 10.4.0.
libvirt_version.is_libvirt_feature_supported(params)

ras_state = params.get("ras_state")

def check_dumpxml():
"""
Check whether the added devices are shown in the guest xml
"""
xpath = [{'element_attrs': [".//ras[@state='%s']" % ras_state]}]
# Check ras state
vm_xml = VMXML.new_from_dumpxml(vm_name)
libvirt_vmxml.check_guest_xml_by_xpaths(vm_xml, xpath)

def check_qemu_cmd_line():
xiaodwan marked this conversation as resolved.
Show resolved Hide resolved
"""
Check whether the ras feature is shown in the qemu cmd line
"""
pattern = r"-machine.*ras=%s" % ras_state
libvirt.check_qemu_cmd_line(pattern)

vm_name = params.get("main_vm", "avocado-vt-vm1")
vm = env.get_vm(vm_name)

vm_xml = VMXML.new_from_dumpxml(vm_name)
vm_xml_backup = vm_xml.copy()
LOG.debug("vm xml is %s", vm_xml_backup)

if vm.is_alive():
vm.destroy()

try:
features_xml = vm_xml.features
if features_xml.has_feature('ras'):
features_xml.remove_feature('ras')
features_xml.ras = ras_state
vm_xml.features = features_xml
vm_xml.sync()
virsh.start(vm_name, ignore_status=False)
check_dumpxml()
check_qemu_cmd_line()
finally:
if vm.is_alive():
virsh.destroy(vm_name)
vm_xml_backup.sync()
1 change: 1 addition & 0 deletions spell.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ qxl
QXL
qxldod
Radix
ras
rases
rawio
rbd
Expand Down
Loading