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

Ignore VMIs from backup when owner VMs are excluded #273

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

alromeros
Copy link
Contributor

What this PR does / why we need it:

This Pull Request aims to update the backup process for VMIs so that when the VMI is owned by a VM excluded from the backup, we also exclude the VMI without triggering an error.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes # https://issues.redhat.com/browse/CNV-45094

Special notes for your reviewer:

Release note:

Bugfix: Ignore VMIs from backup when owner VM is excluded

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Aug 14, 2024
@kubevirt-bot kubevirt-bot requested review from aglitke and awels August 14, 2024 16:19
This commit updates the backup process for VMIs so, when the VMI is owned by a VM that's excluded from the backup, we also exclude the VMI without triggering an error.

Signed-off-by: Alvaro Romero <[email protected]>
@@ -79,6 +79,15 @@ func (p *VMIBackupItemAction) Execute(item runtime.Unstructured, backup *v1.Back
return nil, nil, errors.WithStack(err)
}

// There's no point in backing up a VMI when it's owned by a VM excluded from the backup
Copy link
Contributor

Choose a reason for hiding this comment

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

why not call this code under "isVMIOwned(vmi)" and then remove the ownership check from shouldExcludeVMI?
i.e put this in replace of the code you deleted
(then you will not need to update the irrelevant UT)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this to avoid triggering an error (for example, if launcher pod is excluded) if we eventually want to ignore the VMI. I like to have this as a self-contained check before doing anything else.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@@ -2129,7 +2157,7 @@ var _ = Describe("Resource excludes", func() {
Expect(err).ToNot(HaveOccurred())
})

It("[test_id:10227]Running VM excluded: backup should fail", func() {
It("[test_id:10227]Running VM excluded: empty backup without failure", func() {
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 all the tests now are pretty similar and all the other cases UT is enough. I'm in favor of keeping only this test and delete all the rest that you changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, I'd leave maybe two tests and delete the other two. I'm always hesitant to delete func tests though.

Copy link
Contributor Author

@alromeros alromeros Aug 26, 2024

Choose a reason for hiding this comment

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

Also, are we ok with deleting tests with test id?

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 we have too many functional tests in this repo lol
And a lot of them are some edge cases which I dont think really interest anyone.. dont think it matters if it has test_id, just maybe the QE will need to take note that this tests are removed (same as to change the behavior of those you modified)

This commit updates the functional tests to match the new behavior where we ignore the VMI backup if its owner is excluded from the backup.

Signed-off-by: Alvaro Romero <[email protected]>
Copy link
Contributor

@ShellyKa13 ShellyKa13 left a comment

Choose a reason for hiding this comment

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

/lgtm

@@ -79,6 +79,15 @@ func (p *VMIBackupItemAction) Execute(item runtime.Unstructured, backup *v1.Back
return nil, nil, errors.WithStack(err)
}

// There's no point in backing up a VMI when it's owned by a VM excluded from the backup
Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 27, 2024
@ShellyKa13
Copy link
Contributor

ShellyKa13 commented Aug 27, 2024

@mhenriks can you take a look and approve if looks ok to you?

@mhenriks
Copy link
Member

/approve

@kubevirt-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mhenriks

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2024
@kubevirt-bot kubevirt-bot merged commit 0d6f71e into kubevirt:main Aug 29, 2024
5 checks passed
@alromeros
Copy link
Contributor Author

/cherrypick release-v0.7

1 similar comment
@alromeros
Copy link
Contributor Author

/cherrypick release-v0.7

@kubevirt-bot
Copy link

@alromeros: new pull request created: #314

In response to this:

/cherrypick release-v0.7

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-sigs/prow 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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants