Skip to content

Preview images by default, require --upload#1251

Open
jklare wants to merge 2 commits into
mainfrom
preview-by-default-require-upload
Open

Preview images by default, require --upload#1251
jklare wants to merge 2 commits into
mainfrom
preview-by-default-require-upload

Conversation

@jklare

@jklare jklare commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Running openstack-image-manager (and osism manage images, which wraps it) previously imported images immediately when invoked without arguments. This meant the default action changed the cloud (uploading images and running outdated-image management) and required a working OpenStack connection just to see what the tool would do.

This change makes the default a safe, local-only preview. Without --upload the tool now:

  • lists the images that would be uploaded,
  • shows the total download size and a rough time estimate,
  • prints the exact command to actually perform the upload, and
  • links to the documentation.

It does not connect to OpenStack and makes no changes. Passing --upload restores the previous import and cleanup behaviour; --dry-run continues to work within that path.

Details

  • The preview is derived purely from the local image definitions, honouring the same enable/force/filter rules as a real run as well as --latest for images of type multi, and prefers mirror_url over url.
  • Download sizes are determined via HTTP HEAD requests (or the local filesystem for file: URLs); the time estimate assumes a rough 10-30 MB/s throughput range and is intentionally vague.

Example:

The following 2 image(s) would be uploaded:

  Ubuntu 24.04 (20260108)
  Ubuntu 24.04 Minimal (20260105)

Total download size: ~1.8 GiB
Estimated upload time: ~1-3 min (rough estimate, actual time depends on network and Glance backend)

No changes have been made. To actually upload these images, run:

  openstack-image-manager --upload --images etc/images/ubuntu.yml --latest

For more information and options, see:
  https://osism.tech/docs/guides/operations-guide/openstack/tools/image-manager/

Breaking change

This is a clean break: automation relying on the implicit upload must now pass --upload. The Zuul integration test is updated accordingly.

Important

The osism manage images wrapper lives in the osism/osism repository and must be updated there separately to pass --upload.

Testing

  • flake8 clean
  • Full unit suite passes (33 tests), including new tests for the preview helpers and an assertion that the preview never connects to OpenStack.

Running openstack-image-manager (and "osism manage images", which
wraps it) previously imported images immediately when invoked without
arguments. This meant the default action changed the cloud (uploading
images and running outdated-image management) and required a working
OpenStack connection just to see what the tool would do.

Make the default a safe, local-only preview instead. Without --upload
the tool now lists the images that would be uploaded, shows the total
download size and a rough time estimate, prints the exact command to
perform the upload, and links to the documentation. It does not
connect to OpenStack and makes no changes. Passing --upload restores
the previous import and cleanup behaviour; --dry-run continues to work
within that path.

The preview is derived purely from the local image definitions,
honouring the same enable/force/filter rules as a real run as well as
--latest for images of type multi, and prefers mirror_url over url.
Download sizes are determined via HTTP HEAD requests (or the local
filesystem for file: URLs); the time estimate assumes a rough
10-30 MB/s throughput range and is intentionally vague.

This is a clean break: automation relying on the implicit upload must
now pass --upload. The Zuul integration test is updated accordingly.
The osism manage images wrapper lives in the osism/osism repository
and must be updated there separately to pass --upload.

DocImpact
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jan Klare <klare@osism.tech>
@jklare

jklare commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Only unit tests were run so far, so this needs to be verified against a testbed before it can be merged.

mypy could not prove that the size-formatting loop always returns,
because the guaranteed exit relied on the final list element rather
than on a statement it could see. Iterate over the smaller units only
and return the TiB case unconditionally after the loop so the function
provably returns a str on every path.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jan Klare <klare@osism.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants