fix(domain): update domain running state when refreshed #668
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
System Information
Linux distribution
Debian GNU/Linux 10 (buster)
Terraform version
Provider and libvirt versions
Checklist
Your issue is it a bug or something that does not work as expected.
Description of Issue
I'm currently using libvirt locally on my PC. Whenever I shutdown my computer, all the domains are stopped (which is correct, I don't wan't some tests domain to restart whenever I restart the host). Until then, all's good.
But when I want to restart my stack after a reboot, terraform says that there is nothing to do. As the domains are in stopped state, I expected terraform to put them online again (in order to get immutable infrastructure). I noticed that the running property doesn't get updated when terraform tries a refresh.
What did I do
I used the method domainIsRunning in order to get the domain state, and updated the schema running property. Tests were all good, but there seems to be a bug which is not related to this PR.
Additional information:
Apparmor is disabled.
First PR, and first GO code : sorry if I did something wrong in the way.
Please tell me in order to improve.
On a side note, there is also something wrong with the network state refresh.
When I ran the tests, i got this :