still fixing UI issue
Some checks failed
CI / test-build (push) Has been cancelled

This commit is contained in:
2025-12-18 12:41:51 +07:00
parent d55206af82
commit 8b5183d98a
3 changed files with 56 additions and 36 deletions

View File

@@ -7,6 +7,7 @@ import (
"net/http"
"strconv"
"strings"
"time"
"gitea.avt.data-center.id/othman.suseno/atlas/internal/auth"
"gitea.avt.data-center.id/othman.suseno/atlas/internal/errors"
@@ -78,14 +79,21 @@ func (a *App) handleCreatePool(w http.ResponseWriter, r *http.Request) {
err := a.zfs.CreatePool(req.Name, req.VDEVs, req.Options)
// Always check if pool exists, even if creation reported an error
// Sometimes pool is created despite errors (e.g., mountpoint issues)
// CRITICAL: Always check if pool exists, regardless of reported error
// ZFS often reports mountpoint errors but pool is still created
// Wait a brief moment for pool to be fully registered
time.Sleep(200 * time.Millisecond)
pool, getErr := a.zfs.GetPool(req.Name)
if getErr == nil {
// Pool exists - return success even if creation reported an error
// Pool exists - this is success!
if err != nil {
log.Printf("create pool reported error but pool exists: %v", err)
log.Printf("info: pool %s created successfully despite reported error: %v", req.Name, err)
}
// Set cache-control headers
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
writeJSON(w, http.StatusCreated, pool)
return
}