public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly
@ 2021-07-30 11:04 Hannes Laimer
  2021-07-30 13:06 ` [pve-devel] applied: " Thomas Lamprecht
  2021-08-02  8:29 ` [pve-devel] " Fabian Ebner
  0 siblings, 2 replies; 4+ messages in thread
From: Hannes Laimer @ 2021-07-30 11:04 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 PVE/Storage/BTRFSPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
index 4596b30..411cab9 100644
--- a/PVE/Storage/BTRFSPlugin.pm
+++ b/PVE/Storage/BTRFSPlugin.pm
@@ -410,7 +410,7 @@ sub free_image {
 	$class->parse_volname($volname);
 
     if ($format ne 'subvol' && $format ne 'raw') {
-	return PVE::Storage::DirPlugin::free_image(@_);
+	return PVE::Storage::DirPlugin->free_image($storeid, $scfg, $volname, $isBase, $_format);
     }
 
     my $path = $class->filesystem_path($scfg, $volname);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: Re: [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly
  2021-07-30 11:04 [pve-devel] [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly Hannes Laimer
@ 2021-07-30 13:06 ` Thomas Lamprecht
  2021-08-02  8:29 ` [pve-devel] " Fabian Ebner
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2021-07-30 13:06 UTC (permalink / raw)
  To: Proxmox VE development discussion, Hannes Laimer

On 30/07/2021 13:04, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
>  PVE/Storage/BTRFSPlugin.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks! Albeit the commit message was lacking background, so I amended
it with:

> The method is only derived in the DirPlugin module from the base
> Plugin, so we do not have it available there through a static module
> method call using ::, but only when using a class dereference.
> 
> Other fix options would have been:
> 
>   PVE::Storage::Plugin::free_image(@_);
> 
> or:
>   $class->SUPER::free_image($storeid, ...);

IMO, always helpful to have some background, it can help others learn something or
jump start such lousy brains like mine if they come over this in a few months again,
maybe even want to "optimize it back"; at least that's my experience with ours and
other projects source control trees, I never thought "wow, too much related info there
in the commit message" ;-)




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly
  2021-07-30 11:04 [pve-devel] [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly Hannes Laimer
  2021-07-30 13:06 ` [pve-devel] applied: " Thomas Lamprecht
@ 2021-08-02  8:29 ` Fabian Ebner
  2021-08-02  9:58   ` Wolfgang Bumiller
  1 sibling, 1 reply; 4+ messages in thread
From: Fabian Ebner @ 2021-08-02  8:29 UTC (permalink / raw)
  To: pve-devel, h.laimer

Am 30.07.21 um 13:04 schrieb Hannes Laimer:
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
>   PVE/Storage/BTRFSPlugin.pm | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
> index 4596b30..411cab9 100644
> --- a/PVE/Storage/BTRFSPlugin.pm
> +++ b/PVE/Storage/BTRFSPlugin.pm
> @@ -410,7 +410,7 @@ sub free_image {
>   	$class->parse_volname($volname);
>   
>       if ($format ne 'subvol' && $format ne 'raw') {
> -	return PVE::Storage::DirPlugin::free_image(@_);
> +	return PVE::Storage::DirPlugin->free_image($storeid, $scfg, $volname, $isBase, $_format);

Sorry, I had missed this in our brief off-list discussion, but this 
actually behaves differently from the previously intended semantics:

When free_image (the one that's called here) calls a method, now the 
method from DirPlugin is used rather than the one from BTRFSPlugin. It 
/might/ be fine in this case, but not sure. To be on the safe (and 
future-proof) side, we should go with one of the alternatives Thomas 
suggested.

>       }
>   
>       my $path = $class->filesystem_path($scfg, $volname);
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly
  2021-08-02  8:29 ` [pve-devel] " Fabian Ebner
@ 2021-08-02  9:58   ` Wolfgang Bumiller
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bumiller @ 2021-08-02  9:58 UTC (permalink / raw)
  To: Fabian Ebner; +Cc: pve-devel, h.laimer

On Mon, Aug 02, 2021 at 10:29:32AM +0200, Fabian Ebner wrote:
> Am 30.07.21 um 13:04 schrieb Hannes Laimer:
> > Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> > ---
> >   PVE/Storage/BTRFSPlugin.pm | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
> > index 4596b30..411cab9 100644
> > --- a/PVE/Storage/BTRFSPlugin.pm
> > +++ b/PVE/Storage/BTRFSPlugin.pm
> > @@ -410,7 +410,7 @@ sub free_image {
> >   	$class->parse_volname($volname);
> >       if ($format ne 'subvol' && $format ne 'raw') {
> > -	return PVE::Storage::DirPlugin::free_image(@_);
> > +	return PVE::Storage::DirPlugin->free_image($storeid, $scfg, $volname, $isBase, $_format);
> 
> Sorry, I had missed this in our brief off-list discussion, but this actually
> behaves differently from the previously intended semantics:
> 
> When free_image (the one that's called here) calls a method, now the method
> from DirPlugin is used rather than the one from BTRFSPlugin. It /might/ be
> fine in this case, but not sure. To be on the safe (and future-proof) side,
> we should go with one of the alternatives Thomas suggested.

Yes, let's please change this.
Normally I'd lean towards the `SUPER` version, but since our plugin
structure is somewhat "weird" (basically half of `DirPlugin` is
implemented in `Plugin`, and the other plugins dance around it...
somewhat...), I'd almost prefer calling `Plugin` directly.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-02  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 11:04 [pve-devel] [PATCH pve-storage] fix #3555: BTRFSPlugin: call free_image correctly Hannes Laimer
2021-07-30 13:06 ` [pve-devel] applied: " Thomas Lamprecht
2021-08-02  8:29 ` [pve-devel] " Fabian Ebner
2021-08-02  9:58   ` Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal