public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH v3 storage 3/4] add disk reassign feature
Date: Fri, 18 Sep 2020 17:07:12 +0200	[thread overview]
Message-ID: <a3f146e9-5b0e-2949-c9fe-fe62f167900e@proxmox.com> (raw)
In-Reply-To: <d780fc9a-c735-fb83-5ba4-f4cb1afbaef3@proxmox.com>



On 9/18/20 4:24 PM, Thomas Lamprecht wrote:
> On 9/10/20 4:32 PM, Aaron Lauterer wrote:
>> Functionality has been added for the following storage types:
>>
>> * dir based ones
>>      * directory
>>      * NFS
>>      * CIFS
>>      * gluster
>> * ZFS
>> * (thin) LVM
>> * Ceph
>>
>> A new feature `reassign` has been introduced to mark which storage
>> plugin supports the feature.
>>
>> A new intermediate class for directory based storages has been
>> introduced. This was necessary to maintain compatibility with third
>> party storage plugins and to avoid duplicate code in the dir based
>> plugins.
>>
>> The new `BaseDirPlugin.pm` adds the `reassign` feature flag and
>> containes the implementation for the reassign functionlity.
>>
>> In the future all the directory specific code in Plugin.pm should be
>> moved to the BaseDirPlugin.pm. But this will most likely break
>> compatibility with third party plugins and should thus be done with
>> care.
> 
> how so? why don't you just add it in plugin.pm with either:
> * a general directory based implementation, and a no-op/die for the other
>    ones

That was the first approach, but this would mean a die for all other plugins and if 3rd party plugins would not implement it, the directory based code will be used. But we cannot know if if the directory approach is the right one.

> * a dummy "die implement me in subclass" method if above is not possible

If I do it this way, I cannot put the actual code for dir based storage in the Plugin.pm, thus having an intermediate class for dir based storages would still be beneficial IMHO to avoid code duplication. IIRC we have 4 dir based storages (dir, CIFS, NFS, Gluster).

> 
> Then increase the ABI version AND age to allow external plugins to tell
> if they can or should implement this themself.

Thanks for the hint.

> 
> As is you do not allow any 3rd party plugin to provide their own method
> for this (they cannot know when it's even used) and those without it
> get an error as the Storage::reassign_volume one plainly calls into
> $class->reassign_volume which, as no default module is there, may fail
> much uglier than a `die "not implemented in class $class\n"` excetpion.
> 
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
>> ---
>> v2 -> v3:
>> * added feature flags instead of dummy "not implemented" methods in
>>    plugins which do not support it as that would break compatibility with
>>    3rd party plugins.
>>    Had to make $features available outside the `has_features` method in
>>    Plugins.pm in order to be able to individually add features in the
>>    `BaseDirPlugin.pm`.
> 
> no, this is not good and has bad side effects too, FWICT, as it changes
> a variable for all api calls in a worker, which then is changed for all
> plugins... NAK.
> 
> rather overwrite the has feature method, catch the specific case you need
> (reassign) and pass the other stuff back to the parent (SUPER) module

Okay, thanks for the feedback :)




  reply	other threads:[~2020-09-18 15:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 14:32 [pve-devel] [PATCH v3 series 0/4] disk reassign: add new feature Aaron Lauterer
2020-09-10 14:32 ` [pve-devel] [PATCH v3 qemu-server 1/4] disk reassign: add API endpoint Aaron Lauterer
2020-09-10 14:32 ` [pve-devel] [PATCH v3 qemu-server 2/4] cli: disk reassign: add reassign_disk to qm command Aaron Lauterer
2020-09-10 14:32 ` [pve-devel] [PATCH v3 storage 3/4] add disk reassign feature Aaron Lauterer
2020-09-18 14:24   ` Thomas Lamprecht
2020-09-18 15:07     ` Aaron Lauterer [this message]
2020-09-21 11:11       ` Thomas Lamprecht
2020-09-10 14:32 ` [pve-devel] [PATCH v3 widget-toolkit 4/4] utils: task_desc_table: add qmreassign Aaron Lauterer
2020-09-21 12:09   ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3f146e9-5b0e-2949-c9fe-fe62f167900e@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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