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

Detect and report an ErrorPvcNotFound/ErrorDataVolumeNotFound VM status #6171

Merged
merged 6 commits into from Oct 6, 2021

Conversation

zcahana
Copy link
Contributor

@zcahana zcahana commented Aug 1, 2021

What this PR does / why we need it:

This PR extends the VM status field (.status.printableStatus) with new ErrorPvcNotFound/ErrorDataVolumeNotFound statuses, reported when a VM with a PVC/DataVolume type of volume is started, and the referenced object does not exist.

Special notes for your reviewer:

Release note:

Report ErrorPvcNotFound/ErrorDataVolumeNotFound VM status when PVC/DV-type volumes reference non-existent objects

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/L kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Aug 1, 2021
@zcahana zcahana force-pushed the pvc_not_found branch 2 times, most recently from ca391f5 to c14ba69 Compare August 1, 2021 14:49
@zcahana
Copy link
Contributor Author

zcahana commented Aug 1, 2021

/retest

@kubevirt-bot kubevirt-bot added lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 5, 2021
@kubevirt-bot kubevirt-bot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 6, 2021
@zcahana
Copy link
Contributor Author

zcahana commented Aug 9, 2021

/retest

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 20, 2021
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 29, 2021
@zcahana
Copy link
Contributor Author

zcahana commented Aug 30, 2021

/retest

1 similar comment
@zcahana
Copy link
Contributor Author

zcahana commented Aug 30, 2021

/retest

@zcahana
Copy link
Contributor Author

zcahana commented Aug 30, 2021

@jean-edouard can you give this another look when you have some time?
No actual changes since your prev lgtm, rather than a rebase.

@jean-edouard
Copy link
Contributor

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jean-edouard

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 30, 2021
@zcahana
Copy link
Contributor Author

zcahana commented Aug 30, 2021

/approve

Thanks @jean-edouard! Can you also /lgtm this, or do you prefer someone else to take a look too?

@jean-edouard
Copy link
Contributor

Thanks @jean-edouard! Can you also /lgtm this, or do you prefer someone else to take a look too?

Let's have someone else LGTM, in case I missed something.

@xpivarc
Copy link
Member

xpivarc commented Sep 13, 2021

/cc

@@ -134,7 +134,27 @@ type templateService struct {
launcherSubGid int64
}

type PvcNotFoundError error
type PvcNotFoundError struct {
Err error
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be a slightly weird nesting. A error is a type which implements Error() string. So you could just have a reason string field for instance. Did you do that so that you could use fmt.Errof? Maybe use fmt.Sprintf?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you just want a nice constructor for the error? Something like NewPVCNotFoundError()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I don't remember what was my rationale at the time when writing it like this (possible some partial inspiration from the Go 1.13 error handling pattern). Anyway I too don't see a good reason for it - will change to a reason string.

@@ -1613,19 +1620,30 @@ func (c *VMIController) volumeReadyToAttachToNode(namespace string, volume virtv
} else if volume.PersistentVolumeClaim != nil {
name = volume.PersistentVolumeClaim.ClaimName
}

dataVolumeFunc := dataVolumeByNameFunc(c.dataVolumeInformer, dataVolumes)
Copy link
Member

Choose a reason for hiding this comment

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

There is one other check if the volume is populated for hotplug. Is that covered too?

It may make sense to get rid of this callback function and now, that we have to do pre-validation to see if the DV exist at all, and just pass in the data volume to IsPopulated. Since that is provided by CDI, it could probably be wrapped so that one can just pass in the DV. Not a big thing but the flow is pretty bumpy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is one other check if the volume is populated for hotplug. Is that covered too?

I think it is, since volumeReadyToAttachToNode is invoked for every datavolume, be it hotplugged or not.

It may make sense to get rid of this callback function and now, that we have to do pre-validation to see if the DV exist at all, and just pass in the data volume to IsPopulated. Since that is provided by CDI, it could probably be wrapped so that one can just pass in the DV. Not a big thing but the flow is pretty bumpy.

I'm not sure I entirely follow. Did you mean to change the code such that the dataVolumeFunc that is passed into IsPopulated will directly return the correct DataVolume object? If so, than this is not too far from what's already being done.

@zcahana
Copy link
Contributor Author

zcahana commented Sep 19, 2021

/retest

1 similar comment
@zcahana
Copy link
Contributor Author

zcahana commented Sep 20, 2021

/retest

@zcahana
Copy link
Contributor Author

zcahana commented Sep 22, 2021

/retest

…ound

Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
@xpivarc
Copy link
Member

xpivarc commented Oct 4, 2021

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 4, 2021
@kubevirt-commenter-bot
Copy link

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

@zcahana
Copy link
Contributor Author

zcahana commented Oct 4, 2021

/retest

@kubevirt-commenter-bot
Copy link

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

@zcahana
Copy link
Contributor Author

zcahana commented Oct 5, 2021

/retest

1 similar comment
@zcahana
Copy link
Contributor Author

zcahana commented Oct 5, 2021

/retest

@kubevirt-commenter-bot
Copy link

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

1 similar comment
@kubevirt-commenter-bot
Copy link

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

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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants