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 #639

Merged
merged 1 commit into from
Nov 5, 2023

Conversation

ahadas
Copy link
Member

@ahadas ahadas commented Nov 2, 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.

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 <[email protected]>
Copy link

sonarqubecloud bot commented Nov 2, 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
0.0% 0.0% Duplication

@ahadas ahadas merged commit 66f7b11 into kubev2v:main Nov 5, 2023
9 checks passed
@ahadas ahadas deleted the osp_power_state branch November 5, 2023 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants