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

Fix power state handling from OpenStack #640

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

ahadas
Copy link
Member

@ahadas ahadas commented Nov 7, 2023

The function Client#PowerState returned the power state as a string under the assumption that its values would be On, Off, or Unknown. However, that was not enforced and it was easy to get confuse and return different values. The client for OpenStack did just that and returned the status that is received from OpenStack, for instance ACTIVE, and that led to have different power state than On when a VM was running on OpenStack at the time the migration was triggered, resulting in not setting the migrated VM with Running = true and therefore the migrated VM was stopped in KubeVirt even though it was supposed to start.

Therefore, we change the return argument for the power state in the Client#PowerState function to have its own type (reverting b4ff20b), VMPowerState, and change this function in the client for OpenStack to return "On" for VMs that were running in OpenStack.

https://issues.redhat.com/browse/MTV-811

Backport of #639

Long time ago, we posted VMs at the beginning of the migration and then
started and stopped them during the migration and therefore in order to
restore their original power state, we had to initiate another call to
patch the VM with its desired power state.

However, now that we post the VMs at the very last steps of the
migration, we can set their desired power state in their specification
and avoid another call to the target environment.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
The function Client#PowerState returned the power state as a string
under the assumption that its values would be On, Off, or Unknown.
However, that was not enforced and it was easy to get confuse and return
different values. The client for OpenStack did just that and returned
the status that is received from OpenStack, for instance ACTIVE, and
that led to have different power state than On when a VM was running on
OpenStack at the time the migration was triggered, resulting in not
setting the migrated VM with Running = true and therefore the migrated
VM was stopped in KubeVirt even though it was supposed to start.

Therefore, we change the return argument for the power state in the
Client#PowerState function to have its own type (reverting b4ff20b),
VMPowerState, and change this function in the client for OpenStack to
return "On" for VMs that were running in OpenStack.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
Copy link

sonarqubecloud bot commented Nov 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ahadas ahadas merged commit 36e3cc1 into kubev2v:release-v2.5.3 Nov 7, 2023
@ahadas ahadas deleted the release-v2.5.3 branch November 7, 2023 16:49
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.

1 participant