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

Allow switching VM power state during restore #306

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

alromeros
Copy link
Contributor

@alromeros alromeros commented Dec 13, 2024

What this PR does / why we need it:

This Pull Request enhances the behavior of VirtualMachine restores by introducing a new label:

"velero.kubevirt.io/restore-run-strategy"

This label can be added to the restore resource to explicitly control the power state of the VirtualMachine during the restore process. The VirtualMachine's state is backed up as it exists at the time of backup, but these labels allow you to override the default behavior and define the desired RunStrategy at restore time.

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

Special notes for your reviewer:

There's some overlapping code with #304 but conflicts will be easy to solve.

Release note:

Allow switching VM run strategy during restore 

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Dec 13, 2024
@alromeros alromeros force-pushed the turn-vm-on-off branch 2 times, most recently from 9bbd7d6 to 131ca82 Compare December 13, 2024 15:47
@mhenriks
Copy link
Member

Would it be better to have a single label that maps to the VM runStrategy?

@alromeros
Copy link
Contributor Author

Would it be better to have a single label that maps to the VM runStrategy?

That's so much better, thanks for the suggestion. Will address it on Monday.

@alromeros
Copy link
Contributor Author

/test pull-kvp-functional-test

@alromeros alromeros force-pushed the turn-vm-on-off branch 4 times, most recently from 25643c3 to e8fa2b7 Compare December 17, 2024 09:43
This commit implements a new label that allows switching the VM RunStrategy before restore.

Signed-off-by: Alvaro Romero <[email protected]>
This commit adds func test coverage for the "velero.kubevirt.io/restore-power-on" and "velero.kubevirt.io/restore-power-off" labels.

Signed-off-by: Alvaro Romero <[email protected]>
@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 Dec 17, 2024
@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2024
@kubevirt-bot kubevirt-bot merged commit d6abb26 into kubevirt:main Dec 17, 2024
5 checks passed
@alromeros
Copy link
Contributor Author

/cherrypick release-v0.7

@kubevirt-bot
Copy link

@alromeros: #306 failed to apply on top of branch "release-v0.7":

Applying: Allow specifying VM RunStrategy before restore
Using index info to reconstruct a base tree...
M	pkg/plugin/vm_backup_item_action.go
M	pkg/plugin/vm_restore_item_action.go
M	pkg/plugin/vm_restore_item_action_test.go
M	pkg/plugin/vmi_backup_item_action.go
M	pkg/util/util.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/util/util.go
CONFLICT (content): Merge conflict in pkg/util/util.go
Auto-merging pkg/plugin/vmi_backup_item_action.go
CONFLICT (content): Merge conflict in pkg/plugin/vmi_backup_item_action.go
Auto-merging pkg/plugin/vm_restore_item_action_test.go
Auto-merging pkg/plugin/vm_restore_item_action.go
CONFLICT (content): Merge conflict in pkg/plugin/vm_restore_item_action.go
Auto-merging pkg/plugin/vm_backup_item_action.go
CONFLICT (content): Merge conflict in pkg/plugin/vm_backup_item_action.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Allow specifying VM RunStrategy before restore

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.

@alromeros
Copy link
Contributor Author

Trying again after backporting previous PR
/cherrypick release-v0.7

@kubevirt-bot
Copy link

@alromeros: #306 failed to apply on top of branch "release-v0.7":

Applying: Allow specifying VM RunStrategy before restore
Using index info to reconstruct a base tree...
M	pkg/plugin/vm_backup_item_action.go
M	pkg/plugin/vm_restore_item_action.go
M	pkg/plugin/vm_restore_item_action_test.go
M	pkg/plugin/vmi_backup_item_action.go
M	pkg/util/util.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/util/util.go
CONFLICT (content): Merge conflict in pkg/util/util.go
Auto-merging pkg/plugin/vmi_backup_item_action.go
Auto-merging pkg/plugin/vm_restore_item_action_test.go
Auto-merging pkg/plugin/vm_restore_item_action.go
CONFLICT (content): Merge conflict in pkg/plugin/vm_restore_item_action.go
Auto-merging pkg/plugin/vm_backup_item_action.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Allow specifying VM RunStrategy before restore

In response to this:

Trying again after backporting previous PR
/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