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

restoreInstancetypeControllerRevisions unable to handle repeat reconcile calls to restore the same snapshot to a new VirtualMachine #8890

Closed
Tracked by #8235
lyarwood opened this issue Dec 1, 2022 · 0 comments · Fixed by #8891

Comments

@lyarwood
Copy link
Member

lyarwood commented Dec 1, 2022

/area instancetype

What happened:

restoreInstancetypeControllerRevisions currently assumes that restoring a snapshot to a new VirtualMachine will always create a new ControllerRevision. However this isn't the case if the VirtualMachineRestore reconcile loop fails after the first call to restoreInstancetypeControllerRevisions causing a subsequent attempt to reconcile calling the function again. In this case the ControllerRevision has already been restored.

For example, the following virt-controller logs come from the Tests Suite.[sig-storage] VirtualMachineRestore Tests With simple VM with instancetype and preferences should create new ControllerRevisions for newly restored VM test. They show the first attempt to reconcile the VirtualMachineRestore failing due to failed to allocate requested mac address with future attempts then failing because a ControllerRevision for the instance type already exists:

{"component":"virt-controller","kind":"","level":"info","msg":"Updating VirtualMachineRestore","name":"restore-testvmi-75k5z-new","namespace":"kubevirt-test-default2","pos":"restore.go:105","timestamp":"2022-12-01T01:59:00.050983Z","uid":"38d04aa6-b98c-4c29-b59b-715ad9858c94"}
{"component":"virt-controller","kind":"","level":"info","msg":"Updating VirtualMachineRestore","name":"restore-testvmi-75k5z-new","namespace":"kubevirt-test-default2","pos":"restore.go:105","timestamp":"2022-12-01T01:59:00.068584Z","uid":"38d04aa6-b98c-4c29-b59b-715ad9858c94"}
{"component":"virt-controller","kind":"","level":"error","msg":"Error reconciling target","name":"restore-testvmi-75k5z-new","namespace":"kubevirt-test-default2","pos":"restore.go:167","reason":"admission webhook \"mutatevirtualmachines.kubemacpool.io\" denied the request: Failed to create virtual machine allocation error: Failed to allocate mac to the vm object: failed to allocate requested mac address","timestamp":"2022-12-01T01:59:00.089010Z","uid":"38d04aa6-b98c-4c29-b59b-715ad9858c94"}
E1201 01:59:00.102157       1 util.go:72] admission webhook "mutatevirtualmachines.kubemacpool.io" denied the request: Failed to create virtual machine allocation error: Failed to allocate mac to the vm object: failed to allocate requested mac address
{"component":"virt-controller","kind":"","level":"info","msg":"Updating VirtualMachineRestore","name":"restore-testvmi-75k5z-new","namespace":"kubevirt-test-default2","pos":"restore.go:105","timestamp":"2022-12-01T01:59:00.102197Z","uid":"38d04aa6-b98c-4c29-b59b-715ad9858c94"}
{"component":"virt-controller","kind":"","level":"info","msg":"Updating VirtualMachineRestore","name":"restore-testvmi-75k5z-new","namespace":"kubevirt-test-default2","pos":"restore.go:105","timestamp":"2022-12-01T01:59:00.113198Z","uid":"38d04aa6-b98c-4c29-b59b-715ad9858c94"}
{"component":"virt-controller","kind":"","level":"error","msg":"Error reconciling target","name":"restore-testvmi-75k5z-new","namespace":"kubevirt-test-default2","pos":"restore.go:167","reason":"controllerrevisions.apps \"testvmi-75k5z-new-vm-instancetype-sqhz4-13577e41-72f7-4e15-8f59-a6fa7e45e147-1\" already exists","timestamp":"2022-12-01T01:59:00.122993Z","uid":"38d04aa6-b98c-4c29-b59b-715ad9858c94"}
E1201 01:59:00.137520       1 util.go:72] controllerrevisions.apps "testvmi-75k5z-new-vm-instancetype-sqhz4-13577e41-72f7-4e15-8f59-a6fa7e45e147-1" already exists

What you expected to happen:

restoreInstancetypeControllerRevisions should be able to handle repeat calls in all scenarios.

How to reproduce it (as minimally and precisely as possible):

Somehow cause the reconcile loop to fail after first calling restoreInstancetypeControllerRevisions.

Additional context:

https://bugzilla.redhat.com/show_bug.cgi?id=2149900

Environment:

  • KubeVirt version (use virtctl version): N/A
  • Kubernetes version (use kubectl version): N/A
  • VM or VMI specifications: N/A
  • Cloud provider or hardware configuration: N/A
  • OS (e.g. from /etc/os-release): N/A
  • Kernel (e.g. uname -a): N/A
  • Install tools: N/A
  • Others: N/A
lyarwood added a commit to lyarwood/kubevirt that referenced this issue Dec 1, 2022
Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
kubevirt-bot pushed a commit to kubevirt-bot/kubevirt that referenced this issue Dec 6, 2022
Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants