[pve-devel] [PATCH storage 1/2] add generic get_next_vm_diskname sub

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Aug 27 11:46:21 CEST 2018


On Fri, Aug 24, 2018 at 04:47:38PM +0200, Thomas Lamprecht wrote:
> On 8/22/18 3:41 PM, Stoiko Ivanov wrote:
> > Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> > ---
> >  PVE/Storage/Plugin.pm | 31 +++++++++++++++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> > 
> > diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
> > index 7db3a95..e9fe4ec 100644
> > --- a/PVE/Storage/Plugin.pm
> > +++ b/PVE/Storage/Plugin.pm
> > @@ -523,6 +523,37 @@ sub create_base {
> >      return $newvolname;
> >  }
> >  
> > +sub get_next_vm_diskname {
> > +    my ($disk_list, $storeid, $vmid, $fmt, $scfg, $add_fmt_suffix) = @_;
> > +
> > +    my $type = $scfg->{type};
> > +    my $plugindata = $defaultData->{plugindata}->{$type};
> 
> this is called $def in all other methods in this modules, please stick to
> that... maybe also add a $valid_fmts (or $valid_formats) helper variable:
>     my $valid_formats = $def->{format}->[0];
> 
> could make the post-if below easier to understand.
> 
> > +
> > +    my $disk_regex = qr/(vm|base)-\Q$vmid\E-disk-(\d+)/;
> > +    $disk_regex = qr/(vm|base|subvol|basevol)-\Q$vmid\E-disk-(\d+)/
> > +	if $plugindata->{format}[0]->{subvol};

{format}->[0]->{subvol} ?




More information about the pve-devel mailing list