未验证 提交 0d569ea6 编写于 作者: D dzhengfy 提交者: GitHub

Merge pull request #2834 from jinqi7/nvdimm_lifecycle

Add nvdimm lifecycle test case
......@@ -30,6 +30,10 @@
setvm_vcpu = 4
setvm_placement = static
qemu_checks = -numa node,nodeid=1,cpus=2-3,mem=512`mem-path=${nvdimm_file},share=yes,size=536870912`label-size=262144
variants:
- no_other_check:
- check_life_cycle:
check_life_cycle = "yes"
- no_label:
check = back_file
cpuxml_mode = host-model
......
......@@ -96,6 +96,16 @@ def run(test, params, env):
return mem_xml.copy()
def check_nvdimm_file(file_name):
"""
check if the file exists in nvdimm memory device
:param file_name: the file name in nvdimm device
"""
vm_session = vm.wait_for_login()
if test_str not in vm_session.cmd('cat /mnt/%s ' % file_name):
test.fail('"%s" should be in output' % test_str)
bkxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
try:
......@@ -187,7 +197,7 @@ def run(test, params, env):
libvirt.check_qemu_cmd_line('mem-path=/tmp/nvdimm,share=no')
private_str = 'This is a test for foo-private!'
private_str = 'This is a test for foo-private'
vm_session.cmd('mount -o dax /dev/pmem0 /mnt/')
file_private = 'foo-private'
......@@ -222,7 +232,7 @@ def run(test, params, env):
test_str = 'This is a test with label'
vm_session.cmd('echo "%s" >/mnt/foo-label' % test_str)
if test_str not in vm_session.cmd('cat /mnt/foo-label '):
test.fail('"%s" should be in output' % test_str)
test.fail('"%s" should be in the output of cat cmd' % test_str)
# Reboot the guest, and remount the nvdimm device in the guest.
# Check the file foo-label is exited
......@@ -234,6 +244,20 @@ def run(test, params, env):
if test_str not in vm_session.cmd('cat /mnt/foo-label '):
test.fail('"%s" should be in output' % test_str)
if params.get('check_life_cycle', 'no') == 'yes':
virsh.managedsave(vm_name, ignore_status=False, debug=True)
vm.start()
check_nvdimm_file('foo-label')
vm_s1 = vm_name + ".s1"
virsh.save(vm_name, vm_s1, ignore_status=False, debug=True)
virsh.restore(vm_s1, ignore_status=False, debug=True)
check_nvdimm_file('foo-label')
virsh.snapshot_create_as(vm_name, vm_s1, ignore_status=False, debug=True)
virsh.snapshot_revert(vm_name, vm_s1, ignore_status=False, debug=True)
virsh.snapshot_delete(vm_name, vm_s1, ignore_status=False, debug=True)
if check == 'hot_plug':
# Create file for 2nd nvdimm device
nvdimm_file_2 = params.get('nvdimm_file_2')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册