Skip to content

fix(gcp): improve ListImage lookup to include non-default project images - #1797

Merged
cb-spider merged 5 commits into
cloud-barista:masterfrom
MZC-CSC:upstream-fix/gcp-image-list-1184
Aug 13, 2026
Merged

fix(gcp): improve ListImage lookup to include non-default project images#1797
cb-spider merged 5 commits into
cloud-barista:masterfrom
MZC-CSC:upstream-fix/gcp-image-list-1184

Conversation

@dogfootman

Copy link
Copy Markdown
Contributor

Summary

Addresses #1184ListImage/GetImage on GCP only searched a limited set of projects, so images outside that set (e.g. some public/marketplace images) could not be looked up. Three incremental changes:

  • Enable the NOT deprecated filter on ListImage to cut latency
  • Split the image project list into standard/extended groups
  • Fetch the extended image group by family instead of a full list, keeping the added coverage without a large latency regression

Test plan

  • Verified against live GCP: image lookups that previously failed for non-default-project images now resolve
  • Confirmed ListImage latency stays comparable to before the change

Ubuntu added 3 commits August 10, 2026 01:42
deeplearning-platform-release alone returned 26k+ deprecated image
versions, making ListImage() take ~95s. Activating the filter that
was already written but never applied drops it to ~20s (47546 -> 246
images), matching the risk flagged in issue cloud-barista#1184.
Splits arrImageProjectList into arrStandardImageProjectList (general OS)
and arrExtendedImageProjectList (GPU/HPC/ML, the group responsible for
most of ListImage()'s latency), and extracts the per-project fetch loop
into listImagesByProject() so each group can be called independently.

Pure structural change: verified the returned image set and order are
byte-for-byte identical to pre-refactor output (246/246 images, same
set, same order) against a live GCP account. Sets up cb-spider#1184
Stage 2, which will swap the extended group to family-based lookups.
Images.List() on GPU/HPC/ML projects (deeplearning-platform-release
etc.) forces GCP to scan the project's entire image history server
side even with the deprecated filter. Replaces that with a curated
project->family map resolved via Images.GetFromFamily(), fetched in
parallel (same pattern as RegionZoneHandler.ListRegionZone()).

A sequential first pass was slower than the List()-based baseline
(31.5s vs 23.8s, 48 individual round trips add up); parallelizing
brought it to 12.6s. A missing/retired family is skipped best-effort
rather than failing the whole call, since this list is a
hand-maintained catalog rather than raw GCP data.

Verified against a live GCP account: same 246-image result set as the
List()-based baseline, standard group order unchanged, extended group
is the same 48 images as a set (internal order differs, expected since
it's a different retrieval strategy). Completes the 3-stage plan for
cb-spider#1184 (Stage 1: #196, Stage 3: #197).
@github-actions

Copy link
Copy Markdown

Could you please check and revise Korean texts?
Note - All output of print and log statements should be in English. 😉

cloud-control-manager/cloud-driver/drivers/gcp/resources/ImageHandler.go

18:+// "OS+가속기 조합"당 하나뿐이라 목록 자체는 작음(2026-08-07 기준 5개 프로젝트 합계 48개).
20:+// "최신 활성 이미지 1건"만 직접 조회 — GCP가 매번 프로젝트의 전체 이미지 이력을 스캔하지
98:+	// family 기반으로 "최신 활성 이미지 1건씩"만 직접 조회(cb-spider#1184 Stage 2).
121:+// 등록된 family(projectFamilyMap)마다 Images.GetFromFamily()로 "최신 활성 이미지 1건"만

Per review feedback on PR cloud-barista#1797: print/log statements and source
comments should be in English.
@cb-spider

Copy link
Copy Markdown
Collaborator

@dogfootman


  • 성능 대폭 개선 등 좋은 제안에 캄사드립니다.

  • 다만, {Project,Family} 기반 Image 검색의 전제조건인 Family Name이

    • 고정된 Family 목록이라는 점이 고민스럽습니다.
    • 신규 CUDA 등의 Family가 출시되어도 누군가 코드 반영하지 않는 한 알수가 없으니...
    • (물론, 고정된 Project 목록도 잠재적인 이슈긴 하지만, 현재도 제공하는 API가 없네요.)
  • 혹시, 개선 내용 중 {Project,Family} 기반 Image 검색 부분만

    • 기존 방식 {Project} 기반 Image fetch 방식으로 원복해도
    • 동작 상에 문제가 없다면 원복하는 것은 어찌 생각하시는 지요?
  • 현재, image 목록 제공은 시간은 오래 걸려도

    • 최신 정보를 제공하는 것이 우선일 것 같아 의견 드립니다.
    • 참고: Azure: 거의 1시간 소요

b78050c (built on 6ee5155) replaced the extended (GPU/HPC/ML) group's
Images.List() scan with per-family Images.GetFromFamily() lookups
against a hardcoded arrExtendedImageFamilyMap, to cut ListImage()
latency. That map is a snapshot of family names known at write time:
GCP can add a new family at any point, and nothing here would notice.

Review feedback on PR cloud-barista#1797 flagged exactly this. GetImage(imageIID),
GetImageN(imageName) and GetImageByUrl all resolve images directly via
Images.Get()/Images.List() and don't depend on the family map, so an
unmapped family is still technically fetchable by name or URL. But
this driver's normal usage pattern is ListImage() -> take an ImageIID
from the result -> GetImage(imageIID), so anything missing from
ListImage()'s output is undiscoverable in practice. Catalog
correctness outweighs the latency win here.

Restores ImageHandler.go to 5f842b5's version: a single
arrImageProjectList and a plain per-project
Images.List(projectId).Filter("NOT deprecated:*") scan for every
project, standard and extended alike. Drops
arrStandardImageProjectList, arrExtendedImageProjectList,
arrExtendedImageFamilyMap, listImagesByProject() and
listImagesByFamily(), which existed only to support the family-based
path (6ee5155's own message: "Sets up cb-spider#1184 Stage 2").
Re-translates the one Korean comment 5f842b5 still carried, per the
existing English-only comment convention on this branch.

cb-spider#1184
@dogfootman

Copy link
Copy Markdown
Contributor Author

@cb-spider

말씀하신 우려 확인했고, 반영했습니다.

GetImage(imageIID) / GetImageN() / GetImageByUrl은 Images.Get()을 직접 호출하기 때문에 arrExtendedImageFamilyMap에 의존하지 않아 문제가 없습니다. 하지만 실제 사용 패턴은 ListImage() → 원하는 ImageIID 선택 → GetImage(ImageIID) 흐름이라, ListImage()에서 빠지는 이미지는 애초에 선택지에 오르지 못합니다. 즉 신규 family가 목록에 등록되지 않으면 조용히 누락되는 구조라, 말씀하신 리스크가 실제로 컸습니다.

{Project,Family} 기반 조회 부분을 되돌리고, 이전의 {Project} 기반 전체 스캔 방식(NOT deprecated:* 필터는 유지)으로 원복했습니다.

꼼꼼한 리뷰 감사합니다.

@cb-spider

Copy link
Copy Markdown
Collaborator

@dogfootman

  • 개선 캄사드립니다.

@cb-spider
cb-spider merged commit 3ce1d68 into cloud-barista:master Aug 13, 2026
3 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.

[GCP] How can a user lookup a vm image which is not in the image list

3 participants