Skip to content

Conversation

@darkmuggle
Copy link
Contributor

GCP is picky about the tarball contents. They must:

  • be in a tarball with gzip compression
  • use the Old GNU format
  • be sized correctly
  • members must be sized right

With the new method of generating qemu variant images, CLI tar commands
were replaced with pythonic methods; this produces invalid tarballs from
GCP's perspective. To support GCP, the method of tarball creation is
reverted to using the CLI.

@darkmuggle
Copy link
Contributor Author

@cgwalters
Copy link
Member

cgwalters commented Jan 31, 2020

First let's try to get to a common style here. The general style here before was to have the "topic prefix" not necessarily be the full file path. In this case it actually touches two files.

Maybe just qemuvariants?

Style is also to avoid having a period . at the end.

This style is pretty much the same as the Linux kernel.

IOW, something like:

qemuvariants: Ensure GCP tarball is sparse

GCP is picky about the tarball contents. They must:

- be in a tarball with gzip compression
- use the Old GNU format
- be sized correctly
- members must be sized right

With the new method of generating qemu variant images, CLI tar commands
were replaced with pythonic methods; this produces invalid tarballs from
GCP's perspective. To support GCP, the method of tarball creation is
reverted to using the CLI.

?

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

If you've tested this I'm OK with it but some optional bits.

BASEARCH = get_basearch()

# Default flags for the creation of tarfiles
DEFAULT_TAR_FLAGS = '-Schgh'
Copy link
Member

Choose a reason for hiding this comment

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

Expanding the comment with why we are picking these flags would be useful.

We always want -c, so it seems better to provide that automatically in the

Minor: h is there twice.

tar.add(te, arcname=te_name)
# Python does not create sparse Tarfiles, so we have do it via
# the CLI here.
log.info(f"Preparing tarball {final_img} with flags '{self.tar_flags}'")
Copy link
Member

Choose a reason for hiding this comment

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

Log seems unnecessary since we print the tar command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given the level of logging that we already have, the extra logging seen innocuous.

Removed.

base_name = self.tar_members.pop(0)
tarlist = [base_name]
if base_name != os.path.basename(work_img):
copy_sparse(work_img, os.path.join(self._tmpdir, base_name))
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the circumstances in which this condition fires. Is it something like enforcing a naming scheme for the file inside the tarball? Wouldn't it be a lot cheaper to just make a symlink in that case, since we're passing h to the tar invocation?

Actually at a higher level, it seems like it'd be a lot simpler to me if the builder implementations that used tar_files just each directly called tar as they need to.

Today only gcp and vmware use this AFAICS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR fixes the issue today. I can look at refactoring this out later. The original reason why I put the Tarball functionality here was because of the distaste for OOO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, the latest push includes a comment about when the condition would happen.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don't think we need cp --sparse=always anymore with #1097. The output of qemu-img convert is already sparse. Seems like here we just want os.link() if it's to have the filenames match up? That makes for less IO too. :)

@miabbott
Copy link
Member

miabbott commented Feb 3, 2020

Could you amend the commit message to include the BZ, too?

Comment on lines 29 to 34
# Default flags for the creation of tarfiles
# The default flags were selected because:
# -S: always create a sparse file
# -c: create a new tarball
# -h: derefence symlinks
# -g: handle incremental backups.
# These flags were selected from prior commits for
# tarball creation.
Copy link
Member

@miabbott miabbott Feb 3, 2020

Choose a reason for hiding this comment

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

👍

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Commit message still has a trailing . (also why is "Tarball" capitalized?)

@jlebon
Copy link
Member

jlebon commented Feb 3, 2020

Hmm, from looking at the Jenkins logs, it seems like tar is outputting to stdout? https://jenkins-projectatomic-ci.apps.ci.centos.org/job/coreos-assembler/job/PR-1088/6/console

@darkmuggle
Copy link
Contributor Author

@jlebon it looks like we're running out of space? Any chance you can merge #1097?

lucab pushed a commit to lucab/coreos-assembler that referenced this pull request Feb 4, 2020
```
Colin Walters (3):
      network: Honor MANTLE_SSH_DIR
      kola: Note qemu-unpriv now has networking
      kola: Drop torcx tests

Jakub Čajka (1):
      kola: initial ppc64le support

Stephen Lowrie (15):
      vendor: add aliyun related dependencies
      network/*ssh: Add HostKeyCallback to ClientConfig
      auth: add aliyun auth provider
      platform/api/aliyun: add the aliyun platform
      cmd/ore/aliyun: add image creation related aliyun calls
      docs: add Aliyun platform documentation
      Merge pull request coreos#1066 from arithx/aliyun
      Merge pull request coreos#1081 from cgwalters/ssh-agent-tmpdir
      Merge pull request coreos#1086 from cgwalters/platform-qemu-unpriv-net
      README: update qemu-unpriv notes
      Merge pull request coreos#1087 from cgwalters/kola-prune-cl
      kola/tests: disable additional clustered tests on qemu-unpriv
      Merge pull request coreos#1090 from arithx/disable_tests_on_unpriv
      Merge pull request coreos#1088 from arithx/unpriv_readme
      Merge pull request coreos#1067 from jcajka/ppc64le

Stephen Milner (1):
      Merge pull request coreos#1070 from ashcrow/kola-crio-restart-test

Steve Milner (1):
      kola/tests/crio/crio: Add pods and service restart test
```
@darkmuggle
Copy link
Contributor Author

Okay, it passed when I can changed the location of self._tmpdir to be in the workdir. This can be merged, or we can wait for @jlebon's #1097

@cgwalters cgwalters changed the title cosalib/qemuvariants.py: fix regression in GCP Tarball format. qemuvariants: fix regression in GCP tarball format Feb 4, 2020
Fixes BZ #1796632.

GCP is picky about the tarball contents. They must:
 - be in a tarball with gzip compression
 - use the Old GNU format
 - be sized correctly
 - members must be sized right

With the new method of generating qemu variant images, CLI tar commands
were replaced with pythonic methods; this produces invalid tarballs from
GCP's perspective. To support GCP, the method of tarball creation is
reverted to using the CLI.
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, darkmuggle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [cgwalters,darkmuggle]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cgwalters cgwalters merged commit 30fbac4 into coreos:master Feb 4, 2020
miabbott added a commit to miabbott/installer that referenced this pull request Feb 7, 2020
This bump brings in the change to the default kernel cmdline to use
`ip=dhcp,dhcp6`, which is required for proper bootstrapping of RHCOS
in an IPv6 environment.  (See BZ#1793591)

This also brings in the RHEL 8.1.1 content and a fix for properly
generating GCP images (coreos/coreos-assembler#1088).

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1793591

Signed-off-by: Micah Abbott <[email protected]>
@darkmuggle darkmuggle deleted the pr/fix_gcp branch February 18, 2020 21:48
jcajka pushed a commit to jcajka/coreos-assembler that referenced this pull request Mar 24, 2020
README: update qemu-unpriv notes
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.

5 participants