mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 13:14:33 +00:00
qemu: Add qemu's name to the Config structure
This allows us to set the qemu -name option. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
37a1f5003d
commit
171182709d
13
qemu.go
13
qemu.go
@ -42,6 +42,9 @@ type Config struct {
|
||||
// Ctx is not used at the moment.
|
||||
Ctx context.Context
|
||||
|
||||
// Name is the qemu guest name
|
||||
Name string
|
||||
|
||||
// MachineType is the machine type to be used by qemu.
|
||||
MachineType string
|
||||
|
||||
@ -58,6 +61,15 @@ type Config struct {
|
||||
FDs []*os.File
|
||||
}
|
||||
|
||||
func appendName(params []string, config Config) []string {
|
||||
if config.Name != "" {
|
||||
params = append(params, "-name")
|
||||
params = append(params, config.Name)
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
func appendMachineParams(params []string, config Config) []string {
|
||||
if config.MachineType != "" && config.MachineTypeAcceleration != "" {
|
||||
params = append(params, "-machine")
|
||||
@ -88,6 +100,7 @@ func appendCPUModel(params []string, config Config) []string {
|
||||
func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
||||
var params []string
|
||||
|
||||
params = appendName(params, config)
|
||||
params = appendMachineParams(params, config)
|
||||
params = appendCPUModel(params, config)
|
||||
params = append(params, config.ExtraParams...)
|
||||
|
Loading…
Reference in New Issue
Block a user