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

Bug 1972572: Fix image incompatibility between 4.7 and 4.8 while upgrade #48

Merged

Conversation

ardaguclu
Copy link
Member

@ardaguclu ardaguclu commented Jun 15, 2021

Upgrade from 4.7 to 4.8 jobs are consuming huge disk space. Because 4.8 uses image caching mechanism and 4.7 not, that's why, 4.8 always downloads same image. To prevent this, this PR adds check and return if the image already exist. This not only saves disk usage but also reduces upgrade duration.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2021
get-resource.sh Outdated Show resolved Hide resolved
@stbenjam
Copy link
Member

/test e2e-metal-ipi-upgrade

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2021

@stbenjam: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test e2e-metal-ipi
  • /test e2e-metal-ipi-ovn-dualstack
  • /test e2e-metal-ipi-ovn-ipv6
  • /test e2e-metal-ipi-serial-ipv4
  • /test e2e-metal-ipi-virtualmedia
  • /test images

Use /test all to run the following jobs:

  • pull-ci-openshift-ironic-rhcos-downloader-master-e2e-metal-ipi
  • pull-ci-openshift-ironic-rhcos-downloader-master-e2e-metal-ipi-ovn-ipv6
  • pull-ci-openshift-ironic-rhcos-downloader-master-e2e-metal-ipi-serial-ipv4
  • pull-ci-openshift-ironic-rhcos-downloader-master-images

In response to this:

/test e2e-metal-ipi-upgrade

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.

@ardaguclu ardaguclu changed the title WIP: Add return if there is already image WIP: Bug 1972572: Add return if there is already image Jun 16, 2021
@openshift-ci openshift-ci bot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jun 16, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 16, 2021

@ardaguclu: This pull request references Bugzilla bug 1972572, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (augol@redhat.com), skipping review request.

In response to this:

WIP: Bug 1972572: Add return if there is already image

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.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 16, 2021

@ardaguclu: This pull request references Bugzilla bug 1972572, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (augol@redhat.com), skipping review request.

In response to this:

WIP: Bug 1972572: Add return if there is already image

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.

get-resource.sh Outdated
# Added to fix image path incompatibility between 4.7 and 4.8
# as filed in https://bugzilla.redhat.com/show_bug.cgi?id=1972572
if [[ -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_COMPRESSED.md5sum" && ! -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_CACHED.md5sum" ]]; then
exit 0
Copy link
Contributor

@hardys hardys Jun 16, 2021

Choose a reason for hiding this comment

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

I guess this will work, but would it be better to move $RHCOS_IMAGE_FILENAME_COMPRESSED to $RHCOS_IMAGE_FILENAME_CACHED - then the filenames become consistent after upgrade (e.g same as a freshly installed 4.8 cluster)?

Also that would mean that eventually we can remove the workaround and simplify the script (hopefully reducing the chances of more issues like this...

Copy link
Member Author

@ardaguclu ardaguclu Jun 16, 2021

Choose a reason for hiding this comment

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

Thanks @hardys.

Do you mean by workaround this change or this one;

if [[ ${RHCOS_IMAGE_FILENAME_QCOW} == *"-openstack"* ]] ; then

Because if we rename files, above workaround seems needs to be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm wrong, that does not need to be removed.

I'll change according to your suggestions.

@ardaguclu ardaguclu changed the title WIP: Bug 1972572: Add return if there is already image Bug 1972572: Add return if there is already image Jun 16, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 16, 2021
@ardaguclu
Copy link
Member Author

/test e2e-metal-ipi-ovn-ipv6

@zaneb
Copy link
Member

zaneb commented Jun 16, 2021

/approve

Copy link
Member

@zaneb zaneb left a comment

Choose a reason for hiding this comment

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

Ah, it's line 93 causing the disk space leak:

mv $TMPDIR $RHCOS_IMAGE_FILENAME_QCOW

Once the $RHCOS_IMAGE_FILENAME_QCOW directory exists, instead of renaming $TMPDIR it just moves it into that directory and leaves it there forever.

get-resource.sh Outdated

# Added to fix image path incompatibility between 4.7 and 4.8
# as filed in https://bugzilla.redhat.com/show_bug.cgi?id=1972572
if [[ -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_COMPRESSED.md5sum" && ! -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_CACHED.md5sum" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

We ought to check that -openstack is in the name (as on line 101) otherwise this will do the Wrong Thing if it isn't. AFAIK it always is today, but the whole goal of the patch that messed everything up was to make it not required any more, so we might as well at least get that benefit.

Copy link
Member

Choose a reason for hiding this comment

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

Note that this prevents the problem, but does not allow us to recover from the problem if a buggy version of this script has already been run.

If this is not a blocker for 4.8 then I think we need to also remove the directory /shared/html/images/${RHCOS_IMAGE_FILENAME_QCOW} if it exists around line 91.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @zaneb, I made changes you suggested.

if [[ -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_COMPRESSED.md5sum" && ! -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_CACHED.md5sum" ]]; then
cd /shared/html/images
mv "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_COMPRESSED.md5sum" "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_CACHED.md5sum"
mv "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_COMPRESSED" "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_CACHED"
Copy link
Member

Choose a reason for hiding this comment

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

Fun fact: this means that on an upgraded cluster we won't edit the kernel command line to add ip=dhcp[6], whereas before we accidentally were. Is that OK?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good point, I think we have to discuss.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think these dual-stack problems started as a result of RHCOS moving from the network-legacy to network-manager dracut modules, which introduced a slight change in behavior meaning that the protocol chosen depends on a race between the two DHCP servers.

Looking at the coreos config it seems this change happened several releases ago, but presumably the support status of dual-stack meant it wasn't noticed.

@dustymabe can you confirm which RHCOS versions will be using NM in the ramdisk?

I think we may want to handle this on upgrade, and also backport the kernel commandline fix to previous releases, but that can probably be considered outside the scope of this PR, given that the commandline fix only currently exists on 4.8+ ?

/cc @sadasu @honza

Copy link
Member

Choose a reason for hiding this comment

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

After sleep, it occurs to me that this PR is our best chance to fix this for those upgrading to 4.8, because at this point in the code we know we are dealing with a non-modified qcow. After the rename that happens here, we will have to go spelunking in the image to determine if it has been modified. (We're already doing it twice in the image cache and that's bad enough.)

OTOH, we will need to do the spelunking thing in 4.7 anyway.

Copy link
Member

Choose a reason for hiding this comment

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

@dustymabe can you confirm which RHCOS versions will be using NM in the ramdisk?

4.6 and newer.

@ardaguclu
Copy link
Member Author

/test e2e-metal-ipi

@ardaguclu
Copy link
Member Author

/test e2e-metal-ipi-serial-ipv4

1 similar comment
@ardaguclu
Copy link
Member Author

/test e2e-metal-ipi-serial-ipv4

@openshift-ci openshift-ci bot requested review from honza and sadasu June 17, 2021 11:21
Copy link
Contributor

@sadasu sadasu left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2021
@ardaguclu ardaguclu changed the title Bug 1972572: Add return if there is already image Bug 1972572: Fix image incompatibility between 4.7 and 4.8 while upgrade Jun 17, 2021
Copy link
Member

@zaneb zaneb left a comment

Choose a reason for hiding this comment

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

This PR looks good, but I'm thinking we might want to do the kernel command line changes at the same time.

if [[ -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_COMPRESSED.md5sum" && ! -s "/shared/html/images/$RHCOS_IMAGE_FILENAME_QCOW/$RHCOS_IMAGE_FILENAME_CACHED.md5sum" ]]; then
cd /shared/html/images
mv "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_COMPRESSED.md5sum" "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_CACHED.md5sum"
mv "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_COMPRESSED" "${RHCOS_IMAGE_FILENAME_QCOW}/$RHCOS_IMAGE_FILENAME_CACHED"
Copy link
Member

Choose a reason for hiding this comment

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

After sleep, it occurs to me that this PR is our best chance to fix this for those upgrading to 4.8, because at this point in the code we know we are dealing with a non-modified qcow. After the rename that happens here, we will have to go spelunking in the image to determine if it has been modified. (We're already doing it twice in the image cache and that's bad enough.)

OTOH, we will need to do the spelunking thing in 4.7 anyway.

@zaneb
Copy link
Member

zaneb commented Jun 17, 2021

After discussion, we're going to get this in and worry about backporting the dual-stack fix to multiple releases later.
/approve

@hardys
Copy link
Contributor

hardys commented Jun 17, 2021

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, hardys, sadasu, zaneb

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2021
@openshift-merge-robot openshift-merge-robot merged commit a161553 into openshift:master Jun 17, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2021

@ardaguclu: All pull requests linked via external trackers have merged:

Bugzilla bug 1972572 has been moved to the MODIFIED state.

In response to this:

Bug 1972572: Fix image incompatibility between 4.7 and 4.8 while upgrade

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.

@ardaguclu
Copy link
Member Author

/cherry-pick release-4.8

@openshift-cherrypick-robot

@ardaguclu: new pull request created: #51

In response to this:

/cherry-pick release-4.8

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants