feat: show golden VM tag in clone list, add console logging, fix ubuntu boot

- Persist golden VM tag to clones/{id}/tag at spawn time
- GET /clones now returns [{id, tag}] objects instead of plain IDs
- Web UI renders tag as a dim label next to each clone entry (clone 3 · default)
- Pre-existing fixes included in this commit:
  - console: tee all PTY output to clones/{id}/console.log for boot capture
  - network: destroy stale tap before recreating to avoid EBUSY errors
  - orchestrator: fix ubuntu systemd boot (custom fc-console.service, fstab,
    mask serial-getty udev dep, longer settle time, correct package list)
  - config: remove quiet/loglevel=0 from default boot args

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 22:04:11 +00:00
parent fb1db7c9ea
commit d0da012a82
6 changed files with 95 additions and 31 deletions

View File

@@ -49,9 +49,9 @@ func Serve(orch *Orchestrator, addr string) error {
mux.HandleFunc("/clones", func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet, "":
ids := runningCloneIDs(orch.cfg)
clones := runningClones(orch.cfg)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(ids) //nolint:errcheck
json.NewEncoder(w).Encode(clones) //nolint:errcheck
case http.MethodPost:
// Optional JSON body: {"net": bool, "tag": string}
// Defaults to the server's FC_AUTO_NET_CONFIG setting.
@@ -215,14 +215,19 @@ func bridgeWS(ws *websocket.Conn, consoleConn net.Conn, resizeConn net.Conn) {
<-sockDone
}
// runningCloneIDs returns clone IDs that have a live console socket.
func runningCloneIDs(cfg Config) []int {
type cloneEntry struct {
ID int `json:"id"`
Tag string `json:"tag"`
}
// runningClones returns entries for clones that have a live console socket.
func runningClones(cfg Config) []cloneEntry {
clonesDir := filepath.Join(cfg.BaseDir, "clones")
entries, err := os.ReadDir(clonesDir)
if err != nil {
return nil
}
var ids []int
var clones []cloneEntry
for _, e := range entries {
if !e.IsDir() {
continue
@@ -232,11 +237,16 @@ func runningCloneIDs(cfg Config) []int {
continue
}
sock := filepath.Join(clonesDir, e.Name(), "console.sock")
if _, err := os.Stat(sock); err == nil {
ids = append(ids, id)
if _, err := os.Stat(sock); err != nil {
continue
}
tag := "unknown"
if raw, err := os.ReadFile(filepath.Join(clonesDir, e.Name(), "tag")); err == nil {
tag = strings.TrimSpace(string(raw))
}
clones = append(clones, cloneEntry{ID: id, Tag: tag})
}
return ids
return clones
}
func writeWSError(ws *websocket.Conn, msg string) {