-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5811 from xiaodwan/new_case_for_ras_support
RAS: add new case for RAS feature support
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- features.ras: | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): | ||
""" | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -826,6 +826,7 @@ qxl | |
QXL | ||
qxldod | ||
Radix | ||
ras | ||
rases | ||
rawio | ||
rbd | ||
|