mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
qemu: Only one element of qemuPaths map is relevant
The qemuPaths field in qemuArchBase maps from machine type to the default qemu path. But, by the time we construct it, we already know the machine type, so that entry ends up being the only one we care about. So, collapse the map into a single path. As a bonus, the qemuPath() method can no longer fail. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
@@ -41,7 +41,7 @@ type qemuArch interface {
|
||||
machine() govmmQemu.Machine
|
||||
|
||||
// qemuPath returns the path to the QEMU binary
|
||||
qemuPath() (string, error)
|
||||
qemuPath() string
|
||||
|
||||
// kernelParameters returns the kernel parameters
|
||||
// if debug is true then kernel debug parameters are included
|
||||
@@ -137,13 +137,13 @@ type qemuArch interface {
|
||||
|
||||
type qemuArchBase struct {
|
||||
qemuMachine govmmQemu.Machine
|
||||
qemuExePath string
|
||||
memoryOffset uint32
|
||||
nestedRun bool
|
||||
vhost bool
|
||||
disableNvdimm bool
|
||||
dax bool
|
||||
networkIndex int
|
||||
qemuPaths map[string]string
|
||||
kernelParamsNonDebug []Param
|
||||
kernelParamsDebug []Param
|
||||
kernelParams []Param
|
||||
@@ -242,13 +242,8 @@ func (q *qemuArchBase) machine() govmmQemu.Machine {
|
||||
return q.qemuMachine
|
||||
}
|
||||
|
||||
func (q *qemuArchBase) qemuPath() (string, error) {
|
||||
p, ok := q.qemuPaths[q.qemuMachine.Type]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("Unknown machine type: %s", q.qemuMachine.Type)
|
||||
}
|
||||
|
||||
return p, nil
|
||||
func (q *qemuArchBase) qemuPath() string {
|
||||
return q.qemuExePath
|
||||
}
|
||||
|
||||
func (q *qemuArchBase) kernelParameters(debug bool) []Param {
|
||||
|
||||
Reference in New Issue
Block a user