Skip to content

fix(admin): show live OpenStack instance status instead of stale DB value#78

Merged
jisung-02 merged 2 commits into
mainfrom
fix/admin-live-instance-status
Jun 8, 2026
Merged

fix(admin): show live OpenStack instance status instead of stale DB value#78
jisung-02 merged 2 commits into
mainfrom
fix/admin-live-instance-status

Conversation

@jisung-02

Copy link
Copy Markdown
Contributor

개요

어드민 대시보드에서 며칠 전 생성한 인스턴스가 계속 "생성 중(BUILD)”으로 표시되던 버그 수정.

원인

어드민 API는 DB에 저장된 status를 그대로 노출했는데, 이 값은 인스턴스 생성 시 한 번("BUILD") 기록되고 이후 어디서도 갱신되지 않음. 반면 일반 Compute 화면은 OpenStack을 실시간 조회해 srv.Status를 사용하므로 정상 표시됨. 즉 어드민만 stale한 DB 값을 보여주고 있었음.

수정

어드민도 일반 Compute와 동일하게 라이브 OpenStack 상태를 overlay.

  • instanceStatusSource 인터페이스 추가, 기존 compute.Client를 재사용
    (단일 OpenStack
    프로젝트라 servers.List 한 번으로 전 유저 인스턴스 커버, 같은
    provider 재사용)
  • Instances / Instance / UserResources에서 DB 조회 후 라이브 상태로
    덮어씀
  • best-effort: 라이브 fetch 실패 시 DB 값으로 폴백 → OpenStack 일시
    장애가 어드민 전체를 깨지 않음

변경 파일

  • internal/domain/admin/instance_status.go (신규) — compute.Client 기반 라이브 상태 소스
  • internal/domain/admin/service.go — overlay 로직
  • internal/domain/admin/init.goWithLiveInstanceStatusSource 옵션
  • internal/server/app.go — provider 와이어링
  • internal/domain/admin/handler_test.go — 회귀 테스트

jisung-02 added 2 commits June 7, 2026 10:55
…alue

Admin dashboard read the persisted instance status from the DB, which is
written once at creation ("BUILD") and never refreshed, so instances showed
"생성 중" indefinitely. The user-facing compute views already overlay the
live OpenStack status; admin now does the same.

Adds an instanceStatusSource backed by the existing compute.Client (single
OpenStack project, so one servers.List covers every user's instances) and
overlays live status in admin Instances/Instance/UserResources. Best-effort:
falls back to the DB value when the live fetch fails so a single OpenStack
hiccup never breaks the whole admin dashboard.
The overlay logic lives in the service, so test it by calling the service
methods directly instead of routing through the gin stack, auth middleware,
and JSON round-trip (endpoint authz is already covered elsewhere). Adds
createTestUser/createTestInstance helpers to drop duplicated setup.
@jisung-02 jisung-02 force-pushed the fix/admin-live-instance-status branch from 12a1d4d to 1a7c9da Compare June 7, 2026 02:06
@jisung-02 jisung-02 self-assigned this Jun 7, 2026
@jisung-02 jisung-02 requested a review from qixiangme June 7, 2026 02:06
@jisung-02 jisung-02 merged commit ead4e8a into main Jun 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants