public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH v3 storage 3/4] add disk reassign feature
Date: Mon, 21 Sep 2020 13:11:54 +0200	[thread overview]
Message-ID: <a87b1c0c-3dd2-2faf-1662-5884d06c1b79@proxmox.com> (raw)
In-Reply-To: <a3f146e9-5b0e-2949-c9fe-fe62f167900e@proxmox.com>

On 18.09.20 17:07, Aaron Lauterer wrote:
> 
> 
> 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.

Note that you also can check the APIVERSION of external plugins through
the "api" method, which is required for them and checked on loading.

> 
>> * 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).

code duplication can also be avoided by just having a general method somewhere
which the single plugins just wrap around (call). That just "duplicates"
the calls, which is no actual duplication as it provides concrete information
about what which plugin uses they all share the implementation, which is the
actual reason for avoiding code duplication.

IMO a saner and more understandable than this approach, plus external plugins
can just call into this if it works for them.






  reply	other threads:[~2020-09-21 11:12 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
2020-09-21 11:11       ` Thomas Lamprecht [this message]
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=a87b1c0c-3dd2-2faf-1662-5884d06c1b79@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=a.lauterer@proxmox.com \
    --cc=pve-devel@lists.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