Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 602599 - [RFE] A new API for custom cleanup prior to close in perl bindings
[RFE] A new API for custom cleanup prior to close in perl bindings
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
  Show dependency treegraph
Reported: 2010-06-10 05:34 EDT by Matthew Booth
Modified: 2010-09-30 06:59 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-09-30 06:59:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Matthew Booth 2010-06-10 05:34:21 EDT
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 {
Comment 1 Richard W.M. Jones 2010-06-10 13:18:32 EDT
See my reply here:
Comment 2 Richard W.M. Jones 2010-09-30 06:34:26 EDT
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.
Comment 3 Matthew Booth 2010-09-30 06:59:19 EDT
I worked round it with GuestfsHandle, so i don't need this any more.

Note You need to log in before you can comment on or make changes to this bug.