Repository navigation
feat: VM 생성 시 남은 용량이 큰 스토리지로 클론 - #177
Merged
Merged
Conversation
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.env의NODE_{N}_CLONE_STORAGES(쉼표 구분)에 후보를 적은 노드는, 후보 중 사용률 80% 미만이고 VM 디스크(티어 크기)가 들어가는 스토리지에서 남은 용량이 가장 큰 곳을 골라clone.post(storage=...)로 클론 (mon_service.select_clone_storage)storage인자 없음). 대시보드·Discord 리포트는 그대로 합산 표시507, 스토리지 조회 실패503. VMID·IP·DB 기록 전에 선택해서 실패해도 남는 것이 없음. 다른 스토리지로 대체 시도하지 않음_wait_for_clone의HTTPException(클론 실패·타임아웃) 때 DB 레코드만 지우고 Proxmox VM이 남던 문제 수정. 정리 코드를_cleanup_failed_vm_resources로 묶어 두 예외 분기에서 함께 쓰고, VM이 이미 없을 때(does not exist)만 lock 대기·삭제를 건너뜀. 권한·일시 오류면 삭제를 시도_wait_for_clone이 Proxmoxexitstatus원문(스토리지·볼륨 이름 포함 가능)을 사용자 메시지에 넣던 것을 로그로만 남기고 일반 문구로 변경. 스토리지 목록 응답이 리스트가 아니면503RESOURCE_USAGE_THRESHOLD_PCT로 분리해create_vm과 스토리지 선택이 같은 값을 사용create_vm()안에서 하므로 기존 VM 생성 큐(워커 1개)가 순서를 보장. 백엔드가 프로세스 1개로 돈다는 전제SPEC.md(공개 저장소라 운영 정보는 빼고 일반화)Test plan
tests/test_clone_storage.py신규 32개 +test_vm_lifecycle.py·test_vm_policy.py·test_discord_daily_report.py·test_monitoring_rbac.py— 111 passed (Python 3.11, main 기준)ruff check .(CI와 같은 0.15.22) — All checks passedWEB_CONCURRENCY없음 또는 1,--workers없음).env에NODE_3_CLONE_STORAGES설정 후 백엔드 재시작참고
develop → main으로 올리면 같이 배포되므로, 이 브랜치는 main에서 따서 #174의 커밋 7개만cherry-pick했다