11from virttest import virsh
22
3- from virttest .libvirt_xml import vm_xml
43from virttest .utils_libvirt import libvirt_vmxml
54from virttest .utils_test import libvirt
65
98
109def run (test , params , env ):
1110 """
12- Hotplug/unplug GPU device
11+ Hotplug GPU device
12+ Note: Hotunplug is not supported for nvidia GPUs
1313 """
1414 vm_name = params .get ("main_vm" , "avocado-vt-vm1" )
1515 vm = env .get_vm (vm_name )
@@ -33,24 +33,9 @@ def run(test, params, env):
3333 gpu_test .install_latest_driver (vm_session )
3434 gpu_test .nvidia_smi_check (vm_session )
3535
36- test .log .info ("TEST_STEP: Unplug a gpu device from vm" )
37- vm_hostdev = vm_xml .VMXML .new_from_dumpxml (vm .name )\
38- .devices .by_device_tag ("hostdev" )[0 ]
39- virsh .detach_device (vm .name , vm_hostdev .xml ,
40- wait_for_event = True , event_timeout = 30 ,
41- ** virsh_args )
42- gpu_test .check_gpu_dev (vm , True )
43-
44- test .log .info ("TEST_STEP: Hotplug back the gpu device" )
45- virsh .attach_device (vm .name , gpu_dev .xml , ** virsh_args )
46- gpu_test .check_gpu_dev (vm )
47- gpu_test .nvidia_smi_check (vm_session )
48-
4936 test .log .info ("TEST_STEP: Check gpu device exclusivity" )
5037 res = virsh .attach_device (vm .name , gpu_dev .xml , debug = True )
5138 libvirt .check_result (res , "in use" )
52- gpu_test .check_gpu_dev (vm )
53- gpu_test .nvidia_smi_check (vm_session )
5439 vm_session .close ()
5540 finally :
5641 gpu_test .teardown_default ()
0 commit comments