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

Qemu Agent Enhancement #1053

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tiaden
Copy link
Contributor

@tiaden tiaden commented Dec 14, 2023

The idea of this PR is to make sure that the guest qemu agent is running by explicitly query it. This will make ip retrieval for example more reliable. let me know what you think

Please make sure you read the contributor documentation before opening a Pull Request.

…come online. This makes ip information queries using the qemu_agent more reliable
@mleone87
Copy link

Checked this PR locally and it works! Upstream code with bridged network and qemu_agent = true does not work since it fails at t=0 without retries. You have to run terraform refresh some time to make it discover the IP ad have a corret tfstate

@dmacvicar this should be merged I guess

@tiaden
Copy link
Contributor Author

tiaden commented Apr 19, 2024

@dmacvicar, any chance of getting this merged ?

Copy link
Owner

@dmacvicar dmacvicar left a comment

Choose a reason for hiding this comment

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

Thanks for the PR 🙏

I think it makes sense to merge some kind of check. However, I'd need to understand the level of defensiveness of the code (eg. checking for qemu_agent inside and outside of the function, and running the same block twice). This code smells like "just in case".

@@ -602,6 +602,18 @@ func resourceLibvirtDomainCreate(ctx context.Context, d *schema.ResourceData, me
d.SetId(id)
log.Printf("[INFO] Domain ID: %s", d.Id())

if d.Get("qemu_agent").(bool) && d.Get("running").(bool) {
Copy link
Owner

Choose a reason for hiding this comment

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

Why does the code check for d.Get("qemu_agent") if then waitingForAgentRunning checks again?

@@ -769,6 +781,18 @@ func resourceLibvirtDomainUpdate(ctx context.Context, d *schema.ResourceData, me
}
}

if d.Get("qemu_agent").(bool) && d.Get("running").(bool) {
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this wait executed twice?

@tiaden
Copy link
Contributor Author

tiaden commented Sep 15, 2024

@dmacvicar, I replied to your comments. As of the level of defensiveness (eg. checking for qemu_agent inside and outside of the function), it's just my style of programming. But you are right. what do you prefer ? keeping the check inside or outside the function ? as for your comment about running the same block twice, as I explained in the comment, those blocks happened to be inside different functions

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.

3 participants