提交 4fb5ddfe 编写于 作者: Y Yongxue Hong

nvme_plug: New case to test hot plug and unplug NVMe device

New a case that hot plug and unplug with a NVMe device.
Signed-off-by: NYongxue Hong <yhong@redhat.com>
上级 a2a19c40
- nvme_plug:
only nvme_direct
type = nvme_plug
start_vm = no
kill_vm = yes
kill_vm_gracefully = yes
shutdown_cleanly = yes
shutdown_cleanly_timeout = 120
guest_port_unattended_install = 12323
kernel = vmlinuz
initrd = initrd.img
inactivity_watcher = error
inactivity_treshold = 1800
image_verify_bootable = no
image_copy_on_error = no
lowest_mem = 512
install_trigger_time = 0
install_timeout = 7200
random_trigger = "no"
unattended_delivery_method = cdrom
cdroms += " unattended"
enable_nvme_cd1 = no
enable_nvme_unattended = no
enable_nvme_winutils = no
drive_index_unattended = 1
drive_index_cd1 = 2
boot_once = d
medium = cdrom
virtio_scsi:
iothread_scheme ?=
iothreads ?=
image_iothread ?=
images = 'sys stg'
data_img_tag = stg
enable_nvme_sys = no
image_backend_sys = filesystem
image_name_sys = images/sys
image_format_sys = qcow2
image_size_sys = 30G
force_create_image_sys = yes
remove_image_sys = yes
default_cdroms = winutils
image_size_stg = 5G
force_create_image_stg = yes
boot_drive_stg = no
remove_image_stg = no
fio_default_options = '--direct=1 --bs=64K --size=2G --name=test --iodepth=4'
Windows:
blk_extra_params_sys = "serial=SYSTEM_DISK0"
fio_filename = fio_data_disk_test
i440fx:
cd_format_unattended = ide
cd_format_cd1 = ide
cd_format_winutils = ide
q35:
cd_format_unattended = ahci
cd_format_cd1 = ahci
cd_format_winutils = ahci
Linux:
fio_default_options += ' --ioengine=libaio '
remove_options = kernel initrd kernel_params
fio_options = '${fio_default_options} --rw=read;'
fio_options += '${fio_default_options} --rw=write;'
fio_options += '${fio_default_options} --rw=randread;'
fio_options += '${fio_default_options} --rw=randwrite;'
fio_options += '${fio_default_options} --rw=randrw'
variants:
# Below variants is to share configurations related to installation defined.
- @with_installation:
variants:
- @extra_cdrom_ks:
from virttest import env_process
from virttest import utils_disk
from virttest.tests import unattended_install
from provider.block_devices_plug import BlockDevicesPlug
from provider.storage_benchmark import generate_instance
def run(test, params, env):
"""
Test hot plug and unplug NVMe device.
Steps:
1. Install guest with local filesystem.
2. Hot plug NVMe device to guest.
3. Check if the NVMe device exists in qemu side.
4. Check if the NVMe has been successfully added to guest.
5. Run fio in the hot plugged NVMe device in guest.
6. Unplug the NVMe device.
7. Check if the NVMe device still exists.
8. Check if the NVMe has been successfully removed from guest.
9. Reboot guest.
:param test: QEMU test object.
:param params: Dictionary with the test parameters.
:param env: Dictionary with test environment.
"""
unattended_install.run(test, params, env)
if params.get('remove_options'):
for option in params.get('remove_options').split():
del params[option]
params['cdroms'] = params.get('default_cdroms')
params['start_vm'] = 'yes'
env_process.preprocess_vm(test, params, env, params["main_vm"])
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
session = vm.wait_for_login()
plug = BlockDevicesPlug(vm)
plug.hotplug_devs_serial()
target = '/dev/%s' % plug[0]
os_type = params['os_type']
data_img_size = params.get('image_size_%s' % params.get('data_img_tag'))
if os_type == 'windows':
utils_disk.update_windows_disk_attributes(session, plug[0])
drive_letter = utils_disk.configure_empty_disk(session, plug[0],
data_img_size,
os_type)[0]
target = r'%s\:\\%s' % (drive_letter, params.get('fio_filename'))
fio = generate_instance(params, vm, 'fio')
for option in params['fio_options'].split(';'):
fio.run('--filename=%s %s' % (target, option))
plug.unplug_devs_serial()
vm.reboot(session)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册