Skip to content

Commit 76bf08b

Browse files
nanjjstgraber
authored andcommitted
incusd/instance/qemu: Handle firmware vars name matching internal one
Signed-off-by: JUN JIE NAN <[email protected]>
1 parent bb7316b commit 76bf08b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/server/instance/drivers/driver_qemu.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -2220,11 +2220,18 @@ func (d *qemu) setupNvram() error {
22202220
return err
22212221
}
22222222

2223+
nvramPath := d.nvramPath()
2224+
2225+
// Handle the case where the firmware vars filename matches our internal one.
2226+
if efiVarsName == filepath.Base(nvramPath) {
2227+
return nil
2228+
}
2229+
22232230
// Generate a symlink.
22242231
// This is so qemu.nvram can always be assumed to be the EDK2 vars file.
22252232
// The real file name is then used to determine what firmware must be selected.
2226-
_ = os.Remove(d.nvramPath())
2227-
err = os.Symlink(efiVarsName, d.nvramPath())
2233+
_ = os.Remove(nvramPath)
2234+
err = os.Symlink(efiVarsName, nvramPath)
22282235
if err != nil {
22292236
return err
22302237
}

0 commit comments

Comments
 (0)