Skip to content

Commit 2e97ab2

Browse files
authored
Merge pull request #1760 from nanjj/nvramlink
incusd/instance/qemu: Skip to link nvram to itself
2 parents b52dfef + 76bf08b commit 2e97ab2

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
@@ -2243,11 +2243,18 @@ func (d *qemu) setupNvram() error {
22432243
return err
22442244
}
22452245

2246+
nvramPath := d.nvramPath()
2247+
2248+
// Handle the case where the firmware vars filename matches our internal one.
2249+
if efiVarsName == filepath.Base(nvramPath) {
2250+
return nil
2251+
}
2252+
22462253
// Generate a symlink.
22472254
// This is so qemu.nvram can always be assumed to be the EDK2 vars file.
22482255
// The real file name is then used to determine what firmware must be selected.
2249-
_ = os.Remove(d.nvramPath())
2250-
err = os.Symlink(efiVarsName, d.nvramPath())
2256+
_ = os.Remove(nvramPath)
2257+
err = os.Symlink(efiVarsName, nvramPath)
22512258
if err != nil {
22522259
return err
22532260
}

0 commit comments

Comments
 (0)