Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(vmware): probe canonical vSphere 8.0.3 JSON release
pulse-triage[bot]6f301ee8fb16
diff --git a/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.md b/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.mdindex 1ebe769eef..ba6b31abcb 100644--- a/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.md+++ b/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.md@@ -116,7 +116,11 @@ Phase-1 rule:3. saved-connection tests must reuse stored secrets server-side and may acceptan edit overlay payload without requiring masked-secret re-entry4. exhausting the implemented VI JSON release probe floor should classify as- `unsupported_version`, not as a generic endpoint error+ `unsupported_version`, not as a generic endpoint error. Probe canonical+ `8.0.3.0` before the legacy `8.0.3` spelling and older schemas; retain+ compatibility fallback on endpoint failures, but stop on authentication,+ permission, TLS and network failures. Successful negotiation alone does not+ establish optional enrichment compatibility5. connection-test failures must preserve canonical backend `code` plusstring-valued `details` such as `details.category` and `details.error`through the shared browser client so the settings workflow can distinguishdiff --git a/internal/vmware/client.go b/internal/vmware/client.goindex b99d9054e2..a51b4feb23 100644--- a/internal/vmware/client.go+++ b/internal/vmware/client.go@@ -28,7 +28,9 @@ const (inventoryResponseLimitByte = 8 << 20)-var supportedVIJSONReleases = []string{"9.0.0.0", "8.0.3", "8.0.2.0", "8.0.1.0"}+// Prefer the canonical four-component release; retain the legacy spelling+// for endpoints that already accept it before falling back to older schemas.+var supportedVIJSONReleases = []string{"9.0.0.0", "8.0.3.0", "8.0.3", "8.0.2.0", "8.0.1.0"}var featureVMwareEnabled atomic.Booldiff --git a/internal/vmware/client_release_test.go b/internal/vmware/client_release_test.gonew file mode 100644index 0000000000..48620003f6--- /dev/null+++ b/internal/vmware/client_release_test.go@@ -0,0 +1,77 @@+package vmware++import (+ "context"+ "io"+ "net/http"+ "net/url"+ "reflect"+ "strings"+ "testing"+)++type releaseProbeTransport func(*http.Request) (*http.Response, error)++func (f releaseProbeTransport) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }++// #2070 demonstrates method routing at 8.0.3.0. Probe that canonical+// release before the legacy spelling or an older API schema.+func TestVIJSONCanonical803Release(t *testing.T) {+ for _, tc := range []struct {+ name string+ canonicalStatus int+ fallback string+ wantRelease string+ wantCategory string+ wantProbes []string+ }{+ {"canonical", 200, "8.0.2.0", "8.0.3.0", "", []string{"9.0.0.0", "8.0.3.0"}},+ {"legacy", 404, "8.0.3", "8.0.3", "", []string{"9.0.0.0", "8.0.3.0", "8.0.3"}},+ {"older", 500, "8.0.2.0", "8.0.2.0", "", []string{"9.0.0.0", "8.0.3.0", "8.0.3", "8.0.2.0"}},+ {"auth", 401, "8.0.2.0", "", "auth", []string{"9.0.0.0", "8.0.3.0"}},+ {"permission", 403, "8.0.2.0", "", "permission", []string{"9.0.0.0", "8.0.3.0"}},+ } {+ t.Run(tc.name, func(t *testing.T) {+ var probes []string+ transport := releaseProbeTransport(func(r *http.Request) (*http.Response, error) {+ release := strings.Split(r.URL.Path, "/")[3]+ probes = append(probes, release)+ status := http.StatusNotFound+ if release == "9.0.0.0" {+ status = http.StatusInternalServerError+ }+ if release == tc.fallback {+ status = http.StatusOK+ }+ if release == "8.0.3.0" {+ status = tc.canonicalStatus+ }+ body := ""+ if status == http.StatusOK {+ body = `{"sessionManager":{"type":"SessionManager","value":"SessionManager"},"perfManager":{"type":"PerformanceManager","value":"PerfMgr"},"eventManager":{"type":"EventManager","value":"EventManager"}}`+ }+ return &http.Response{StatusCode: status, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: io.NopCloser(strings.NewReader(body)), Request: r}, nil+ })+ base, err := url.Parse("https://vcenter.invalid")+ if err != nil {+ t.Fatal(err)+ }+ client := &Client{baseURL: base, httpClient: &http.Client{Transport: transport}}+ release, refs, err := client.resolveVIJSONRelease(context.Background())+ if tc.wantCategory != "" {+ ce, ok := err.(*ConnectionError)+ if !ok || ce.Category != tc.wantCategory {+ t.Fatalf("error = %v, want %s", err, tc.wantCategory)+ }+ } else if err != nil || refs.PerfManagerMoID != "PerfMgr" {+ t.Fatalf("refs=%+v err=%v", refs, err)+ }+ if release != tc.wantRelease {+ t.Errorf("release=%q want %q", release, tc.wantRelease)+ }+ if !reflect.DeepEqual(probes, tc.wantProbes) {+ t.Errorf("probes=%v want %v", probes, tc.wantProbes)+ }+ })+ }+}