fix(vaccel): don't ignore vsock environment setup errors in Exec

Aperta Adatta ai principianti
#1,187 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Inizia da Exec() in pkg/unikontainers/unikontainers.go:653-656 e leggi prepareVSockEnvironment() in pkg/unikontainers/vaccel.go:111-131 per vedere come vengono restituiti gli errori di configurazione. Il lavoro è completato quando un errore di configurazione interrompe l’avvio del container con un errore chiaro, invece di essere registrato e ignorato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

In Exec(), the error returned by prepareVSockEnvironment() is only logged at Debug level and execution continues. vAccel stays enabled (vmmArgs.VAccelType = "vsock"), so the monitor is still launched with vsock devices/sockets that were never set up in the monitor rootfs.

Related to #698 / #699, which fixed the same Debug-only logging for the resolveVAccelConfig() call a few lines above, but not for prepareVSockEnvironment().

Location

pkg/unikontainers/unikontainers.go:653-656

vaccelDevices, err := prepareVSockEnvironment(rootfsParams.MonRootfs, u.State.Annotations[annotHypervisor], vsockSocketPath)
if err != nil {
    uniklog.Debugf("failed to prepare get required vsock devices: %v", err)
}
Current behavior

prepareVSockEnvironment() (pkg/unikontainers/vaccel.go:111-131) returns an error when /dev/vsock or /dev/vhost-vsock is missing on the host (e.g. vhost_vsock not loaded), or when the Firecracker socket bind mount fails. In that case:

  • The error is only visible at debug log level, and the message has a typo ("prepare get required").
  • vaccelDevices is nil, so setupDevices() has nothing to create and returns nil.
  • vmmArgs.VAccelType is still set to "vsock", so the monitor receives -device vhost-vsock-pci (QEMU), a vsock config entry (Firecracker) or --vsock (Cloud Hypervisor) for devices that do not exist in its rootfs.

The container start then fails later inside the monitor (e.g. QEMU cannot open the vhost device) with an error that does not mention the real cause, which is only visible at debug log level.

Expected behavior

If vAccel was requested and validated, a failure to prepare its vsock environment should abort the container start with a clear error, e.g.:

failed to prepare vAccel vsock environment: could not get host device /dev/vhost-vsock: no such file or directory
Steps to reproduce
  1. Use a host where /dev/vhost-vsock is missing (modprobe -r vhost_vsock).
  2. Run a QEMU-based unikernel with the annotations com.urunc.unikernel.vAccel=vsock and com.urunc.unikernel.RPCAddress=vsock://2:2048.
  3. At the default info log level nothing mentions the missing device; the start fails later inside QEMU with an unrelated-looking error.
Proposed fix

Return the error instead of logging it at Debug, and fix the message:

if err != nil {
    return fmt.Errorf("failed to prepare vAccel vsock environment: %w", err)
}

If you would rather continue without vAccel in this case, the alternative is to Warn and skip setting VAccelType, VSockDevPath and VSockDevID. Happy to go with whichever you prefer.

I'd like to work on this.

Lingua principale
Go
Stelle
308
Fork
222
Merge medio
2g 12h
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di urunc-dev/urunc

Tutte le issue di urunc-dev/urunc

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.