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

feat(vmsnapshot): add new events #647

Merged
merged 3 commits into from
Jan 22, 2025
Merged

Conversation

hardcoretime
Copy link
Contributor

@hardcoretime hardcoretime commented Jan 20, 2025

Description

Add events when VirtualMachineSnapshot:

  • waits for dependent resources;
  • is started;
  • is failed;
  • is completed.

Why do we need it, and what problem does it solve?

It improves user experience in the snapshotting process of VirtualMachine.

What is the expected result?

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

@hardcoretime hardcoretime force-pushed the feat/vmsnapshot/add-new-events branch from bee9d48 to 2618d97 Compare January 20, 2025 18:54
@hardcoretime hardcoretime requested a review from Isteb4k January 20, 2025 19:18
@hardcoretime hardcoretime marked this pull request as ready for review January 20, 2025 19:37
Signed-off-by: Roman Sysoev <[email protected]>
@hardcoretime hardcoretime force-pushed the feat/vmsnapshot/add-new-events branch from 2618d97 to a664fe1 Compare January 22, 2025 08:29
@@ -61,7 +64,7 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmSnapshot *virtv2.Virtual

vm, err := h.snapshotter.GetVirtualMachine(ctx, vmSnapshot.Spec.VirtualMachineName, vmSnapshot.Namespace)
if err != nil {
setPhaseConditionToFailed(cb, &vmSnapshot.Status.Phase, err)
setPhaseConditionToFailed(h, cb, vmSnapshot, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make the function a method? So we don't have to pass the handler as an argument.

vmSnapshot,
corev1.EventTypeWarning,
virtv2.ReasonVMSnapshottingFailed,
err.Error()+".",
Copy link
Contributor

Choose a reason for hiding this comment

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

service.CapitalizeFirstLetter(err.Error()) + "."
The same as for the message below.

@hardcoretime hardcoretime force-pushed the feat/vmsnapshot/add-new-events branch from d1278fe to 2ab1419 Compare January 22, 2025 14:19
@hardcoretime hardcoretime force-pushed the feat/vmsnapshot/add-new-events branch from 2ab1419 to a6299d4 Compare January 22, 2025 14:36
@hardcoretime hardcoretime merged commit ab9fe54 into main Jan 22, 2025
12 checks passed
@hardcoretime hardcoretime deleted the feat/vmsnapshot/add-new-events branch January 22, 2025 15:11
hardcoretime added a commit that referenced this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants