@@ -35,7 +35,7 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
3535 machine (str): QEMU machine type
3636 cpu (str): QEMU cpu type
3737 memory (str): QEMU memory size (ends with M or G)
38- extra_args (str): extra QEMU arguments, they are passed directly to the QEMU binary
38+ extra_args (str): optional, extra QEMU arguments passed directly to the QEMU binary
3939 boot_args (str): optional, additional kernel boot argument
4040 kernel (str): optional, reference to the images key for the kernel
4141 disk (str): optional, reference to the images key for the disk image
@@ -48,13 +48,16 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
4848 none: Do not create a display device
4949 fb-headless: Create a headless framebuffer device
5050 egl-headless: Create a headless GPU-backed graphics card. Requires host support
51+ qemu-default: Don't override QEMU default settings
5152 nic (str): optional, configuration string to pass to QEMU to create a network interface
5253 """
5354 qemu_bin = attr .ib (validator = attr .validators .instance_of (str ))
5455 machine = attr .ib (validator = attr .validators .instance_of (str ))
5556 cpu = attr .ib (validator = attr .validators .instance_of (str ))
5657 memory = attr .ib (validator = attr .validators .instance_of (str ))
57- extra_args = attr .ib (validator = attr .validators .instance_of (str ))
58+ extra_args = attr .ib (
59+ default = '' ,
60+ validator = attr .validators .optional (attr .validators .instance_of (str )))
5861 boot_args = attr .ib (
5962 default = None ,
6063 validator = attr .validators .optional (attr .validators .instance_of (str )))
@@ -83,7 +86,9 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
8386 default = "none" ,
8487 validator = attr .validators .optional (attr .validators .and_ (
8588 attr .validators .instance_of (str ),
86- attr .validators .in_ (["none" , "fb-headless" , "egl-headless" ]),
89+ attr .validators .in_ (
90+ ["none" , "fb-headless" , "egl-headless" , "qemu-default" ]
91+ ),
8792 ))
8893 )
8994 nic = attr .ib (
@@ -209,7 +214,7 @@ def get_qemu_base_args(self):
209214 cmd .append ("virtio" )
210215 cmd .append ("-display" )
211216 cmd .append ("egl-headless" )
212- else :
217+ elif self . display != "qemu-default" :
213218 raise ExecutionError (f"Unknown display '{ self .display } '" )
214219
215220 if self .nic :
@@ -271,9 +276,9 @@ def on(self):
271276 self .qmp = QMPMonitor (self ._child .stdout , self ._child .stdin )
272277 except QMPError as exc :
273278 if self ._child .poll () is not None :
274- self ._child .communicate ()
279+ _ , err = self ._child .communicate ()
275280 raise IOError (
276- f"QEMU process terminated with exit code { self ._child .returncode } "
281+ f"QEMU error: { err } (exitcode= { self ._child .returncode } ) "
277282 ) from exc
278283 raise
279284
0 commit comments