Skip to content

Commit

Permalink
lxd/util/sys: Removes unused GetQemuFwPaths function
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Sep 4, 2024
1 parent 5320114 commit 15e99db
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions lxd/util/sys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
package util

import (
"fmt"
"os"
"path/filepath"
"strings"

"golang.org/x/sys/unix"
Expand Down Expand Up @@ -65,40 +63,3 @@ func ReplaceDaemon() error {

return nil
}

// GetQemuFwPaths returns a list of directory paths to search for QEMU firmware files.
func GetQemuFwPaths() ([]string, error) {
var qemuFwPaths []string

for _, v := range []string{"LXD_QEMU_FW_PATH", "LXD_OVMF_PATH"} {
searchPaths := os.Getenv(v)
if searchPaths == "" {
continue
}

qemuFwPaths = append(qemuFwPaths, strings.Split(searchPaths, ":")...)
}

// Append default paths after ones extracted from env vars so they take precedence.
qemuFwPaths = append(qemuFwPaths, "/usr/share/OVMF", "/usr/share/seabios")

count := 0
for i, path := range qemuFwPaths {
var err error
resolvedPath, err := filepath.EvalSymlinks(path)
if err != nil {
// don't fail, just skip as some search paths can be optional
continue
}

count++
qemuFwPaths[i] = resolvedPath
}

// We want to have at least one valid path to search for firmware.
if count == 0 {
return nil, fmt.Errorf("Failed to find a valid search path for firmware")
}

return qemuFwPaths, nil
}

0 comments on commit 15e99db

Please sign in to comment.