@@ -35,7 +35,7 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
35
35
machine (str): QEMU machine type
36
36
cpu (str): QEMU cpu type
37
37
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
39
39
boot_args (str): optional, additional kernel boot argument
40
40
kernel (str): optional, reference to the images key for the kernel
41
41
disk (str): optional, reference to the images key for the disk image
@@ -48,13 +48,16 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
48
48
none: Do not create a display device
49
49
fb-headless: Create a headless framebuffer device
50
50
egl-headless: Create a headless GPU-backed graphics card. Requires host support
51
+ qemu-default: Don't override QEMU default settings
51
52
nic (str): optional, configuration string to pass to QEMU to create a network interface
52
53
"""
53
54
qemu_bin = attr .ib (validator = attr .validators .instance_of (str ))
54
55
machine = attr .ib (validator = attr .validators .instance_of (str ))
55
56
cpu = attr .ib (validator = attr .validators .instance_of (str ))
56
57
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 )))
58
61
boot_args = attr .ib (
59
62
default = None ,
60
63
validator = attr .validators .optional (attr .validators .instance_of (str )))
@@ -83,7 +86,9 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
83
86
default = "none" ,
84
87
validator = attr .validators .optional (attr .validators .and_ (
85
88
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
+ ),
87
92
))
88
93
)
89
94
nic = attr .ib (
@@ -209,7 +214,7 @@ def get_qemu_base_args(self):
209
214
cmd .append ("virtio" )
210
215
cmd .append ("-display" )
211
216
cmd .append ("egl-headless" )
212
- else :
217
+ elif self . display != "qemu-default" :
213
218
raise ExecutionError (f"Unknown display '{ self .display } '" )
214
219
215
220
if self .nic :
@@ -271,9 +276,9 @@ def on(self):
271
276
self .qmp = QMPMonitor (self ._child .stdout , self ._child .stdin )
272
277
except QMPError as exc :
273
278
if self ._child .poll () is not None :
274
- self ._child .communicate ()
279
+ _ , err = self ._child .communicate ()
275
280
raise IOError (
276
- f"QEMU process terminated with exit code { self ._child .returncode } "
281
+ f"QEMU error: { err } (exitcode= { self ._child .returncode } ) "
277
282
) from exc
278
283
raise
279
284
0 commit comments