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

Add reason to AgentVersionNotSupported condition #7811

Merged

Conversation

raspbeep
Copy link

What this PR does / why we need it:
Add reason to AgentVersionNotSupported condition.

Which issue(s) this PR fixes:
Fixes #7433

Release note:

User now gets information about the type of commands which the guest agent does not support.

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: no Indicates the PR's author has not DCO signed all their commits. size/M labels May 26, 2022
@kubevirt-bot
Copy link
Contributor

Hi @raspbeep. Thanks for your PR.

I'm waiting for a kubevirt member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@kubevirt-bot kubevirt-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 26, 2022
@kubevirt-bot kubevirt-bot requested a review from xpivarc May 26, 2022 12:23
@raspbeep raspbeep force-pushed the AgentVersionNotSupported-add-reason branch from 7759202 to 3cd564e Compare May 26, 2022 12:23
@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels May 26, 2022
return false
basicCommandsUnsupportedReason := "This guest agent doesn't support required basic commands"
log.Log.V(3).Object(vmi).Info(basicCommandsUnsupportedReason)
return false, basicCommandsUnsupportedReason
Copy link
Member

Choose a reason for hiding this comment

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

I think we could always return the reason and we could log it in the place of the caller. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Moved it to the caller function, thanks.

@raspbeep raspbeep force-pushed the AgentVersionNotSupported-add-reason branch from 3cd564e to 6db1334 Compare May 26, 2022 12:46
@raspbeep
Copy link
Author

raspbeep commented Jun 7, 2022

/assign @vladikr

Copy link
Member

@xpivarc xpivarc left a comment

Choose a reason for hiding this comment

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

/approve
/cc @fossedihelm

Expect(result).To(BeTrue())
Expect(reason).To(Equal(""))
Copy link
Member

Choose a reason for hiding this comment

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

nit: You can use BeEmpty

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xpivarc

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 Jun 7, 2022
Copy link
Contributor

@fossedihelm fossedihelm left a comment

Choose a reason for hiding this comment

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

Thanks @raspbeep. Looks good overall! Some comments below.


// For current versions, virt-launcher's supported commands will always contain data.
// For backwards compatibility: during upgrade from a previous version of KubeVirt,
// virt-launcher might not provide any supported commands. If the list of supported
// commands is empty, fall back to previous behavior.
if len(guestInfo.SupportedCommands) > 0 {
supported = isGuestAgentSupported(vmi, guestInfo.SupportedCommands)
supported, reason = isGuestAgentSupported(vmi, guestInfo.SupportedCommands)
log.Log.V(3).Object(vmi).Info(reason)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about moving the log here. I like that is the function itself that prints out the output of its computation, also for future uses; if some other part will use that function it must log the reason too. You can always get the returned value and using it in the VirtualMachineInstanceCondition. Also, you can return the reason only and only if the command is not supported. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I only noticed now that my comment is the opposite of #7811 (comment)
Feel free to adopt the solution you prefer, thanks!

Copy link
Author

@raspbeep raspbeep Jun 7, 2022

Choose a reason for hiding this comment

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

I went for the the version suggested by @xpivarc. Thanks.

Expect(result).To(BeTrue())
Expect(reason).To(Equal(""))
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, currently, isGuestAgentSupported should return "This guest agent is supported" when the result is true, so I think that this should not work. Or maybe am I missing something?
This is valid for all the occurrences below. Thanks

Copy link
Author

Choose a reason for hiding this comment

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

You are right, fixed. Thanks.

@raspbeep raspbeep force-pushed the AgentVersionNotSupported-add-reason branch from 6db1334 to f916c2c Compare June 7, 2022 13:50
@raspbeep
Copy link
Author

raspbeep commented Jun 7, 2022

Also, deleted some forgotten Println in vm_test.go.

}

log.Log.V(3).Object(vmi).Info("This guest agent is supported")
return true
return true, ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Having moved the Log outside of this function you have to return This guest agent is supported, otherwise you will lose a log. I think that here you have 2 ways:

  • leave this return as is, but you have to restore the log inside this function
  • return This guest agent is supported but you have to adjust the tests properly

Copy link
Author

Choose a reason for hiding this comment

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

Fixed, thanks. I chose to always return some reason even if it is This guest agent is supported and adjusted the tests.

Signed-off-by: Pavel Kratochvil <pakratoc@redhat.com>
@raspbeep raspbeep force-pushed the AgentVersionNotSupported-add-reason branch from f916c2c to 28ef53a Compare June 8, 2022 12:17
@fossedihelm
Copy link
Contributor

/ok-to-test

@kubevirt-bot kubevirt-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 8, 2022
@fossedihelm
Copy link
Contributor

/lgtm
/retest

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 9, 2022
@raspbeep
Copy link
Author

raspbeep commented Jun 9, 2022

/retest

@kubevirt-bot
Copy link
Contributor

@raspbeep: 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
pull-kubevirt-fossa 28ef53a link false /test pull-kubevirt-fossa

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.

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

4 similar comments
@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-bot kubevirt-bot merged commit d20a0a7 into kubevirt:main Jun 10, 2022
@xpivarc
Copy link
Member

xpivarc commented Jun 13, 2022

/cherry-pick release-0.53
/cherry-pick release-0.49

@kubevirt-bot
Copy link
Contributor

@xpivarc: new pull request created: #7911

In response to this:

/cherry-pick release-0.53
/cherry-pick release-0.49

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.

@fossedihelm
Copy link
Contributor

/cherry-pick release-0.49

@kubevirt-bot
Copy link
Contributor

@fossedihelm: new pull request created: #7912

In response to this:

/cherry-pick release-0.49

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AgentVersionNotSupported condition doesn't have reason
6 participants