Bug 602599
| Summary: | [RFE] A new API for custom cleanup prior to close in perl bindings | ||
|---|---|---|---|
| Product: | [Community] Virtualization Tools | Reporter: | Matthew Booth <mbooth> |
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | unspecified | CC: | mbooth, moli, rwu, virt-maint, ycui |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2010-09-30 10:59:19 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
See my reply here: https://www.redhat.com/archives/libguestfs/2010-June/msg00096.html Matt, what's the current status of this one? If virt-v2v no longer needs it, then we should close it. If there is still pain for virt-v2v then we should leave it open, but see also comment 1 about how hard it is to solve it. I worked round it with GuestfsHandle, so i don't need this any more. |
If the perl bindings introduce an explicit close API, it will no longer be safe to rely on object destruction to call cleanup code. For example, if a program creates a temporary directory which must persist for the duration of the program but must be cleaned up prior to exit, the program cannot rely on a destructor to do the cleanup as the handle may have been closed before the destructor is executed. A solution to this would be to allow callbacks to be registered and executed immediately prior to close(). For example: $g->pre_close(sub { $g->rmdir($self->{foo}); });