mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
qemu: Add a Character Devices slice field to the Config structure
Qemu character devices typically allow for sending traffic from the guest to the host by emulating a console, a tty, a serial device for example. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
73e2d53c9a
commit
6239e846b7
13
qemu.go
13
qemu.go
@ -139,6 +139,9 @@ type Config struct {
|
|||||||
// Devices is a list of devices for qemu to create.
|
// Devices is a list of devices for qemu to create.
|
||||||
Devices []Device
|
Devices []Device
|
||||||
|
|
||||||
|
// CharDevices is a list of character devices for qemu to export.
|
||||||
|
CharDevices []string
|
||||||
|
|
||||||
// Objects is a list of objects for qemu to create.
|
// Objects is a list of objects for qemu to create.
|
||||||
Objects []Object
|
Objects []Object
|
||||||
|
|
||||||
@ -237,6 +240,15 @@ func appendDevices(params []string, config Config) []string {
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendCharDevices(params []string, config Config) []string {
|
||||||
|
for _, c := range config.CharDevices {
|
||||||
|
params = append(params, "-chardev")
|
||||||
|
params = append(params, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
func appendObjects(params []string, config Config) []string {
|
func appendObjects(params []string, config Config) []string {
|
||||||
for _, o := range config.Objects {
|
for _, o := range config.Objects {
|
||||||
if o.Type != "" {
|
if o.Type != "" {
|
||||||
@ -322,6 +334,7 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
|||||||
params = appendCPUModel(params, config)
|
params = appendCPUModel(params, config)
|
||||||
params = appendQMPSocket(params, config)
|
params = appendQMPSocket(params, config)
|
||||||
params = appendDevices(params, config)
|
params = appendDevices(params, config)
|
||||||
|
params = appendCharDevices(params, config)
|
||||||
params = appendFilesystemDevices(params, config)
|
params = appendFilesystemDevices(params, config)
|
||||||
params = appendObjects(params, config)
|
params = appendObjects(params, config)
|
||||||
params = appendKernel(params, config)
|
params = appendKernel(params, config)
|
||||||
|
Loading…
Reference in New Issue
Block a user