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

health based check before polling vm #52

Merged
merged 2 commits into from
Apr 8, 2024
Merged

health based check before polling vm #52

merged 2 commits into from
Apr 8, 2024

Conversation

akhiljns
Copy link
Collaborator

@akhiljns akhiljns commented Apr 5, 2024

closes #51

hypervisor/base/types.go Outdated Show resolved Hide resolved
ip/ip.go Show resolved Hide resolved
@mhewedy mhewedy added this to the v0.130.0 release milestone Apr 6, 2024
@akhiljns akhiljns requested a review from mhewedy April 8, 2024 15:47
@@ -22,7 +22,7 @@ type Hypervisor interface {

Modify(vmName string, cpus int, mem int) error

HealthCheck(vmName, property string) (*string, error)
HealthCheck(vmName string) (*string, error)
Copy link
Owner

@mhewedy mhewedy Apr 8, 2024

Choose a reason for hiding this comment

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

Why return *string? the string you assert on in the ip.go ("UP") is VirtualBox specific.

better to make it general. so it is either pass (return nil error) or return an error

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed making this return boolean instead of string

@akhiljns akhiljns mentioned this pull request Apr 8, 2024

// Wait for health status to be "Up" for up to 5 minutes
timeout := time.After(5 * time.Minute)
for *health != "Up" {
Copy link
Owner

Choose a reason for hiding this comment

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

part of this logic is internal to VirtualBox (checking the "up" string), other part (the loop and the timeout thing) is general to all Healthchecks

I'll accept this PR and will open another PR to illustrate what I mean here ...

@mhewedy
Copy link
Owner

mhewedy commented Apr 8, 2024

I'll accept this PR and will open another PR to let you know what I mean... will make you a reviewer

@mhewedy mhewedy merged commit f2afdfb into mhewedy:master Apr 8, 2024
5 checks passed
@mhewedy
Copy link
Owner

mhewedy commented Apr 8, 2024

@akhiljns see complementary PR #56

@akhiljns akhiljns deleted the healthBasedCheck branch April 15, 2024 15:37
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.

health based check instead of sleep 30 secs
2 participants