-
Notifications
You must be signed in to change notification settings - Fork 459
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
Destroying a domain should try to power it off first #356
Comments
I think there are flags on the libvirt API that controls the destruction of the domain to do something like this. However this would need some research. |
My biggest concern here is that we would need to introduce time-outs which would slow down everything, or am I wrong? |
@multani just for curiosity, if you are going to destroy/remove forever a VM why (taking your quote) TIA for your time 🌻 |
So, just to take this out: I like the current behavior which allows for very fast destroy/creation cycle and I think it should be kept somehow! @MalloZup As for the use case: we have some services (Consul and Sensu, in particular) which are running on these VMs (they provide a way to register the VMs automatically in the service discovery when they come in). Destroying the VMs with the current behavior offers no chances at all for these services to signal they are shutting down (properly) and for the rest of the world, these VMs simply stopped working and we have to manually deregister them. Also, AFAIK this would be a bit more similar to what's happening with other "instance providers" managed by Terraform, where Terraform requests a shutdown + removal of the VMs via the provider API instead of brutally removing them. As for the performance impact: As I said at the beginning, we should keep the current behavior possible (aka. "very fast destroy"), definitely.
If we have |
@multani thx for the reply to your usecase and proposal suggestion for the implementation. Personally i prefer the We need also finally to research on the libvirt side for using the right flags for this behaviours. i could have a look once i have some free time |
@MalloZup Actually, I would advocate to have both flags, with the defaults being:
And users could override this as needed. That would prevent any hardcoded values and annoyance because it's too fast/too slow :)
I had a look and I'm actually surprised because it says the "destroy" call actually calls shutdown as well with a timeout, but it looks like it's driver dependent. |
While that's very much true, the clients should be smart enough to detect that based on socket(s) being closed or is that somehow not possible in your case? |
Having said that, I can see maybe how it's not good enough for some cases so I'd like a PR that adds the suggested API, although i don't think we need a boolean flag, just the timeout one is enough and if it's set to 0, we just destroy the domain immediately. In any case, unless @multani (or someone else) is still interested and motivated to provide a PR for this, I suggest we close this. |
I'm ok to close it and focus on core issues.. |
They are, but then it's a different case between a machine is leaving properly and a machine disappears suddenly.
If we agree on the interface, I can have a look to propose something in the coming weeks.
In every cases we destroy it 🤔 but it can be faster in the case where it shuts down properly before the timeout has been reached. |
I agree with @multani . Imho the boolean flag has it use-case here. @dmacvicar cc. I'm re-opening. I will have currenlty no time in short-term to do it, but also even if it a stale issue, I feel that this issue belong to remains open. IMHO it important, is not something that one could workaround easy as other libvirt issue where we just need to add compatibility. (but one can do with XSLT now) |
@MalloZup I'm a bit lost in the details here. Could you please tell me why a separate boolean flag is needed in your opinion? About keeping the issue open, I strongly suggest not keeping issues open unless it's very important or there is active work going on the issue. In a volunteer-driven project, people get busy and even with their best intentions to work on something, they may never get to do it (or finish it). When issues are stale for a while, I'd suggest we close them with 'Reopen if you can provide a PR for this or is actually affecting you". Issues can alway be re-opened and closed multiple times. Just my two cents. |
Correct but my suggestion was that we don't send the |
See https://raw.githubusercontent.com/hashicorp/terraform-plugin-sdk/v1-maint/CHANGELOG.md BUG FIXES: * Remove deprecation for `d.Partial` ([dmacvicar#463](hashicorp/terraform-plugin-sdk#463)) * Fix bug when serializing bool in TypeMap ([dmacvicar#465](hashicorp/terraform-plugin-sdk#465)) DEPRECATIONS: * Deprecate `DisableBinaryDriver` ([dmacvicar#450](hashicorp/terraform-plugin-sdk#450)) * Deprecate the `helper/mutexkv`, `helper/pathorcontents`, `httpclient`, and `helper/hashcode` packages ([dmacvicar#453](hashicorp/terraform-plugin-sdk#453)) FEATURES: * Allow disabling binary testing via `TF_DISABLE_BINARY_TESTING` environment variable. ([dmacvicar#441](hashicorp/terraform-plugin-sdk#441)) BUG FIXES: * More accurate results for `schema.ResourceData.HasChange` when dealing with a Set inside another Set. ([dmacvicar#362](hashicorp/terraform-plugin-sdk#362)) DEPRECATED: * helper/encryption: In line with sensitive state best practices, the `helper/encryption` package is deprecated. ([dmacvicar#437](hashicorp/terraform-plugin-sdk#437)) ENHANCEMENTS: * Better error messaging when indexing into TypeSet for test checks, while the binary driver is enabled (currently not supported) ([dmacvicar#417](hashicorp/terraform-plugin-sdk#417)) * Prevent ConflictsWith from self referencing and prevent referencing multi item Lists or Sets ([dmacvicar#416](hashicorp/terraform-plugin-sdk#416)] [[dmacvicar#423](hashicorp/terraform-plugin-sdk#423)] [[dmacvicar#426](hashicorp/terraform-plugin-sdk#426)) FEATURES: * Added validation helper `RequiredWith` ([dmacvicar#342](hashicorp/terraform-plugin-sdk#342)) BUG FIXES: * Binary acceptance test driver: omit test cleanup when state is empty ([dmacvicar#356](hashicorp/terraform-plugin-sdk#356)) * Make mockT.Fatal halt execution ([dmacvicar#396](hashicorp/terraform-plugin-sdk#396)) DEPENDENCIES: * `github.com/hashicorp/[email protected]` -> `v1.3.0` [[dmacvicar#400](hashicorp/terraform-plugin-sdk#400)] BUG FIXES: * Binary acceptance test driver: fix cleanup of temporary directories ([dmacvicar#378](hashicorp/terraform-plugin-sdk#378)) DEPRECATED: * helper/schema: `ResourceData.GetOkExists` will not be removed in the next major version unless a suitable replacement or alternative can be prescribed ([dmacvicar#350](hashicorp/terraform-plugin-sdk#350)) FEATURES: * Added support for additional protocol 5.2 fields (`Description`, `DescriptionKind`, `Deprecated`) ([dmacvicar#353](hashicorp/terraform-plugin-sdk#353)) BUG FIXES: * Binary acceptance test driver: auto-configure providers ([dmacvicar#355](hashicorp/terraform-plugin-sdk#355)) FEATURES: * helper/validation: `StringNotInSlice` ([dmacvicar#341](hashicorp/terraform-plugin-sdk#341)) FEATURES: * Binary acceptance test driver ([dmacvicar#262](hashicorp/terraform-plugin-sdk#262)) DEPRECATED: * helper/schema: `ResourceData.Partial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317)) * helper/schema: `ResourceData.SetPartial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317)) DEPRECATED: * helper/validation: `ValidateListUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `SingleIP` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IPRange` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `CIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `ValidateJsonString` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `ValidateRegexp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `ValidateRFC3339TimeString` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) FEATURES: * helper/validation: `IntDivisibleBy` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IntNotInSlice` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsIPv6Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsIPv4Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsCIDR` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsMACAddress` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsPortNumber` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsPortNumberOrZero` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsDayOfTheWeek` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsMonth` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsRFC3339Time` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsURLWithHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsURLWithHTTPorHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsURLWithScheme` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `ListOfUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IsIPAddress` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IsIPv4Range` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IsCIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `StringIsJSON` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `StringIsValidRegExp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) FEATURES: * helper/validation: `StringIsEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `StringIsNotEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `StringIsWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `StringIsNotWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `IsUUID` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) ([dmacvicar#297](hashicorp/terraform-plugin-sdk#297)) BUG FIXES: * schema/ExactlyOneOf: Fix handling of unknowns in complex types ([dmacvicar#287](hashicorp/terraform-plugin-sdk#287)) BUG FIXES: * helper/resource: Don't crash when dependent test sweeper is missing ([dmacvicar#279](hashicorp/terraform-plugin-sdk#279))
See https://raw.githubusercontent.com/hashicorp/terraform-plugin-sdk/v1-maint/CHANGELOG.md BUG FIXES: * Remove deprecation for `d.Partial` ([dmacvicar#463](hashicorp/terraform-plugin-sdk#463)) * Fix bug when serializing bool in TypeMap ([dmacvicar#465](hashicorp/terraform-plugin-sdk#465)) DEPRECATIONS: * Deprecate `DisableBinaryDriver` ([dmacvicar#450](hashicorp/terraform-plugin-sdk#450)) * Deprecate the `helper/mutexkv`, `helper/pathorcontents`, `httpclient`, and `helper/hashcode` packages ([dmacvicar#453](hashicorp/terraform-plugin-sdk#453)) FEATURES: * Allow disabling binary testing via `TF_DISABLE_BINARY_TESTING` environment variable. ([dmacvicar#441](hashicorp/terraform-plugin-sdk#441)) BUG FIXES: * More accurate results for `schema.ResourceData.HasChange` when dealing with a Set inside another Set. ([dmacvicar#362](hashicorp/terraform-plugin-sdk#362)) DEPRECATED: * helper/encryption: In line with sensitive state best practices, the `helper/encryption` package is deprecated. ([dmacvicar#437](hashicorp/terraform-plugin-sdk#437)) ENHANCEMENTS: * Better error messaging when indexing into TypeSet for test checks, while the binary driver is enabled (currently not supported) ([dmacvicar#417](hashicorp/terraform-plugin-sdk#417)) * Prevent ConflictsWith from self referencing and prevent referencing multi item Lists or Sets ([dmacvicar#416](hashicorp/terraform-plugin-sdk#416)] [[dmacvicar#423](hashicorp/terraform-plugin-sdk#423)] [[dmacvicar#426](hashicorp/terraform-plugin-sdk#426)) FEATURES: * Added validation helper `RequiredWith` ([dmacvicar#342](hashicorp/terraform-plugin-sdk#342)) BUG FIXES: * Binary acceptance test driver: omit test cleanup when state is empty ([dmacvicar#356](hashicorp/terraform-plugin-sdk#356)) * Make mockT.Fatal halt execution ([dmacvicar#396](hashicorp/terraform-plugin-sdk#396)) DEPENDENCIES: * `github.com/hashicorp/[email protected]` -> `v1.3.0` [[dmacvicar#400](hashicorp/terraform-plugin-sdk#400)] BUG FIXES: * Binary acceptance test driver: fix cleanup of temporary directories ([dmacvicar#378](hashicorp/terraform-plugin-sdk#378)) DEPRECATED: * helper/schema: `ResourceData.GetOkExists` will not be removed in the next major version unless a suitable replacement or alternative can be prescribed ([dmacvicar#350](hashicorp/terraform-plugin-sdk#350)) FEATURES: * Added support for additional protocol 5.2 fields (`Description`, `DescriptionKind`, `Deprecated`) ([dmacvicar#353](hashicorp/terraform-plugin-sdk#353)) BUG FIXES: * Binary acceptance test driver: auto-configure providers ([dmacvicar#355](hashicorp/terraform-plugin-sdk#355)) FEATURES: * helper/validation: `StringNotInSlice` ([dmacvicar#341](hashicorp/terraform-plugin-sdk#341)) FEATURES: * Binary acceptance test driver ([dmacvicar#262](hashicorp/terraform-plugin-sdk#262)) DEPRECATED: * helper/schema: `ResourceData.Partial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317)) * helper/schema: `ResourceData.SetPartial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317)) DEPRECATED: * helper/validation: `ValidateListUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `SingleIP` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IPRange` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `CIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `ValidateJsonString` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `ValidateRegexp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `ValidateRFC3339TimeString` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) FEATURES: * helper/validation: `IntDivisibleBy` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IntNotInSlice` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsIPv6Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsIPv4Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsCIDR` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsMACAddress` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsPortNumber` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsPortNumberOrZero` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsDayOfTheWeek` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsMonth` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsRFC3339Time` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsURLWithHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsURLWithHTTPorHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `IsURLWithScheme` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296)) * helper/validation: `ListOfUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IsIPAddress` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IsIPv4Range` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `IsCIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `StringIsJSON` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `StringIsValidRegExp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301)) * helper/validation: `StringIsEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `StringIsNotEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `StringIsWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `StringIsNotWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) * helper/validation: `IsUUID` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) ([dmacvicar#297](hashicorp/terraform-plugin-sdk#297)) BUG FIXES: * schema/ExactlyOneOf: Fix handling of unknowns in complex types ([dmacvicar#287](hashicorp/terraform-plugin-sdk#287)) * helper/resource: Don't crash when dependent test sweeper is missing ([dmacvicar#279](hashicorp/terraform-plugin-sdk#279))
Hello! Is this functionality already implemented? Working with Fedora CoreOS and inmediate destruction affects some logic when the new VMs is recreated. Thanks |
Version Reports:
Distro version of host:
Debian stretch
Terraform Version Report
v0.11.7
Libvirt version
3.0.0
terraform-provider-libvirt plugin version (git-hash)
58cc06611667bbbdddafacb411cd6bc8da1c2b00
Description of Issue/Question
When a domain is destroyed by Terraform, it should be possible to send it a "power-off" signal so that it has the chance to shut down properly.
Althoug the current method is very fast at replacing VMs, it is also very brutal and doesn't offer any chance for the VM to react correctly before disappearing (such as deregistering services upon shutdown, etc.).
This is the last part of that wiki paragraph:
The text was updated successfully, but these errors were encountered: