f-28: vms: Add uefi param
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
325f1acff5
commit
ec613996a0
3 changed files with 60 additions and 10 deletions
|
|
@ -2,6 +2,8 @@ package vm
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||
|
|
@ -29,7 +31,7 @@ func StopVM(db *badger.DB, name string, cfg *configuration.Config) error {
|
|||
return err
|
||||
}
|
||||
|
||||
socketPath := fmt.Sprintf("/tmp/%s.qmp-sock", name)
|
||||
socketPath := filepath.Join(cfg.QEMU.QMPDir, name+".sock")
|
||||
|
||||
if _, err := qmp.Send(socketPath, []string{`{"execute":"system_powerdown"}`}); err != nil {
|
||||
return fmt.Errorf("qmp system_powerdown: %w", err)
|
||||
|
|
@ -65,5 +67,10 @@ func StopVM(db *badger.DB, name string, cfg *configuration.Config) error {
|
|||
return fmt.Errorf("delete tap: %w", err)
|
||||
}
|
||||
|
||||
if d.uefi {
|
||||
varsPath := filepath.Join(cfg.QEMU.UEFIVarsDir, name+"-uefi-vars.fd")
|
||||
os.Remove(varsPath)
|
||||
}
|
||||
|
||||
return kv.AddInDB(db, "vm/"+name+"/state", "stopped")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue