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

Correctly handle NotFound errors during migration #17080

Conversation

enj
Copy link
Contributor

@enj enj commented Oct 28, 2017

This change makes it so that the migrate storage command will now reprocess the body of a failed GET request to follow the standard path of extracting a status error. This normalizes the structure of the errors the code must handle.

When comparing the resource.Info to an error, the info's REST mapping is now used to extract group kind information since the associated runtime.Object is not guaranteed to have valid type meta data. This is combined with relaxed case-insensitive matching to make sure that we only fail the migrate storage command on NotFound errors that we know do not match the info.

When a NotFound error occurs, the migrate command now correctly reports that it did not change the resource. Previously it reported that it had successfully migrated the resource, which is not true since it is impossible to migrate a resource that does not exist.

Bug 1506006

Signed-off-by: Monis Khan [email protected]


Add timestamps to migration command's reporting

This change adds glog style timestamps to the reporting output of the migration tracker. This will aid in debugging migration errors by making it easier to correlate client errors with master logs.

Signed-off-by: Monis Khan [email protected]


/assign @smarterclayton

/kind bug

xref https://bugzilla.redhat.com/show_bug.cgi?id=1506006

@sdodson @jupierce

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 28, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: enj
We suggest the following additional approver: smarterclayton

Assign the PR to them by writing /assign @smarterclayton in a comment when ready.

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 28, 2017
@enj
Copy link
Contributor Author

enj commented Oct 28, 2017

/retest

1 similar comment
@enj
Copy link
Contributor Author

enj commented Oct 28, 2017

/retest

@jupierce
Copy link
Contributor

@enj can this be opened on stage as well?

@@ -49,6 +50,11 @@ func AlwaysRequiresMigration(_ *resource.Info) (Reporter, error) {
return ReporterBool(true), nil
}

// TimeStampNow returns the current time in the same format as glog
func TimeStampNow() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

make this private and add a test, otherwise LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly what should I add a test for?

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a test for your change.

This change makes it so that the migrate storage command will now
reprocess the body of a failed GET request to follow the standard
path of extracting a status error.  This normalizes the structure of
the errors the code must handle.

When comparing the resource.Info to an error, the info's REST
mapping is now used to extract group kind information since the
associated runtime.Object is not guaranteed to have valid type meta
data.  This is combined with relaxed case-insensitive matching to
make sure that we only fail the migrate storage command on NotFound
errors that we know do not match the info.

When a NotFound error occurs, the migrate command now correctly
reports that it did not change the resource.  Previously it reported
that it had successfully migrated the resource, which is not true
since it is impossible to migrate a resource that does not exist.

Bug 1506006

Signed-off-by: Monis Khan <[email protected]>
This change adds glog style timestamps to the reporting output of
the migration tracker.  This will aid in debugging migration errors
by making it easier to correlate client errors with master logs.

Signed-off-by: Monis Khan <[email protected]>
@enj enj force-pushed the enj/i/migrate_not_found_doraw_/1506006 branch from ffe93be to a5b902e Compare November 2, 2017 15:56
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 2, 2017
@enj enj added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Nov 2, 2017
@enj
Copy link
Contributor Author

enj commented Nov 2, 2017

Comments addressed, tagging.

/retest

@enj
Copy link
Contributor Author

enj commented Nov 2, 2017

/test extended_conformance_gce

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit 782e4ab into openshift:master Nov 3, 2017
enj added a commit that referenced this pull request Nov 3, 2017
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants