@@ -179,6 +179,7 @@ def check_mem_test_cmd_line(model_type, mem_type, mem_size):
179179 cmdline = open ('/proc/%s/cmdline' % vm .get_pid ()).read ().replace ("\x00 " , " " )
180180 logging .debug ("the cmdline is: %s" % cmdline )
181181
182+ pattern = ""
182183 if mem_type == "ram" or mem_type == "vram" :
183184 cmd_mem_size = str (int (mem_size )* 1024 )
184185 pattern = r"-device.*qxl-vga.*%s_size\W{1,2}%s" % (mem_type , cmd_mem_size )
@@ -226,6 +227,9 @@ def up_round_to_power_of_two(num):
226227 resolution_test = params .get ("resolution_test" , "no" ) == "yes"
227228 resolution_x = params .get ("resolution_x" )
228229 resolution_y = params .get ("resolution_y" )
230+ graphics_test = params .get ("graphics_test" , "no" ) == "yes"
231+ with_graphics = params .get ("with_graphics" , "yes" ) == "yes"
232+ video_device = params .get ("video_device" , "yes" ) == "yes"
229233
230234 vm_xml = VMXML .new_from_dumpxml (vm_name )
231235 vm_xml_backup = vm_xml .copy ()
@@ -238,31 +242,37 @@ def up_round_to_power_of_two(num):
238242
239243 try :
240244 vm_xml .remove_all_device_by_type ('video' )
241- kwargs = {}
242- model_type = primary_video_model
243- is_primary = None
244- if secondary_video_model :
245- is_primary = True
246- if heads_test and not default_primary_heads :
247- kwargs ["model_heads" ] = primary_heads
248- if mem_test and not default_mem_size :
249- kwargs ["model_" + mem_type ] = mem_size
250- if model_type == "virtio" and with_packed :
251- kwargs ["driver" ] = {"packed" : driver_packed }
252- if resolution_test :
253- kwargs ["resolution" ] = {"x" : resolution_x , "y" : resolution_y }
254- add_video_device (model_type , vm_xml , is_primary , status_error , ** kwargs )
255-
256- if secondary_video_model :
245+ if graphics_test and not with_graphics :
246+ vm_xml .remove_all_device_by_type ('graphics' )
247+
248+ if video_device :
257249 kwargs = {}
258- model_type = secondary_video_model
259- is_primary = False
260- if heads_test and not default_secondary_heads :
261- kwargs ["model_heads" ] = secondary_heads
250+ model_type = primary_video_model
251+ is_primary = None
252+ if secondary_video_model :
253+ is_primary = True
254+ if heads_test and not default_primary_heads :
255+ kwargs ["model_heads" ] = primary_heads
256+ if mem_test and not default_mem_size :
257+ kwargs ["model_" + mem_type ] = mem_size
262258 if model_type == "virtio" and with_packed :
263259 kwargs ["driver" ] = {"packed" : driver_packed }
260+ if resolution_test :
261+ kwargs ["resolution" ] = {"x" : resolution_x , "y" : resolution_y }
264262 add_video_device (model_type , vm_xml , is_primary , status_error , ** kwargs )
265263
264+ if secondary_video_model :
265+ kwargs = {}
266+ model_type = secondary_video_model
267+ is_primary = False
268+ if heads_test and not default_secondary_heads :
269+ kwargs ["model_heads" ] = secondary_heads
270+ if model_type == "virtio" and with_packed :
271+ kwargs ["driver" ] = {"packed" : driver_packed }
272+ add_video_device (model_type , vm_xml , is_primary , status_error , ** kwargs )
273+
274+ vm_xml .sync ()
275+
266276 if not status_error :
267277 res = virsh .start (vm_name )
268278
@@ -271,6 +281,10 @@ def up_round_to_power_of_two(num):
271281 "device xml. details: %s " % res )
272282 logging .debug ("vm started successfully in positive cases." )
273283
284+ if graphics_test :
285+ libvirt .check_qemu_cmd_line (params .get ("qemu_line" ),
286+ expect_exist = with_graphics )
287+
274288 if resolution_test :
275289 libvirt .check_qemu_cmd_line (params .get ("qemu_line" ))
276290
0 commit comments