Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix member path in hyperv ZIP #3524

Merged
merged 2 commits into from
Jun 29, 2023
Merged

Fix member path in hyperv ZIP #3524

merged 2 commits into from
Jun 29, 2023

Conversation

bgilbert
Copy link
Contributor

The hyperv ZIP has two problems:

  • The disk image should be at the root of the ZIP archive, but is nested inside a stack of intermediate directories.
  • The disk image should have a .vhdx extension, but has .vhdx.zip instead.

Fix both issues.

@bgilbert bgilbert requested a review from dustymabe June 28, 2023 07:39
@bgilbert
Copy link
Contributor Author

/retest

dustymabe
dustymabe previously approved these changes Jun 28, 2023
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as is - I did have a few questions, though.;

# the compressor embeds the input filename in its output, so
# strip the .gz or .zip suffix from the uncompressed file
uncompressed_path = os.path.splitext(final_img)[0]
os.rename(final_img, uncompressed_path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the

log.info(f"Moving {work_img} to {final_img}")
shutil.move(work_img, final_img)             

from above this feels a bit like musical chairs, but I don't really see a better way.

src/cosalib/qemuvariants.py Outdated Show resolved Hide resolved
src/cosalib/qemuvariants.py Show resolved Hide resolved
gzip and zip both embed the input filename in the output archive, and
we're currently including the compression extension (.gz or .zip) in that
name.  For gzip this is harmless, since gunzip ignores it unless -N is
specified.  For zip (currently used only in hyperv), the member filename
is not ignored during decompression, so the decompressed output claims to
be another ZIP file but isn't.

Fix this by stripping the last filename extension from the uncompressed
file before compressing.
Place the disk image at the root of the ZIP file, skipping its containing
directories.
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bgilbert bgilbert enabled auto-merge (rebase) June 28, 2023 21:29
@openshift-ci
Copy link

openshift-ci bot commented Jun 29, 2023

@bgilbert: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/rhcos 231958b link true /test rhcos

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@bgilbert
Copy link
Contributor Author

The RHCOS test has been timing out lately. Merging over red.

@bgilbert bgilbert disabled auto-merge June 29, 2023 02:07
@bgilbert bgilbert merged commit 8967d3b into coreos:main Jun 29, 2023
2 checks passed
@bgilbert bgilbert deleted the compression branch June 29, 2023 02:08
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